diff --git a/CHANGES.md b/CHANGES.md
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,12 +1,156 @@
 User-visible changes in the hledger command line tool and library.
 
-# 1.16.2 2020-01-14
 
-- add support for megaparsec 8 (#1175)
+# 1.17 2020-03-01
 
-- close: mention --close-to/--open-from in docs
+## General
 
+- hledger's default date format is now YYYY-MM-DD (ISO-8601 dates).
+  (Brian Wignall, Jakob Schöttl, Simon Michael)
 
+- Drop the file format auto-detection feature.
+
+  For a long time hledger has auto-detected the file format when it's
+  not known, eg when reading from a file with unusual extension (like
+  .dat or .txt), or from standard input (-f-), or when using the
+  include directive (which currently ignores file extensions).  This
+  was done by trying all readers until one succeeded.  This worked
+  well in practice. But recent changes to timedot format have made
+  this kind of auto-detection unreliable. (timedot and journal formats
+  overlap).
+
+  For predictability and to minimise confusion, hledger will no longer
+  guess; when there's no file extension or reader prefix available, it
+  always assumes journal format.
+
+  To specify one of the other formats, you must use its standard file
+  extension (`.timeclock`, `.timedot`, `.csv`, `.ssv`, `.tsv`), or a
+  reader prefix (`-f csv:foo.txt`, `-f timedot:-`).
+
+  Experimental, feedback welcome.
+
+- Fix extra $ symbol (Mateus Furquim)
+
+- --output-format now rejects invalid formats
+
+- Numbers in JSON output now provide a floating point Number
+  representation as well as our native Decimal object representation,
+  since the later can sometimes contain 255-digit integers. The
+  floating point numbers can have up to 10 decimal digits (and an
+  unbounded number of integer digits.)
+  Experimental, suggestions needed. (#1195)
+
+- Fix finding latest date in queryEndDate Or queries and simplify
+  date comparison code. (Stephen Morgan)
+
+- Fix issue 457. (Jacek Generowicz)
+  Issue #457 pointed out that commands such as
+
+      hledger ui 'amt:>200'
+
+  failed. This was becasue the process of dispatching from `hledger ui`
+  to `hledger-ui` (note addition of `-`) lost the quotes around
+  `amt:>20` and the `>` character was interpreted as a shell redirection
+  operator, rather than as part of the argument.
+
+  The machinery for quoting or escaping arguements which contain
+  characters which require quoting or escaping (thus far whitespace and
+  quotes) already existed. This solution simply adds shell stdio
+  redirection characters to this set.
+
+## commands
+
+- add: you can use `<` to undo and redo previous inputs (Gaith Hallak)
+
+- bs, cf, is, bal, print, reg: support json output
+
+- bs, cf, is: fix excess subreport columns in csv output
+
+- bs, cf, is, bal: fix an issue with border intersections in
+  --pretty-tables output. (Eric Mertens)
+
+- close: fix a rounding bug that could generate unbalanced transactions. (#1164)
+
+- close: hide cost prices by default, show them with --show-costs.
+  close no longer preserves costs (transaction prices) unless you ask
+  it to, since that can generate huge entries when there are many
+  foreign currency/investment transactions. (#1165)
+
+- close: equity amounts are omitted by default, for simpler entries;
+  -x/--explicit shows them (usually causing more postings). (#1165)
+
+- close: --interleaved generates equity postings alongside each closed
+  account, making troubleshooting easier.
+
+- close: "equity:opening/closing balances" is now the default
+  closing and opening account.
+
+- close: --close-desc/--open-desc customise the closing/opening
+  transaction descriptions. (#1165)
+
+- close: some --open*/--close* flags have been simplified for memorability:
+
+  --closing -> --close
+  --opening -> --open
+  --close-to -> --close-acct
+  --open-from -> --open-acct
+
+  The old flags are accepted as hidden aliases, and deprecated. (#1165)
+
+- print, register: a new valuation type, --value=then, shows the
+  market value at each posting's date.
+
+- print: -V/-X/--value now imply -x/--explicit, as -B/--cost does.
+  This avoids a bug where print -V of a transaction with an implicit
+  commodity conversion would convert only some of its postings to value.
+
+## journal format
+
+- The include directive no longer tries all readers.  It now picks
+  just one, based on the included file's extension, defaulting to
+  journal.  (It doesn't yet handle a reader prefix.)
+
+- The default commodity (D) directive now limits display precision too. (#1187)
+  D directives are now fully equivalent to commodity directives for
+  setting a commodity's display style. (Previously it couldn't limit
+  the number of decimal places.)  When both kinds of directive exist,
+  commodity directives take precedence.  When there are multiple D
+  directives in the journal, only the last one affects display style.
+
+## csv format
+
+- Conditional blocks can now match single fields. \o/
+
+- The experimental --separator command line option has been dropped,
+  replaced a new `separator` directive in CSV rule files. (Aleksandar Dimitrov)
+  Also the `.tsv` and `.ssv` file extensions are now recognised,
+  and set the default `separator` to TAB and semicolon respectively.
+  (#1179)
+
+- Allow manual assignment of the "expenses:unknown" account name. (#1192)
+
+- CSV rule keywords are now case insensitive. (Aleksandar Dimitrov)
+
+## timeclock format
+
+- Misc. fixes making parsing more robust. (Jakob Schöttl)
+
+## timedot format
+
+- More support for org mode: org headlines can now be used for date
+  lines and timelog items (the stars are ignored). Also, any org
+  headlines before the first date line are ignored.
+
+- You can now write a description after a date, which will be used in
+  all of that day's transactions.
+
+
+# 1.16.2 2020-01-14
+
+- add support for megaparsec 8 (#1175)
+ 
+- close: mention --close-to/--open-from in docs
+ 
 # 1.16.1 2019-12-03
 
 - Drop unnecessary mtl-compat dependency
diff --git a/Hledger/Cli/Anon.hs b/Hledger/Cli/Anon.hs
--- a/Hledger/Cli/Anon.hs
+++ b/Hledger/Cli/Anon.hs
@@ -35,7 +35,7 @@
 instance Anon Posting where
     anon p = p { paccount = anonAccount . paccount $ p
                , pcomment = T.empty
-               , ptransaction = fmap anon . ptransaction $ p  -- Note that this will be overriden
+               , ptransaction = fmap anon . ptransaction $ p  -- Note that this will be overridden
                , poriginal = anon <$> poriginal p
                }
 
diff --git a/Hledger/Cli/CliOptions.hs b/Hledger/Cli/CliOptions.hs
--- a/Hledger/Cli/CliOptions.hs
+++ b/Hledger/Cli/CliOptions.hs
@@ -75,6 +75,7 @@
 import Data.Default
 import Data.Functor.Identity (Identity)
 import "base-compat-batteries" Data.List.Compat
+import Data.List.Extra (nubSort)
 import Data.List.Split (splitOneOf)
 import Data.Ord
 import Data.Maybe
@@ -121,7 +122,6 @@
 inputflags = [
   flagReq  ["file","f"]      (\s opts -> Right $ setopt "file" s opts) "FILE" "use a different input file. For stdin, use - (default: $LEDGER_FILE or $HOME/.hledger.journal)"
  ,flagReq  ["rules-file"]    (\s opts -> Right $ setopt "rules-file" s opts) "RFILE" "CSV conversion rules file (default: FILE.rules)"
- ,flagReq  ["separator"]     (\s opts -> Right $ setopt "separator" s opts) "SEP" "CSV separator (default: ,)"
  ,flagReq  ["alias"]         (\s opts -> Right $ setopt "alias" s opts)  "OLD=NEW" "rename accounts named OLD to NEW"
  ,flagNone ["anon"]          (setboolopt "anon") "anonymize accounts and payees"
  ,flagReq  ["pivot"]         (\s opts -> Right $ setopt "pivot" s opts)  "TAGNAME" "use some other field/tag for account names"
@@ -179,7 +179,7 @@
 
   -- generated postings/transactions
  ,flagNone ["auto"]          (setboolopt "auto") "apply automated posting rules to modify transactions"
- ,flagNone ["forecast"]      (setboolopt "forecast") "apply periodic transaction rules to generate future transactions, to 6 months from now or report end date"
+ ,flagNone ["forecast"]      (setboolopt "forecast") "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."
 
  ]
 
@@ -661,7 +661,7 @@
 likelyExecutablesInPath = do
   pathdirs <- splitOneOf "[:;]" `fmap` getEnvSafe "PATH"
   pathfiles <- concat `fmap` mapM getDirectoryContentsSafe pathdirs
-  return $ nub $ sort pathfiles
+  return $ nubSort pathfiles
   -- exclude directories and files without execute permission.
   -- These will do a stat for each hledger-*, probably ok.
   -- But they need paths, not just filenames
diff --git a/Hledger/Cli/Commands.hs b/Hledger/Cli/Commands.hs
--- a/Hledger/Cli/Commands.hs
+++ b/Hledger/Cli/Commands.hs
@@ -101,26 +101,26 @@
   ,(activitymode           , activity)
   ,(addmode                , add)
   ,(balancemode            , balance)
-  ,(balancesheetmode       , balancesheet)
   ,(balancesheetequitymode , balancesheetequity)
+  ,(balancesheetmode       , balancesheet)
   ,(cashflowmode           , cashflow)
   ,(checkdatesmode         , checkdates)
   ,(checkdupesmode         , checkdupes)
   ,(closemode              , close)
   ,(commoditiesmode        , commodities)
   ,(descriptionsmode        , descriptions)
+  ,(diffmode               , diff)
+  ,(filesmode              , files)
   ,(helpmode               , help')
   ,(importmode             , importcmd)
-  ,(filesmode              , files)
-  ,(diffmode               , diff)
   ,(incomestatementmode    , incomestatement)
   ,(notesmode              , notes)
   ,(payeesmode             , payees)
   ,(pricesmode             , prices)
   ,(printmode              , print')
   ,(printuniquemode        , printunique)
-  ,(registermode           , register)
   ,(registermatchmode      , registermatch)
+  ,(registermode           , register)
   ,(rewritemode            , rewrite)
   ,(roimode                , roi)
   ,(statsmode              , stats)
diff --git a/Hledger/Cli/Commands/Add.hs b/Hledger/Cli/Commands/Add.hs
--- a/Hledger/Cli/Commands/Add.hs
+++ b/Hledger/Cli/Commands/Add.hs
@@ -3,7 +3,7 @@
 |-}
 
 {-# OPTIONS_GHC -fno-warn-missing-signatures -fno-warn-unused-do-bind #-}
-{-# LANGUAGE ScopedTypeVariables, DeriveDataTypeable, RecordWildCards, TypeOperators, FlexibleContexts, OverloadedStrings, PackageImports #-}
+{-# LANGUAGE ScopedTypeVariables, DeriveDataTypeable, RecordWildCards, TypeOperators, FlexibleContexts, OverloadedStrings, PackageImports, LambdaCase #-}
 {-# LANGUAGE TemplateHaskell #-}
 
 module Hledger.Cli.Commands.Add (
@@ -30,8 +30,9 @@
 import Data.Text (Text)
 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)
+import Safe (headDef, headMay, atMay)
 import System.Console.CmdArgs.Explicit
 import System.Console.Haskeline (runInputT, defaultSettings, setComplete)
 import System.Console.Haskeline.Completion
@@ -104,7 +105,7 @@
     ,"Use tab key to complete, readline keys to edit, enter to accept defaults."
     ,"An optional (CODE) may follow transaction dates."
     ,"An optional ; COMMENT may follow descriptions or amounts."
-    ,"If you make a mistake, enter < at any prompt to restart the transaction."
+    ,"If you make a mistake, enter < at any prompt to go one step backward."
     ,"To end a transaction, enter . when prompted."
     ,"To quit, enter . at a date prompt or press control-d or control-c."
     ]
@@ -116,7 +117,8 @@
 -- most similar recent transaction in the journal.
 getAndAddTransactions :: EntryState -> IO ()
 getAndAddTransactions es@EntryState{..} = (do
-  mt <- runInputT (setComplete noCompletion defaultSettings) (System.Console.Wizard.run $ haskeline $ confirmedTransactionWizard es)
+  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
     Just t -> do
@@ -132,41 +134,124 @@
   `E.catch` (\(_::RestartTransactionException) ->
                  hPrintf stderr "Restarting this transaction.\n" >> getAndAddTransactions es)
 
--- confirmedTransactionWizard :: (ArbitraryIO :<: b, OutputLn :<: b, Line :<: b) => EntryState -> Wizard b Transaction
--- confirmedTransactionWizard :: EntryState -> Wizard Haskeline Transaction
-confirmedTransactionWizard es@EntryState{..} = do
-  t <- transactionWizard es
-  -- liftIO $ hPrintf stderr {- "Transaction entered:\n%s" -} (show t)
-  output $ showTransaction t
-  y <- let def = "y" in
-       retryMsg "Please enter y or n." $
-        parser ((fmap ('y' ==)) . headMay . map toLower . strip) $
-        defaultTo' def $ nonEmpty $
-        maybeRestartTransaction $
-        line $ green $ printf "Save this transaction to the journal ?%s: " (showDefault def)
-  if y then return t else throw RestartTransactionException
+data TxnParams = TxnParams
+  { txnDate :: Day
+  , txnCode :: Text
+  , txnDesc :: Text
+  , txnCmnt :: Text
+  } deriving (Show)
 
-transactionWizard es@EntryState{..} = do
-  (date,code)    <- dateAndCodeWizard es
-  let es1@EntryState{esArgs=args1} = es{esArgs=drop 1 esArgs, esDefDate=date}
-  (desc,comment) <- descriptionAndCommentWizard es1
-  let mbaset = similarTransaction es1 desc
-  when (isJust mbaset) $ liftIO $ hPrintf stderr "Using this similar transaction for defaults:\n%s" (showTransaction $ fromJust mbaset)
-  let es2 = es1{esArgs=drop 1 args1, esSimilarTransaction=mbaset}
-      balancedPostingsWizard = do
-        ps <- postingsWizard es2{esPostings=[]}
-        let t = nulltransaction{tdate=date
-                               ,tstatus=Unmarked
-                               ,tcode=code
-                               ,tdescription=desc
-                               ,tcomment=comment
-                               ,tpostings=ps
+data PrevInput = PrevInput
+  { prevDateAndCode   :: Maybe String
+  , prevDescAndCmnt   :: Maybe String
+  , prevAccount       :: [String]
+  , prevAmountAndCmnt :: [String]
+  } deriving (Show)
+
+data AddingStage = EnterDateAndCode
+                 | EnterDescAndComment (Day, Text)
+                 | EnterAccount TxnParams
+                 | EnterAmountAndComment TxnParams String
+                 | EndStage Transaction
+                 | EnterNewPosting TxnParams (Maybe Posting)
+
+confirmedTransactionWizard :: PrevInput -> EntryState -> [AddingStage] -> Wizard Haskeline Transaction
+confirmedTransactionWizard prevInput es [] = confirmedTransactionWizard prevInput es [EnterDateAndCode]
+confirmedTransactionWizard prevInput es@EntryState{..} stack@(currentStage : _) = case currentStage of
+  EnterDateAndCode -> dateAndCodeWizard prevInput es >>= \case
+    Just (date, code) -> do
+      let es' = es
+            { esArgs = drop 1 esArgs
+            , esDefDate = date
+            }
+          dateAndCodeString = formatTime defaultTimeLocale yyyymmddFormat date ++ (if T.null code then "" else " (" ++ T.unpack code ++ ")")
+          yyyymmddFormat = iso8601DateFormat Nothing
+      confirmedTransactionWizard prevInput{prevDateAndCode=Just dateAndCodeString} es' (EnterDescAndComment (date, code) : stack)
+    Nothing ->
+      confirmedTransactionWizard prevInput es stack
+
+  EnterDescAndComment (date, code) -> descriptionAndCommentWizard prevInput es >>= \case
+    Just (desc, comment) -> do
+      let mbaset = similarTransaction es desc
+          es' = es
+            { esArgs = drop 1 esArgs
+            , esPostings = []
+            , esSimilarTransaction = mbaset
+            }
+          descAndCommentString = T.unpack $ desc <> (if T.null comment then "" else "  ; " <> comment)
+          prevInput' = prevInput{prevDescAndCmnt=Just descAndCommentString}
+      when (isJust mbaset) $ liftIO $ hPrintf stderr "Using this similar transaction for defaults:\n%s" (showTransaction $ fromJust mbaset)
+      confirmedTransactionWizard prevInput' es' ((EnterNewPosting TxnParams{txnDate=date, txnCode=code, txnDesc=desc, txnCmnt=comment} Nothing) : stack)
+    Nothing ->
+      confirmedTransactionWizard prevInput es (drop 1 stack)
+
+  EnterNewPosting txnParams@TxnParams{..} posting -> case (esPostings, posting) of
+    ([], Nothing) ->
+      confirmedTransactionWizard prevInput es (EnterAccount txnParams : stack)
+    (_, Just _) ->
+      confirmedTransactionWizard prevInput es (EnterAccount txnParams : stack)
+    (_, Nothing) -> do
+      let t = nulltransaction{tdate=txnDate
+                             ,tstatus=Unmarked
+                             ,tcode=txnCode
+                             ,tdescription=txnDesc
+                             ,tcomment=txnCmnt
+                             ,tpostings=esPostings
+                             }
+      case balanceTransaction Nothing t of -- imprecise balancing (?)
+        Right t' ->
+          confirmedTransactionWizard prevInput es (EndStage t' : stack)
+        Left err -> do
+          liftIO (hPutStrLn stderr $ "\n" ++ (capitalize err) ++ "please re-enter.")
+          let notFirstEnterPost stage = case stage of
+                EnterNewPosting _ Nothing -> False
+                _ -> True
+          confirmedTransactionWizard prevInput es{esPostings=[]} (dropWhile notFirstEnterPost stack)
+
+  EnterAccount txnParams -> accountWizard prevInput es >>= \case
+    Just account
+      | account `elem` [".", ""] ->
+          case (esPostings, postingsBalanced esPostings) of
+            ([],_)    -> liftIO (hPutStrLn stderr "Please enter some postings first.") >> confirmedTransactionWizard prevInput es stack
+            (_,False) -> liftIO (hPutStrLn stderr "Please enter more postings to balance the transaction.") >> confirmedTransactionWizard prevInput es stack
+            (_,True)  -> confirmedTransactionWizard prevInput es (EnterNewPosting txnParams Nothing : stack)
+      | otherwise -> do
+          let prevAccount' = replaceNthOrAppend (length esPostings) account (prevAccount prevInput)
+          confirmedTransactionWizard prevInput{prevAccount=prevAccount'} es{esArgs=drop 1 esArgs} (EnterAmountAndComment txnParams account : stack)
+    Nothing -> do
+      let notPrevAmountAndNotEnterDesc stage = case stage of
+            EnterAmountAndComment _ _ -> False
+            EnterDescAndComment _ -> False
+            _ -> True
+      confirmedTransactionWizard prevInput es{esPostings=init esPostings} (dropWhile notPrevAmountAndNotEnterDesc stack)
+
+  EnterAmountAndComment txnParams account -> amountAndCommentWizard prevInput es >>= \case
+    Just (amount, comment) -> do
+      let posting = nullposting{paccount=T.pack $ stripbrackets account
+                               ,pamount=Mixed [amount]
+                               ,pcomment=comment
+                               ,ptype=accountNamePostingType $ T.pack account
                                }
-        case balanceTransaction Nothing t of -- imprecise balancing (?)
-          Right t' -> return t'
-          Left err -> liftIO (hPutStrLn stderr $ "\n" ++ (capitalize err) ++ "please re-enter.") >> balancedPostingsWizard
-  balancedPostingsWizard
+          amountAndCommentString = showAmount amount ++ (if T.null comment then "" else "  ;" ++ T.unpack comment)
+          prevAmountAndCmnt' = replaceNthOrAppend (length esPostings) amountAndCommentString (prevAmountAndCmnt prevInput)
+          es' = es{esPostings=esPostings++[posting], esArgs=drop 2 esArgs}
+      confirmedTransactionWizard prevInput{prevAmountAndCmnt=prevAmountAndCmnt'} es' (EnterNewPosting txnParams (Just posting) : stack)
+    Nothing -> confirmedTransactionWizard prevInput es (drop 1 stack)
 
+  EndStage t -> do
+    output $ showTransaction t
+    y <- let def = "y" in
+         retryMsg "Please enter y or n." $
+          parser ((fmap (\c -> if c == '<' then Nothing else Just c)) . headMay . map toLower . strip) $
+          defaultTo' def $ nonEmpty $
+          line $ green $ printf "Save this transaction to the journal ?%s: " (showDefault def)
+    case y of
+      Just 'y' -> return t
+      Just _   -> throw RestartTransactionException
+      Nothing  -> confirmedTransactionWizard prevInput es (drop 2 stack)
+  where
+    replaceNthOrAppend n newElem xs = take n xs ++ [newElem] ++ drop (n + 1) xs
+
 -- Identify the closest recent match for this description in past transactions.
 similarTransaction :: EntryState -> Text -> Maybe Transaction
 similarTransaction EntryState{..} desc =
@@ -176,18 +261,17 @@
                 | otherwise           = Just $ snd $ head historymatches
   in bestmatch
 
-dateAndCodeWizard EntryState{..} = do
+dateAndCodeWizard PrevInput{..} EntryState{..} = do
   let def = headDef (showDate esDefDate) esArgs
   retryMsg "A valid hledger smart date is required. Eg: 2014/2/14, 14, yesterday." $
    parser (parseSmartDateAndCode esToday) $
    withCompletion (dateCompleter def) $
    defaultTo' def $ nonEmpty $
    maybeExit $
-   maybeRestartTransaction $
    -- maybeShowHelp $
-   line $ green $ printf "Date%s: " (showDefault def)
+   linePrewritten (green $ printf "Date%s: " (showDefault def)) (fromMaybe "" prevDateAndCode) ""
     where
-      parseSmartDateAndCode refdate s = either (const Nothing) (\(d,c) -> return (fixSmartDate refdate d, c)) edc
+      parseSmartDateAndCode refdate s = if s == "<" then return Nothing else either (const Nothing) (\(d,c) -> return $ Just (fixSmartDate refdate d, c)) edc
           where
             edc = runParser (dateandcodep <* eof) "" $ T.pack $ lowercase s
             dateandcodep :: SimpleTextParser (SmartDate, Text)
@@ -200,40 +284,21 @@
       -- defday = fixSmartDate today $ fromparse $ (parse smartdate "" . lowercase) defdate
       -- datestr = showDate $ fixSmartDate defday smtdate
 
-descriptionAndCommentWizard EntryState{..} = do
+descriptionAndCommentWizard PrevInput{..} EntryState{..} = do
   let def = headDef "" esArgs
   s <- withCompletion (descriptionCompleter esJournal def) $
        defaultTo' def $ nonEmpty $
-       maybeRestartTransaction $
-       line $ green $ printf "Description%s: " (showDefault def)
-  let (desc,comment) = (T.pack $ strip a, T.pack $ strip $ dropWhile (==';') b) where (a,b) = break (==';') s
-  return (desc, comment)
-
-postingsWizard es@EntryState{..} = do
-  mp <- postingWizard es
-  case mp of Nothing -> return esPostings
-             Just p  -> postingsWizard es{esArgs=drop 2 esArgs, esPostings=esPostings++[p]}
-
-postingWizard es@EntryState{..} = do
-  acct <- accountWizard es
-  if acct `elem` [".",""]
-  then case (esPostings, postingsBalanced esPostings) of
-         ([],_)    -> liftIO (hPutStrLn stderr "Please enter some postings first.") >> postingWizard es
-         (_,False) -> liftIO (hPutStrLn stderr "Please enter more postings to balance the transaction.") >> postingWizard es
-         (_,True)  -> return Nothing -- no more postings, end of transaction
-  else do
-    let es1 = es{esArgs=drop 1 esArgs}
-    (amt,comment)  <- amountAndCommentWizard es1
-    return $ Just nullposting{paccount=T.pack $ stripbrackets acct
-                             ,pamount=Mixed [amt]
-                             ,pcomment=comment
-                             ,ptype=accountNamePostingType $ T.pack acct
-                             }
+       linePrewritten (green $ printf "Description%s: " (showDefault def)) (fromMaybe "" prevDescAndCmnt) ""
+  if s == "<"
+    then return Nothing
+    else do
+      let (desc,comment) = (T.pack $ strip a, T.pack $ strip $ dropWhile (==';') b) where (a,b) = break (==';') s
+      return $ Just (desc, comment)
 
 postingsBalanced :: [Posting] -> Bool
 postingsBalanced ps = isRight $ balanceTransaction Nothing nulltransaction{tpostings=ps}
 
-accountWizard EntryState{..} = do
+accountWizard PrevInput{..} EntryState{..} = do
   let pnum = length esPostings + 1
       historicalp = fmap ((!! (pnum - 1)) . (++ (repeat nullposting)) . tpostings) esSimilarTransaction
       historicalacct = case historicalp of Just p  -> showAccountName Nothing (ptype p) (paccount p)
@@ -246,15 +311,15 @@
    parser (parseAccountOrDotOrNull def canfinish) $
    withCompletion (accountCompleter esJournal def) $
    defaultTo' def $ -- nonEmpty $
-   maybeRestartTransaction $
-   line $ green $ printf "Account %d%s%s: " pnum (endmsg::String) (showDefault def)
+   linePrewritten (green $ printf "Account %d%s%s: " pnum (endmsg::String) (showDefault def)) (fromMaybe "" $ prevAccount `atMay` length esPostings) ""
     where
       canfinish = not (null esPostings) && postingsBalanced esPostings
-      parseAccountOrDotOrNull :: String -> Bool -> String -> Maybe String
-      parseAccountOrDotOrNull _  _ "."       = dbg1 $ Just "." -- . always signals end of txn
-      parseAccountOrDotOrNull "" True ""     = dbg1 $ Just ""  -- when there's no default and txn is balanced, "" also signals end of txn
-      parseAccountOrDotOrNull def@(_:_) _ "" = dbg1 $ Just def -- when there's a default, "" means use that
-      parseAccountOrDotOrNull _ _ s          = dbg1 $ fmap T.unpack $
+      parseAccountOrDotOrNull :: String -> Bool -> String -> Maybe (Maybe String)
+      parseAccountOrDotOrNull _  _ "<"       = dbg1 $ Just Nothing
+      parseAccountOrDotOrNull _  _ "."       = dbg1 $ Just $ Just "." -- . always signals end of txn
+      parseAccountOrDotOrNull "" True ""     = dbg1 $ Just $ Just ""  -- when there's no default and txn is balanced, "" also signals end of txn
+      parseAccountOrDotOrNull def@(_:_) _ "" = dbg1 $ Just $ Just def -- when there's a default, "" means use that
+      parseAccountOrDotOrNull _ _ s          = dbg1 $ fmap (Just . T.unpack) $
         either (const Nothing) validateAccount $
           flip evalState esJournal $ runParserT (accountnamep <* eof) "" (T.pack s) -- otherwise, try to parse the input as an accountname
         where
@@ -263,7 +328,7 @@
                             | otherwise = Just t
       dbg1 = id -- strace
 
-amountAndCommentWizard EntryState{..} = do
+amountAndCommentWizard PrevInput{..} EntryState{..} = do
   let pnum = length esPostings + 1
       (mhistoricalp,followedhistoricalsofar) =
           case esSimilarTransaction of
@@ -279,10 +344,9 @@
    parser parseAmountAndComment $
    withCompletion (amountCompleter def) $
    defaultTo' def $ nonEmpty $
-   maybeRestartTransaction $
-   line $ green $ printf "Amount  %d%s: " pnum (showDefault def)
+   linePrewritten (green $ printf "Amount  %d%s: " pnum (showDefault def)) (fromMaybe "" $ prevAmountAndCmnt `atMay` length esPostings) ""
     where
-      parseAmountAndComment s = either (const Nothing) Just $
+      parseAmountAndComment s = if s == "<" then return Nothing else either (const Nothing) (return . Just) $
                                 runParser
                                   (evalStateT (amountandcommentp <* eof) nodefcommodityj)
                                   ""
@@ -319,8 +383,6 @@
 
 maybeExit = parser (\s -> if s=="." then throw UnexpectedEOF else Just s)
 
-maybeRestartTransaction = parser (\s -> if s=="<" then throw RestartTransactionException else Just s)
-
 -- maybeShowHelp :: Wizard Haskeline String -> Wizard Haskeline String
 -- maybeShowHelp wizard = maybe (liftIO showHelp >> wizard) return $
 --                        parser (\s -> if s=="?" then Nothing else Just s) wizard
@@ -381,6 +443,11 @@
 -- | Append a string, typically one or more transactions, to a journal
 -- file, or if the file is "-", dump it to stdout.  Tries to avoid
 -- excess whitespace.
+--
+-- XXX This writes unix line endings (\n), some at least,
+-- even if the file uses dos line endings (\r\n), which could leave
+-- mixed line endings in the file. See also writeFileWithBackupIfChanged.
+--
 appendToJournalFileOrStdout :: FilePath -> String -> IO ()
 appendToJournalFileOrStdout f s
   | f == "-"  = putStr s'
diff --git a/Hledger/Cli/Commands/Add.txt b/Hledger/Cli/Commands/Add.txt
--- a/Hledger/Cli/Commands/Add.txt
+++ b/Hledger/Cli/Commands/Add.txt
@@ -29,8 +29,8 @@
     bare numbers entered.
 -   A parenthesised transaction code may be entered following a date.
 -   Comments and tags may be entered following a description or amount.
--   If you make a mistake, enter < at any prompt to restart the
-    transaction.
+-   If you make a mistake, enter < at any prompt to go one step
+    backward.
 -   Input prompts are displayed in a different colour when the terminal
     supports it.
 
@@ -42,7 +42,7 @@
 Use tab key to complete, readline keys to edit, enter to accept defaults.
 An optional (CODE) may follow transaction dates.
 An optional ; COMMENT may follow descriptions or amounts.
-If you make a mistake, enter < at any prompt to restart the transaction.
+If you make a mistake, enter < at any prompt to go one step backward.
 To end a transaction, enter . when prompted.
 To quit, enter . at a date prompt or press control-d or control-c.
 Date [2015/05/22]: 
diff --git a/Hledger/Cli/Commands/Balance.hs b/Hledger/Cli/Commands/Balance.hs
--- a/Hledger/Cli/Commands/Balance.hs
+++ b/Hledger/Cli/Commands/Balance.hs
@@ -253,6 +253,7 @@
  ,tests_Balance
 ) where
 
+import Data.Aeson (toJSON)
 import Data.List
 import Data.Maybe
 --import qualified Data.Map as Map
@@ -309,26 +310,28 @@
     Right _ -> do
       let budget      = boolopt "budget" rawopts
           multiperiod = interval_ /= NoInterval
-          format      = outputFormatFromOpts opts
+          fmt         = outputFormatFromOpts opts
 
       if budget then do  -- single or multi period budget report
         reportspan <- reportSpan j ropts
         let budgetreport     = dbg1 "budgetreport"     $ budgetReport ropts assrt reportspan d j
               where
                 assrt          = not $ ignore_assertions_ $ inputopts_ opts
-            render = case format of
-              "csv"  -> const $ error' "Sorry, CSV output is not yet implemented for this kind of report."  -- TODO
-              "html" -> const $ error' "Sorry, HTML output is not yet implemented for this kind of report."  -- TODO
-              _      -> budgetReportAsText ropts
+            render = case fmt of
+              "txt"  -> budgetReportAsText ropts
+              "json" -> (++"\n") . pshow . toJSON  -- XXX pshow for pretty output, but it may generate some junk
+              _      -> const $ error' $ unsupportedOutputFormatError fmt
         writeOutput opts $ render budgetreport
 
       else
         if multiperiod then do  -- multi period balance report
           let report = multiBalanceReport ropts (queryFromOpts d ropts) j
-              render = case format of
-                "csv"  -> (++ "\n") . printCSV . multiBalanceReportAsCsv ropts
-                "html" ->  (++ "\n") . TL.unpack . L.renderText . multiBalanceReportAsHtml ropts
-                _      -> multiBalanceReportAsText ropts
+              render = case fmt of
+                "txt"  -> multiBalanceReportAsText ropts
+                "csv"  -> (++"\n") . printCSV . multiBalanceReportAsCsv ropts
+                "html" -> (++"\n") . TL.unpack . L.renderText . multiBalanceReportAsHtml ropts
+                "json" -> (++"\n") . pshow . toJSON  -- XXX pshow for pretty output, but it may generate some junk
+                _      -> const $ error' $ unsupportedOutputFormatError fmt
           writeOutput opts $ render report
 
         else do  -- single period simple balance report
@@ -339,10 +342,11 @@
                     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
-              render = case format of
+              render = case fmt of
+                "txt"  -> balanceReportAsText
                 "csv"  -> \ropts r -> (++ "\n") $ printCSV $ balanceReportAsCsv ropts r
-                "html" -> \_ _ -> error' "Sorry, HTML output is not yet implemented for this kind of report."  -- TODO
-                _      -> balanceReportAsText
+                "json" -> const $ (++"\n") . pshow . toJSON  -- XXX pshow for pretty output, but it may generate some junk
+                _      -> const $ error' $ unsupportedOutputFormatError fmt
           writeOutput opts $ render ropts report
 
 -- rendering single-column balance reports
@@ -458,7 +462,8 @@
 -- The CSV will always include the initial headings row,
 -- and will include the final totals row unless --no-total is set.
 multiBalanceReportAsCsv :: ReportOpts -> MultiBalanceReport -> CSV
-multiBalanceReportAsCsv opts@ReportOpts{average_, row_total_} (MultiBalanceReport (colspans, items, (coltotals,tot,avg))) =
+multiBalanceReportAsCsv opts@ReportOpts{average_, row_total_}
+    (PeriodicReport colspans items (PeriodicReportRow _ _ coltotals tot avg)) =
   maybetranspose $
   ("Account" : map showDateSpan colspans
    ++ ["Total"   | row_total_]
@@ -469,7 +474,7 @@
    (amts
     ++ [rowtot | row_total_]
     ++ [rowavg | average_])
-  | (a, _, _, amts, rowtot, rowavg) <- items]
+  | PeriodicReportRow a _ amts rowtot rowavg <- items]
   ++
   if no_total_ opts
   then []
@@ -583,9 +588,10 @@
         PeriodChange       -> "Balance changes"
         CumulativeChange   -> "Ending balances (cumulative)"
         HistoricalBalance  -> "Ending balances (historical)")
-      (showDateSpan $ multiBalanceReportSpan r)
+      (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 (AtEnd _mc)    -> ", valued at period ends"
         Just (AtNow _mc)    -> ", current value"
         -- XXX duplicates the above
@@ -596,7 +602,8 @@
 
 -- | Build a 'Table' from a multi-column balance report.
 balanceReportAsTable :: ReportOpts -> MultiBalanceReport -> Table String String MixedAmount
-balanceReportAsTable opts@ReportOpts{average_, row_total_, balancetype_} (MultiBalanceReport (colspans, items, (coltotals,tot,avg))) =
+balanceReportAsTable opts@ReportOpts{average_, row_total_, balancetype_}
+    (PeriodicReport colspans items (PeriodicReportRow _ _ coltotals tot avg)) =
    maybetranspose $
    addtotalrow $
    Table
@@ -604,7 +611,7 @@
      (T.Group NoLine $ map Header colheadings)
      (map rowvals items)
   where
-    totalscolumn = row_total_ && not (balancetype_ `elem` [CumulativeChange, HistoricalBalance])
+    totalscolumn = row_total_ && balancetype_ `notElem` [CumulativeChange, HistoricalBalance]
     mkDate = case balancetype_ of
        PeriodChange -> showDateSpanMonthAbbrev
        _            -> maybe "" (showDate . prevday) . spanEnd
@@ -612,10 +619,10 @@
                   ++ ["  Total" | totalscolumn]
                   ++ ["Average" | average_]
     accts = map renderacct items
-    renderacct (a,a',i,_,_,_)
-      | tree_ opts = replicate ((i-1)*2) ' ' ++ T.unpack a'
+    renderacct (PeriodicReportRow a i _ _ _)
+      | tree_ opts = replicate ((i-1)*2) ' ' ++ T.unpack (accountLeafName a)
       | otherwise  = T.unpack $ maybeAccountNameDrop opts a
-    rowvals (_,_,_,as,rowtot,rowavg) = as
+    rowvals (PeriodicReportRow _ _ as rowtot rowavg) = as
                              ++ [rowtot | totalscolumn]
                              ++ [rowavg | average_]
     addtotalrow | no_total_ opts = id
diff --git a/Hledger/Cli/Commands/Balance.txt b/Hledger/Cli/Commands/Balance.txt
--- a/Hledger/Cli/Commands/Balance.txt
+++ b/Hledger/Cli/Commands/Balance.txt
@@ -289,16 +289,14 @@
 ------------++---------------------------------------------------
             ||     $-1      $1       0       0        0        0 
 
-# Average is rounded to the dollar here since all journal amounts are
-
-Limitations:
+(Average is rounded to the dollar here since all journal amounts are)
 
-In multicolumn reports the -V/--value flag uses the market price on the
-report end date, for all columns (not the price on each column's end
-date).
+A limitation of multicolumn balance reports: eliding of boring parent
+accounts in tree mode, as in the classic balance report, is not yet
+supported.
 
-Eliding of boring parent accounts in tree mode, as in the classic
-balance report, is not yet supported in multicolumn reports.
+The --transpose flag can be used to exchange the rows and columns of a
+multicolumn report.
 
 Budget report
 
@@ -432,7 +430,7 @@
     liabilities
 
 With this, monthly budget for electronics is defined to be $100 and
-budget for personal expenses is an additional $1000, which implicity
+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
@@ -501,5 +499,6 @@
 
 Output format
 
-The balance command supports output destination and output format
-selection.
+This command also supports the output destination and output format
+options The output formats supported are txt, csv, (multicolumn
+non-budget reports only) html, and (experimental) json.
diff --git a/Hledger/Cli/Commands/Balancesheet.txt b/Hledger/Cli/Commands/Balancesheet.txt
--- a/Hledger/Cli/Commands/Balancesheet.txt
+++ b/Hledger/Cli/Commands/Balancesheet.txt
@@ -39,5 +39,6 @@
 -T/--row-total, since summing end balances generally does not make
 sense). Instead of absolute values percentages can be displayed with -%.
 
-This command also supports output destination and output format
-selection.
+This command also supports the output destination and output format
+options The output formats supported are txt, csv, html, and
+(experimental) json.
diff --git a/Hledger/Cli/Commands/Balancesheetequity.txt b/Hledger/Cli/Commands/Balancesheetequity.txt
--- a/Hledger/Cli/Commands/Balancesheetequity.txt
+++ b/Hledger/Cli/Commands/Balancesheetequity.txt
@@ -29,3 +29,7 @@
 Total:
 --------------------
                    0
+
+This command also supports the output destination and output format
+options The output formats supported are txt, csv, html, and
+(experimental) json.
diff --git a/Hledger/Cli/Commands/Cashflow.txt b/Hledger/Cli/Commands/Cashflow.txt
--- a/Hledger/Cli/Commands/Cashflow.txt
+++ b/Hledger/Cli/Commands/Cashflow.txt
@@ -30,5 +30,6 @@
 with --change/--cumulative/--historical. Instead of absolute values
 percentages can be displayed with -%.
 
-This command also supports output destination and output format
-selection.
+This command also supports the output destination and output format
+options The output formats supported are txt, csv, html, and
+(experimental) json.
diff --git a/Hledger/Cli/Commands/Checkdupes.hs b/Hledger/Cli/Commands/Checkdupes.hs
--- a/Hledger/Cli/Commands/Checkdupes.hs
+++ b/Hledger/Cli/Commands/Checkdupes.hs
@@ -8,6 +8,7 @@
 
 import Data.Function
 import Data.List
+import Data.List.Extra (nubSort)
 import qualified Data.Text as T
 import Hledger
 import Hledger.Cli.CliOptions
@@ -28,7 +29,7 @@
 accountsNames j = map leafAndAccountName as
   where leafAndAccountName a = (T.unpack $ accountLeafName a, a)
         ps = journalPostings j
-        as = nub $ sort $ map paccount ps
+        as = nubSort $ map paccount ps
 
 checkdupes' :: (Ord k, Eq k) => [(k, v)] -> [(k, [v])]
 checkdupes' l = zip dupLeafs dupAccountNames
diff --git a/Hledger/Cli/Commands/Close.hs b/Hledger/Cli/Commands/Close.hs
--- a/Hledger/Cli/Commands/Close.hs
+++ b/Hledger/Cli/Commands/Close.hs
@@ -18,82 +18,139 @@
 import Hledger
 import Hledger.Cli.CliOptions
 
-defclosingacct = "equity:closing balances"
-defopeningacct = "equity:opening balances"
+defclosingdesc = "closing balances"
+defopeningdesc = "opening balances"
+defclosingacct = "equity:opening/closing balances"
+defopeningacct = defclosingacct
 
 closemode = hledgerCommandMode
   $(embedFileRelative "Hledger/Cli/Commands/Close.txt")
-  [flagNone ["closing"] (setboolopt "closing") "show just closing transaction"
-  ,flagNone ["opening"] (setboolopt "opening") "show just opening transaction"
-  ,flagReq  ["close-to"] (\s opts -> Right $ setopt "close-to" s opts) "ACCT" ("account to transfer closing balances to (default: "++defclosingacct++")")
-  ,flagReq  ["open-from"] (\s opts -> Right $ setopt "open-from" s opts) "ACCT" ("account to transfer opening balances from (default: "++defopeningacct++")")
+  [flagNone ["close"]        (setboolopt "close") "show just closing transaction"
+  ,flagNone ["open"]         (setboolopt "open") "show just opening transaction"
+  ,flagReq  ["close-desc"]   (\s opts -> Right $ setopt "close-desc" s opts) "DESC" ("description for closing transaction (default: "++defclosingdesc++")")
+  ,flagReq  ["open-desc"]    (\s opts -> Right $ setopt "open-desc"  s opts) "DESC" ("description for opening transaction (default: "++defopeningdesc++")")
+  ,flagReq  ["close-acct"]   (\s opts -> Right $ setopt "close-acct" s opts) "ACCT" ("account to transfer closing balances to (default: "++defclosingacct++")")
+  ,flagReq  ["open-acct"]    (\s opts -> Right $ setopt "open-acct"  s opts) "ACCT" ("account to transfer opening balances from (default: "++defopeningacct++")")
+  ,flagNone ["explicit","x"] (setboolopt "explicit") "show all amounts explicitly"
+  ,flagNone ["interleaved"]  (setboolopt "interleaved") "keep equity and non-equity postings adjacent"
+  ,flagNone ["show-costs"]   (setboolopt "show-costs") "keep balances with different costs separate"
   ]
   [generalflagsgroup1]
-  hiddenflags
+  (hiddenflags ++
+    -- old close flags for compatibility, hidden
+    [flagNone ["closing"] (setboolopt "close") "old spelling of --close"
+    ,flagNone ["opening"] (setboolopt "open") "old spelling of --open"
+    ,flagReq  ["close-to"]  (\s opts -> Right $ setopt "close-acct" s opts) "ACCT" ("old spelling of --close-acct")
+    ,flagReq  ["open-from"] (\s opts -> Right $ setopt "open-acct" s opts) "ACCT" ("old spelling of --open-acct")
+    ])
   ([], Just $ argsFlag "[QUERY]")
 
+-- debugger, beware: close is incredibly devious. simple rules combine to make a horrid maze.
+-- tests are in tests/close.test.
 close CliOpts{rawopts_=rawopts, reportopts_=ropts} j = do
   today <- getCurrentDay
   let
-      (opening, closing) =
-        case (boolopt "opening" rawopts, boolopt "closing" rawopts) of
-          (False, False) -> (True, True) -- by default show both opening and closing
-          (o, c) -> (o, c)
-      closingacct = T.pack $ fromMaybe defclosingacct $ maybestringopt "close-to" rawopts
-      openingacct = T.pack $ fromMaybe defopeningacct $ maybestringopt "open-from" rawopts
-      ropts_ = ropts{balancetype_=HistoricalBalance, accountlistmode_=ALFlat}
-      q = queryFromOpts today ropts_
-      openingdate = fromMaybe today $ queryEndDate False q
-      closingdate = addDays (-1) openingdate
-      (acctbals,_) = balanceReportFromMultiBalanceReport ropts_ q j
-      balancingamt = negate $ sum $ map (\(_,_,_,b) -> normaliseMixedAmount b) acctbals
+    -- show opening entry, closing entry, or (default) both ?
+    (opening, closing) =
+      case (boolopt "open" rawopts, boolopt "close" rawopts) of
+        (False, False) -> (True, True)
+        (o, c)         -> (o, c)
 
-      -- since balance assertion amounts are required to be exact, the
-      -- amounts in opening/closing transactions should be too (#941, #1137)
-      setprec = setFullPrecision
-      -- balance assertion amounts will be unpriced (#824)
-      -- only the last posting in each commodity will have a balance assertion (#1035)
-      closingps = [posting{paccount          = a
-                          ,pamount           = mixed [setprec $ negate b]
-                          ,pbalanceassertion = if islast then Just assertion{baamount=setprec b{aquantity=0, aprice=Nothing}} else Nothing
-                          }
-                  | (a,_,_,mb) <- acctbals
-                    -- the balances in each commodity, and for each transaction price
-                  , let bs = amounts $ normaliseMixedAmount mb
-                    -- mark the last balance in each commodity
-                  , let bs' = concat [reverse $ zip (reverse bs) (True : repeat False)
-                                     | bs <- groupBy ((==) `on` acommodity) bs]
-                  , (b, islast) <- bs'
-                  ]
-                  -- The balancing posting to equity. Allow this one to have a multicommodity amount,
-                  -- and don't try to assert its balance.
-                  ++
-                  [posting{paccount = closingacct
-                          ,pamount  = negate balancingamt
-                          }
-                  ]
+    -- descriptions to use for the closing/opening transactions
+    closingdesc = fromMaybe (T.pack defclosingdesc) $ T.pack <$> maybestringopt "close-desc" rawopts
+    openingdesc = fromMaybe (T.pack defopeningdesc) $ T.pack <$> maybestringopt "open-desc" rawopts
 
-      openingps = [posting{paccount          = a
-                          ,pamount           = mixed [setprec b]
-                          ,pbalanceassertion = case mcommoditysum of
-                                                 Just s  -> Just assertion{baamount=setprec s{aprice=Nothing}}
-                                                 Nothing -> Nothing
-                          }
-                  | (a,_,_,mb) <- acctbals
-                    -- the balances in each commodity, and for each transaction price
-                  , let bs = amounts $ normaliseMixedAmount mb
-                    -- mark the last balance in each commodity, with the unpriced sum in that commodity
-                  , let bs' = concat [reverse $ zip (reverse bs) (Just commoditysum : repeat Nothing)
-                                     | bs <- groupBy ((==) `on` acommodity) bs
-                                     , let commoditysum = (sum bs)]
-                  , (b, mcommoditysum) <- bs'
-                  ]
-                  ++
-                  [posting{paccount = openingacct
-                          ,pamount  = balancingamt
-                          }
-                  ]
+    -- accounts to close to and open from
+    -- if only one is specified, it is used for both
+    (closingacct, openingacct) =
+      let (mc, mo) =
+            (T.pack <$> maybestringopt "close-acct" rawopts, T.pack <$> maybestringopt "open-acct" rawopts)
+      in case (mc, mo) of
+        (Just c, Just o)   -> (c, o)
+        (Just c, Nothing)  -> (c, c)
+        (Nothing, Just o)  -> (o, o)
+        (Nothing, Nothing) -> (T.pack defclosingacct, T.pack defopeningacct)
 
-  when closing $ putStr $ showTransaction (nulltransaction{tdate=closingdate, tdescription="closing balances", tpostings=closingps})
-  when opening $ putStr $ showTransaction (nulltransaction{tdate=openingdate, tdescription="opening balances", tpostings=openingps})
+    -- dates of the closing and opening transactions
+    ropts_ = ropts{balancetype_=HistoricalBalance, accountlistmode_=ALFlat}
+    q = queryFromOpts today ropts_
+    openingdate = fromMaybe today $ queryEndDate False q
+    closingdate = addDays (-1) openingdate
+
+    -- should we show the amount(s) on the equity posting(s) ?
+    explicit = boolopt "explicit" rawopts
+
+    -- should we preserve cost information ?
+    normalise = case boolopt "show-costs" rawopts of
+                  True  -> normaliseMixedAmount
+                  False -> normaliseMixedAmount . mixedAmountStripPrices
+
+    -- the balances to close
+    (acctbals,_) = balanceReportFromMultiBalanceReport ropts_ q j
+    totalamt = sum $ map (\(_,_,_,b) -> normalise b) acctbals
+
+    -- since balance assertion amounts are required to be exact, the
+    -- amounts in opening/closing transactions should be too (#941, #1137)
+    precise = setFullPrecision
+
+    -- interleave equity postings next to the corresponding closing posting, or put them all at the end ?
+    interleaved = boolopt "interleaved" rawopts
+
+    -- the closing transaction
+    closingtxn = nulltransaction{tdate=closingdate, tdescription=closingdesc, tpostings=closingps}
+    closingps =
+      concat [
+        [posting{paccount          = a
+                ,pamount           = mixed [precise $ negate b]
+                -- after each commodity's last posting, assert 0 balance (#1035)
+                -- balance assertion amounts are unpriced (#824)
+                ,pbalanceassertion =
+                    if islast
+                    then Just nullassertion{baamount=precise b{aquantity=0, aprice=Nothing}}
+                    else Nothing
+                }
+        ]
+        -- maybe an interleaved posting transferring this balance to equity
+        ++ [posting{paccount=closingacct, pamount=Mixed [precise b]} | interleaved]
+
+        | -- get the balances for each commodity and transaction price
+          (a,_,_,mb) <- acctbals
+        , let bs = amounts $ normalise mb
+          -- mark the last balance in each commodity with True
+        , let bs' = concat [reverse $ zip (reverse bs) (True : repeat False)
+                           | bs <- groupBy ((==) `on` acommodity) bs]
+        , (b, islast) <- bs'
+        ]
+      
+      -- or a final multicommodity posting transferring all balances to equity
+      -- (print will show this as multiple single-commodity postings)
+      ++ [posting{paccount=closingacct, pamount=if explicit then mapMixedAmount precise totalamt else missingmixedamt} | not interleaved]
+
+    -- the opening transaction
+    openingtxn = nulltransaction{tdate=openingdate, tdescription=openingdesc, tpostings=openingps}
+    openingps =
+      concat [
+        [posting{paccount          = a
+                ,pamount           = mixed [precise b]
+                ,pbalanceassertion =
+                    case mcommoditysum of
+                      Just s  -> Just nullassertion{baamount=precise s{aprice=Nothing}}
+                      Nothing -> Nothing
+                }
+        ]
+        ++ [posting{paccount=openingacct, pamount=Mixed [precise $ negate b]} | interleaved]
+
+        | (a,_,_,mb) <- acctbals
+        , let bs = amounts $ normalise mb
+          -- mark the last balance in each commodity with the unpriced sum in that commodity (for a balance assertion)
+        , let bs' = concat [reverse $ zip (reverse bs) (Just commoditysum : repeat Nothing)
+                           | bs <- groupBy ((==) `on` acommodity) bs
+                           , let commoditysum = (sum bs)]
+        , (b, mcommoditysum) <- bs'
+        ]
+      ++ [posting{paccount=openingacct, pamount=if explicit then mapMixedAmount precise (negate totalamt) else missingmixedamt} | not interleaved]
+
+  -- print them
+  when closing $ putStr $ showTransaction closingtxn
+  when opening $ putStr $ showTransaction openingtxn
 
diff --git a/Hledger/Cli/Commands/Close.txt b/Hledger/Cli/Commands/Close.txt
--- a/Hledger/Cli/Commands/Close.txt
+++ b/Hledger/Cli/Commands/Close.txt
@@ -1,18 +1,37 @@
 close, equity
 Prints a "closing balances" transaction and an "opening balances"
 transaction that bring account balances to and from zero, respectively.
-Useful for bringing asset/liability balances forward into a new journal
-file, or for closing out revenues/expenses to retained earnings at the
-end of a period.
+These can be added to your journal file(s), eg to bring asset/liability
+balances forward into a new journal file, or to close out
+revenues/expenses to retained earnings at the end of a period.
 
 _FLAGS
 
-The closing transaction transfers balances to "equity:closing balances",
-and the opening transaction transfers balances from "equity:opening
-balances", or you can customise these with the --close-to and
---open-from options. You can choose to print just one of the
-transactions by using the --opening or --closing flag.
+You can print just one of these transactions by using the --close or
+--open flag. You can customise their descriptions with the --close-desc
+and --open-desc options.
 
+One amountless posting to "equity:opening/closing balances" is added to
+balance the transactions, by default. You can customise this account
+name with --close-acct and --open-acct; if you specify only one of
+these, it will be used for both.
+
+With --x/--explicit, the equity posting's amount will be shown. And if
+it involves multiple commodities, a posting for each commodity will be
+shown, as with the print command.
+
+With --interleaved, the equity postings are shown next to the postings
+they balance, which makes troubleshooting easier.
+
+By default, transaction prices in the journal are ignored when
+generating the closing/opening transactions. With --show-costs, this
+cost information is preserved (balance -B reports will be unchanged
+after the transition). Separate postings are generated for each cost in
+each commodity. Note this can generate very large journal entries, if
+you have many foreign currency or investment transactions.
+
+close usage
+
 If you split your journal files by time (eg yearly), you will typically
 run this command at the end of the year, and save the closing
 transaction as last entry of the old file, and the opening transaction
@@ -42,20 +61,14 @@
 command with --auto, the balance assertions will probably always require
 --auto.
 
-When account balances have cost information (transaction prices), the
-closing/opening transactions will preserve it, so that eg balance -B
-reports will not be affected.
-
 Examples:
 
-Carrying asset/liability balances into a new file for 2019, all from
-command line:
-
-Warning: we use >> here to append; be careful not to type a single >
-which would wipe your journal!
+Carrying asset/liability balances into a new file for 2019:
 
-$ hledger close -f 2018.journal -e 2019 assets liabilities --opening >>2019.journal
-$ hledger close -f 2018.journal -e 2019 assets liabilities --closing >>2018.journal
+$ hledger close -f 2018.journal -e 2019 assets liabilities --open
+    # (copy/paste the output to the start of your 2019 journal file)
+$ hledger close -f 2018.journal -e 2019 assets liabilities --close
+    # (copy/paste the output to the end of your 2018 journal file)
 
 Now:
 
diff --git a/Hledger/Cli/Commands/Commodities.hs b/Hledger/Cli/Commands/Commodities.hs
--- a/Hledger/Cli/Commands/Commodities.hs
+++ b/Hledger/Cli/Commands/Commodities.hs
@@ -13,7 +13,7 @@
 ) where
 
 import Control.Monad
-import Data.List
+import Data.List.Extra (nubSort)
 import qualified Data.Map as M
 import qualified Data.Text.IO as T
 
@@ -32,5 +32,5 @@
 commodities :: CliOpts -> Journal -> IO ()
 commodities _copts j = do
   let cs = filter (/= "AUTO") $
-           nub $ sort $ M.keys (jcommodities j) ++ M.keys (jinferredcommodities j)
+           nubSort $ M.keys (jcommodities j) ++ M.keys (jinferredcommodities j)
   forM_ cs T.putStrLn
diff --git a/Hledger/Cli/Commands/Descriptions.hs b/Hledger/Cli/Commands/Descriptions.hs
--- a/Hledger/Cli/Commands/Descriptions.hs
+++ b/Hledger/Cli/Commands/Descriptions.hs
@@ -14,7 +14,7 @@
  ,descriptions
 ) where
 
-import Data.List
+import Data.List.Extra (nubSort)
 import qualified Data.Text.IO as T
 
 import Hledger
@@ -35,6 +35,6 @@
   d <- getCurrentDay
   let q  = queryFromOpts d ropts
       ts = entriesReport ropts q j
-      descriptions = nub $ sort $ map tdescription ts
+      descriptions = nubSort $ map tdescription ts
 
   mapM_ T.putStrLn descriptions
diff --git a/Hledger/Cli/Commands/Import.hs b/Hledger/Cli/Commands/Import.hs
--- a/Hledger/Cli/Commands/Import.hs
+++ b/Hledger/Cli/Commands/Import.hs
@@ -54,5 +54,8 @@
             newts | catchup -> do
               printf "marked %s as caught up, skipping %d unimported transactions\n\n" inputstr (length newts)
             newts -> do
+              -- XXX This writes unix line endings (\n), some at least,
+              -- even if the file uses dos line endings (\r\n), which could leave
+              -- mixed line endings in the file. See also writeFileWithBackupIfChanged.
               foldM_ (`journalAddTransaction` opts) j newts  -- gets forced somehow.. (how ?)
               printf "imported %d new transactions from %s\n" (length newts) inputstr
diff --git a/Hledger/Cli/Commands/Incomestatement.txt b/Hledger/Cli/Commands/Incomestatement.txt
--- a/Hledger/Cli/Commands/Incomestatement.txt
+++ b/Hledger/Cli/Commands/Incomestatement.txt
@@ -39,5 +39,6 @@
 report mode with --change/--cumulative/--historical. Instead of absolute
 values percentages can be displayed with -%.
 
-This command also supports output destination and output format
-selection.
+This command also supports the output destination and output format
+options The output formats supported are txt, csv, html, and
+(experimental) json.
diff --git a/Hledger/Cli/Commands/Notes.hs b/Hledger/Cli/Commands/Notes.hs
--- a/Hledger/Cli/Commands/Notes.hs
+++ b/Hledger/Cli/Commands/Notes.hs
@@ -15,7 +15,7 @@
  ,notes
 ) where
 
-import Data.List
+import Data.List.Extra (nubSort)
 import qualified Data.Text.IO as T
 
 import Hledger
@@ -36,6 +36,6 @@
   d <- getCurrentDay
   let q  = queryFromOpts d ropts
       ts = entriesReport ropts q j
-      notes = nub $ sort $ map transactionNote ts
+      notes = nubSort $ map transactionNote ts
 
   mapM_ T.putStrLn notes
diff --git a/Hledger/Cli/Commands/Payees.hs b/Hledger/Cli/Commands/Payees.hs
--- a/Hledger/Cli/Commands/Payees.hs
+++ b/Hledger/Cli/Commands/Payees.hs
@@ -15,7 +15,7 @@
  ,payees
 ) where
 
-import Data.List
+import Data.List.Extra (nubSort)
 import qualified Data.Text.IO as T
 
 import Hledger
@@ -36,6 +36,6 @@
   d <- getCurrentDay
   let q  = queryFromOpts d ropts
       ts = entriesReport ropts q j
-      payees = nub $ sort $ map transactionPayee ts
+      payees = nubSort $ map transactionPayee ts
 
   mapM_ T.putStrLn payees
diff --git a/Hledger/Cli/Commands/Print.hs b/Hledger/Cli/Commands/Print.hs
--- a/Hledger/Cli/Commands/Print.hs
+++ b/Hledger/Cli/Commands/Print.hs
@@ -15,6 +15,8 @@
 )
 where
 
+import Data.Aeson (toJSON)
+import Data.Maybe (isJust)
 import Data.Text (Text)
 import qualified Data.Text as T
 import System.Console.CmdArgs.Explicit
@@ -52,21 +54,26 @@
   d <- getCurrentDay
   let q = queryFromOpts d ropts
       fmt = outputFormatFromOpts opts
-      (render, ropts') = case fmt of
-        "csv"  -> ((++"\n") . printCSV . entriesReportAsCsv, ropts{accountlistmode_=ALFlat})
-        "html" -> (const $ error' "Sorry, HTML output is not yet implemented for this kind of report.", ropts{accountlistmode_=ALFlat})  -- TODO
-        _      -> (entriesReportAsText opts,                 ropts)
-  writeOutput opts $ render $ entriesReport ropts' q j
+      render = case fmt of
+        "txt"  -> entriesReportAsText opts
+        "csv"  -> (++"\n") . printCSV . entriesReportAsCsv
+        "json" -> (++"\n") . pshow . toJSON  -- XXX pshow for pretty output, but it may generate some junk
+        _      -> const $ error' $ unsupportedOutputFormatError fmt
+  writeOutput opts $ render $ entriesReport ropts q j
 
 entriesReportAsText :: CliOpts -> EntriesReport -> String
-entriesReportAsText opts = concatMap (showTransaction . gettxn)
+entriesReportAsText opts = concatMap (showTransaction . whichtxn)
   where
-    gettxn | useexplicittxn = id                   -- use fully inferred amounts & txn prices
-           | otherwise      = originalTransaction  -- use original as-written amounts/txn prices
-    -- Original vs inferred transactions/postings were causing problems here, disabling -B (#551).
-    -- Use the explicit one if -B or -x are active.
-    -- This passes tests; does it also mean -B sometimes shows missing amounts unnecessarily ?
-    useexplicittxn = boolopt "explicit" (rawopts_ opts) || (valuationTypeIsCost $ reportopts_ opts)
+    whichtxn
+      -- With -x, use the fully-inferred txn with all amounts & txn prices explicit.
+      | boolopt "explicit" (rawopts_ opts)
+        -- Or also, if any of -B/-V/-X/--value are active.
+        -- Because of #551, and because of print -V valuing only one
+        -- posting when there's an implicit txn price.
+        -- So -B/-V/-X/--value implies -x. Is this ok ?
+        || (isJust $ value_ $ reportopts_ opts) = id
+      -- By default, use the original as-written-in-the-journal txn.
+      | otherwise = originalTransaction
 
 -- Replace this transaction's postings with the original postings if any, but keep the
 -- current possibly rewritten account names.
diff --git a/Hledger/Cli/Commands/Print.txt b/Hledger/Cli/Commands/Print.txt
--- a/Hledger/Cli/Commands/Print.txt
+++ b/Hledger/Cli/Commands/Print.txt
@@ -34,14 +34,19 @@
     assets:bank:checking           $-1
 
 Normally, the journal entry's explicit or implicit amount style is
-preserved. Ie when an amount is omitted in the journal, it will be
-omitted in the output. You can use the -x/--explicit flag to make all
-amounts explicit, which can be useful for troubleshooting or for making
-your journal more readable and robust against data entry errors. Note,
--x will cause postings with a multi-commodity amount (these can arise
-when a multi-commodity transaction has an implicit amount) will be split
-into multiple single-commodity postings, for valid journal output.
+preserved. For example, when an amount is omitted in the journal, it
+will not appear in the output. Similarly, when a transaction price is
+implied but not written, it will not appear in the output. You can use
+the -x/--explicit flag to make all amounts and transaction prices
+explicit, 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 the
+output parseable.
+
 With -B/--cost, amounts with transaction prices are converted to cost
 using that price. This can be used for troubleshooting.
 
@@ -59,14 +64,17 @@
 files. Eg:
 
 $ hledger -f bank1.csv print --new
-# shows transactions added since last print --new on this file
+(shows transactions added since last print --new on this file)
 
 This assumes that transactions added to FILE always have same or
 increasing dates, and that transactions on the same day do not get
 reordered. See also the import command.
 
-This command also supports output destination and output format
-selection. Here's an example of print's CSV output:
+This command also supports the output destination and output format
+options The output formats supported are txt, csv, and (experimental)
+json.
+
+Here's an example of print's CSV output:
 
 $ hledger print -Ocsv
 "txnidx","date","date2","status","code","description","comment","account","amount","commodity","credit","debit","posting-status","posting-comment"
diff --git a/Hledger/Cli/Commands/Printunique.hs b/Hledger/Cli/Commands/Printunique.hs
--- a/Hledger/Cli/Commands/Printunique.hs
+++ b/Hledger/Cli/Commands/Printunique.hs
@@ -6,7 +6,7 @@
 )
 where
 
-import Data.List
+import Data.List.Extra (nubSortOn)
 import Hledger
 import Hledger.Cli.CliOptions
 import Hledger.Cli.Commands.Print
@@ -21,6 +21,6 @@
 printunique opts j@Journal{jtxns=ts} = do
   print' opts j{jtxns=uniquify ts}
   where
-    uniquify = nubBy (\t1 t2 -> thingToCompare t1 == thingToCompare t2) . sortOn thingToCompare
+    uniquify = nubSortOn thingToCompare
     thingToCompare = tdescription
     -- thingToCompare = tdate
diff --git a/Hledger/Cli/Commands/Register.hs b/Hledger/Cli/Commands/Register.hs
--- a/Hledger/Cli/Commands/Register.hs
+++ b/Hledger/Cli/Commands/Register.hs
@@ -18,12 +18,13 @@
  ,tests_Register
 ) where
 
+import Data.Aeson (toJSON)
 import Data.List
 import Data.Maybe
 -- import Data.Text (Text)
 import qualified Data.Text as T
 import System.Console.CmdArgs.Explicit
-import Hledger.Read.CsvReader (CSV, Record, printCSV)
+import Hledger.Read.CsvReader (CSV, CsvRecord, printCSV)
 
 import Hledger
 import Hledger.Cli.CliOptions
@@ -55,12 +56,13 @@
 
 -- | Print a (posting) register report.
 register :: CliOpts -> Journal -> IO ()
-register opts@CliOpts{reportopts_=ropts@ReportOpts{..}} j = do
+register opts@CliOpts{reportopts_=ropts} j = do
   d <- getCurrentDay
   let fmt = outputFormatFromOpts opts
-      render | fmt=="csv"  = const ((++"\n") . printCSV . postingsReportAsCsv)
-             | fmt=="html" = const $ error' "Sorry, HTML output is not yet implemented for this kind of report."  -- TODO
-             | otherwise   = postingsReportAsText
+      render | fmt=="txt"  = postingsReportAsText
+             | fmt=="csv"  = const ((++"\n") . printCSV . postingsReportAsCsv)
+             | fmt=="json" = const ((++"\n") . pshow . toJSON)  -- XXX pshow for pretty output, but it may generate some junk
+             | otherwise   = const $ error' $ unsupportedOutputFormatError fmt
   writeOutput opts $ render opts $ postingsReport ropts (queryFromOpts d ropts) j
 
 postingsReportAsCsv :: PostingsReport -> CSV
@@ -69,7 +71,7 @@
   :
   map postingsReportItemAsCsvRecord is
 
-postingsReportItemAsCsvRecord :: PostingsReportItem -> Record
+postingsReportItemAsCsvRecord :: PostingsReportItem -> CsvRecord
 postingsReportItemAsCsvRecord (_, _, _, p, b) = [idx,date,code,desc,acct,amt,bal]
   where
     idx  = show $ maybe 0 tindex $ ptransaction p
@@ -200,7 +202,7 @@
       (postingsReportAsText defcliopts $ postingsReport opts (queryFromOpts (parsedate "2008/11/26") opts) j)
         @?=
         unlines
-        ["2009/01/01 медвежья шкура       расходы:покупки                100           100"
+        ["2009-01-01 медвежья шкура       расходы:покупки                100           100"
         ,"                                актив:наличные                -100             0"]
    ]
 
diff --git a/Hledger/Cli/Commands/Register.txt b/Hledger/Cli/Commands/Register.txt
--- a/Hledger/Cli/Commands/Register.txt
+++ b/Hledger/Cli/Commands/Register.txt
@@ -103,5 +103,6 @@
 $ hledger reg -w 100,40           # set overall width 100, description width 40
 $ hledger reg -w $COLUMNS,40      # use terminal width, & description width 40
 
-This command also supports output destination and output format
-selection.
+This command also supports the output destination and output format
+options The output formats supported are txt, csv, and (experimental)
+json.
diff --git a/Hledger/Cli/Commands/Stats.hs b/Hledger/Cli/Commands/Stats.hs
--- a/Hledger/Cli/Commands/Stats.hs
+++ b/Hledger/Cli/Commands/Stats.hs
@@ -14,6 +14,7 @@
 where
 
 import Data.List
+import Data.List.Extra (nubSort)
 import Data.Maybe
 import Data.Ord
 import Data.HashSet (size, fromList)
@@ -108,4 +109,4 @@
              acctdepth | null as = 0
                        | otherwise = maximum $ map accountNameLevel as
              mktprices = jpricedirectives j
-             mktpricecommodities = nub $ sort $ map pdcommodity mktprices
+             mktpricecommodities = nubSort $ map pdcommodity mktprices
diff --git a/Hledger/Cli/CompoundBalanceCommand.hs b/Hledger/Cli/CompoundBalanceCommand.hs
--- a/Hledger/Cli/CompoundBalanceCommand.hs
+++ b/Hledger/Cli/CompoundBalanceCommand.hs
@@ -13,12 +13,12 @@
  ,compoundBalanceCommand
 ) where
 
+import Data.Aeson (toJSON)
 import Data.List (foldl')
 import Data.Maybe
 import qualified Data.Text as TS
 import qualified Data.Text.Lazy as TL
 import Data.Time.Calendar
-import Data.Time.Format
 import System.Console.CmdArgs.Explicit as C
 import Hledger.Read.CsvReader (CSV, printCSV)
 import Lucid as L hiding (value_)
@@ -27,7 +27,7 @@
 import Hledger
 import Hledger.Cli.Commands.Balance
 import Hledger.Cli.CliOptions
-import Hledger.Cli.Utils (writeOutput)
+import Hledger.Cli.Utils (unsupportedOutputFormatError, writeOutput)
 
 -- | Description of a compound balance report command,
 -- from which we generate the command's cmdargs mode and IO action.
@@ -143,7 +143,7 @@
         no_total_=if percent_ && length cbcqueries > 1 then True else no_total_
       }
       userq = queryFromOpts d ropts'
-      format = outputFormatFromOpts opts
+      fmt = outputFormatFromOpts opts
 
       -- make a CompoundBalanceReport.
       -- For efficiency, generate a price oracle here and reuse it with each subreport.
@@ -151,15 +151,15 @@
       subreports =
         map (\CBCSubreportSpec{..} ->
                 (cbcsubreporttitle
-                ,mbrNormaliseSign cbcsubreportnormalsign $ -- <- convert normal-negative to normal-positive
+                ,prNormaliseSign cbcsubreportnormalsign $ -- <- convert normal-negative to normal-positive
                   compoundBalanceSubreport ropts' userq j priceoracle cbcsubreportquery cbcsubreportnormalsign
                 ,cbcsubreportincreasestotal
                 ))
             cbcqueries
 
       subtotalrows =
-        [(coltotals, increasesoveralltotal)
-        | (_, MultiBalanceReport (_,_,(coltotals,_,_)), increasesoveralltotal) <- subreports
+        [(prrAmounts $ prTotals report, increasesoveralltotal)
+        | (_, report, increasesoveralltotal) <- subreports
         ]
 
       -- Sum the subreport totals by column. Handle these cases:
@@ -186,7 +186,7 @@
 
       colspans =
         case subreports of
-          (_, MultiBalanceReport (ds,_,_), _):_ -> ds
+          (_, PeriodicReport ds _ _, _):_ -> ds
           [] -> []
 
       title =
@@ -218,6 +218,7 @@
 
           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 (AtDefault _mc) | multiperiod   -> ", valued at period ends"
@@ -235,10 +236,12 @@
 
     -- render appropriately
     writeOutput opts $
-      case format of
+      case fmt of
+        "txt"  -> compoundBalanceReportAsText ropts' cbr
         "csv"  -> printCSV (compoundBalanceReportAsCsv ropts cbr) ++ "\n"
-        "html" -> (++ "\n") $ TL.unpack $ L.renderText $ compoundBalanceReportAsHtml ropts cbr
-        _      -> compoundBalanceReportAsText ropts' cbr
+        "html" -> (++"\n") $ TL.unpack $ L.renderText $ compoundBalanceReportAsHtml ropts cbr
+        "json" -> (++"\n") $ pshow $ toJSON cbr  -- XXX pshow for pretty output, but it may generate some junk
+        _      -> error' $ unsupportedOutputFormatError fmt
 
 -- | Summarise one or more (inclusive) end dates, in a way that's
 -- visually different from showDateSpan, suggesting discrete end dates
@@ -250,7 +253,7 @@
   [e]     -> showdate e
   []      -> ""
   where
-    showdate = formatTime defaultTimeLocale "%0C%y/%m/%d" 
+    showdate = show
 
 -- | Run one subreport for a compound balance command in multi-column mode.
 -- This returns a MultiBalanceReport.
@@ -261,20 +264,20 @@
     ropts' = ropts { empty_=True, normalbalance_=Just subreportnormalsign }
     -- run the report
     q = And [subreportqfn j, userq]
-    r@(MultiBalanceReport (dates, rows, totals)) = multiBalanceReportWith ropts' q j priceoracle
+    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 = MultiBalanceReport (dates, rows', totals)
+       | otherwise = PeriodicReport dates rows' totals
           where
             nonzeroaccounts =
               dbg1 "nonzeroaccounts" $
-              catMaybes $ map (\(act,_,_,amts,_,_) ->
+              mapMaybe (\(PeriodicReportRow act _ amts _ _) ->
                             if not (all isZeroMixedAmount amts) then Just act else Nothing) rows
             rows' = filter (not . emptyRow) rows
               where
-                emptyRow (act,_,_,amts,_,_) =
-                  all isZeroMixedAmount amts && all (not . (act `isAccountNamePrefixOf`)) nonzeroaccounts
+                emptyRow (PeriodicReportRow act _ amts _ _) =
+                  all isZeroMixedAmount amts && not (any (act `isAccountNamePrefixOf`) nonzeroaccounts)
 
 -- | Render a compound balance report as plain text suitable for console output.
 {- Eg:
@@ -363,12 +366,11 @@
         numcols
           | null subreports = 1
           | otherwise =
-            (3 +) $ -- account name & indent columns
+            (1 +) $ -- account name column
             (if row_total_ ropts then (1+) else id) $
             (if average_ ropts then (1+) else id) $
             maximum $ -- depends on non-null subreports
-            map (\(MultiBalanceReport (amtcolheadings, _, _)) -> length amtcolheadings) $
-            map second3 subreports
+            map (length . prDates . second3) subreports
     addtotals
       | no_total_ ropts || length subreports == 1 = id
       | otherwise = (++
diff --git a/Hledger/Cli/Utils.hs b/Hledger/Cli/Utils.hs
--- a/Hledger/Cli/Utils.hs
+++ b/Hledger/Cli/Utils.hs
@@ -10,6 +10,7 @@
 
 module Hledger.Cli.Utils
     (
+     unsupportedOutputFormatError,
      withJournalDo,
      writeOutput,
      journalTransform,
@@ -57,6 +58,10 @@
 import Hledger.Reports
 import Hledger.Utils
 
+-- | Standard error message for a bad output format specified with -O/-o.
+unsupportedOutputFormatError :: String -> String
+unsupportedOutputFormatError fmt = "Sorry, output format \""++fmt++"\" is unrecognised or not yet implemented for this report."
+
 -- | Parse the user's specified journal file(s) as a Journal, maybe apply some
 -- transformations according to options, and run a hledger command with it.
 -- Or, throw an error.
@@ -230,6 +235,14 @@
 -- overwrite it with this new text, or give an error, but only if the text
 -- is different from the current file contents, and return a flag
 -- indicating whether we did anything.
+--
+-- The given text should have unix line endings (\n); the existing
+-- file content will be normalised to unix line endings before
+-- comparing the two. If the file is overwritten, the new file will
+-- have the current system's native line endings (\n on unix, \r\n on
+-- windows). This could be different from the file's previous line
+-- endings, if working with a DOS file on unix or vice-versa.
+--
 writeFileWithBackupIfChanged :: FilePath -> T.Text -> IO Bool
 writeFileWithBackupIfChanged f t = do
   s <- readFilePortably f
diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -99,7 +99,7 @@
 
 [![license](https://img.shields.io/badge/license-GPLv3+-brightgreen.svg)](http://www.gnu.org/licenses/gpl.html)
 
-[![OpenCollective](https://opencollective.com/hledger/backers/badge.svg)](#backers) 
+[![OpenCollective](https://opencollective.com/hledger/backers/badge.svg)](#backers)
 [![OpenCollective](https://opencollective.com/hledger/sponsors/badge.svg)](#sponsors)
 [![bountysource](https://api.bountysource.com/badge/team?team_id=75979&style=bounties_received)](https://github.com/simonmichael/hledger/issues?q=label:bounty)
 [![github issues](https://img.shields.io/github/issues/simonmichael/hledger.svg)](http://bugs.hledger.org)
@@ -115,10 +115,9 @@
 --> <!-- [![gratipay](https://img.shields.io/gratipay/hledger.svg)]()
 -->
 
-[![travis build status](https://img.shields.io/travis/simonmichael/hledger.svg)](https://travis.hledger.org)
-[![appveyor windows build status](https://ci.appveyor.com/api/projects/status/5vejw0w5n5igdr42?svg=true)](https://appveyor.hledger.org)
+[![Build Status](https://travis-ci.org/simonmichael/hledger.svg?branch=master)](https://travis-ci.org/simonmichael/hledger/builds)
+[![Build Status](https://ci.appveyor.com/api/projects/status/5vejw0w5n5igdr42?svg=true)](https://ci.appveyor.com/project/simonmichael/hledger/history)
 [![](https://img.shields.io/hackage-deps/v/hledger-lib.svg?label=hledger-lib+bounds)](http://packdeps.haskellers.com/feed?needle=hledger-lib)
 [![](https://img.shields.io/hackage-deps/v/hledger.svg?label=hledger+bounds)](http://packdeps.haskellers.com/feed?needle=hledger)
 [![](https://img.shields.io/hackage-deps/v/hledger-ui.svg?label=hledger-ui+bounds)](http://packdeps.haskellers.com/feed?needle=hledger-ui)
 [![](https://img.shields.io/hackage-deps/v/hledger-web.svg?label=hledger-web+bounds)](http://packdeps.haskellers.com/feed?needle=hledger-web)
-
diff --git a/embeddedfiles/hledger-ui.1 b/embeddedfiles/hledger-ui.1
--- a/embeddedfiles/hledger-ui.1
+++ b/embeddedfiles/hledger-ui.1
@@ -1,5 +1,5 @@
 
-.TH "hledger-ui" "1" "January 2020" "hledger-ui 1.16.2" "hledger User Manuals"
+.TH "hledger-ui" "1" "March 2020" "hledger-ui 1.17" "hledger User Manuals"
 
 
 
@@ -15,9 +15,9 @@
 \f[C]hledger ui -- [OPTIONS] [QUERYARGS]\f[R]
 .SH DESCRIPTION
 .PP
-hledger is a cross-platform program for tracking money, time, or any
-other commodity, using double-entry accounting and a simple, editable
-file format.
+hledger is a reliable, cross-platform set of programs for tracking
+money, time, or any other commodity, using double-entry accounting and a
+simple, editable file format.
 hledger is inspired by and largely compatible with ledger(1).
 .PP
 hledger-ui is hledger\[aq]s terminal interface, providing an efficient
@@ -26,19 +26,17 @@
 It is easier than hledger\[aq]s command-line interface, and sometimes
 quicker and more convenient than the web interface.
 .PP
-Note hledger-ui has some different defaults (experimental):
-.IP \[bu] 2
-it generates rule-based transactions and postings by default (--forecast
-and --auto are always on).
-.IP \[bu] 2
-it hides transactions dated in the future by default (change this with
---future or the F key).
-.PP
 Like hledger, it reads data from one or more files in hledger journal,
 timeclock, timedot, or CSV format specified with \f[C]-f\f[R], or
 \f[C]$LEDGER_FILE\f[R], or \f[C]$HOME/.hledger.journal\f[R] (on windows,
 perhaps \f[C]C:/Users/USER/.hledger.journal\f[R]).
 For more about this see hledger(1), hledger_journal(5) etc.
+.PP
+Unlike hledger, hledger-ui hides all future-dated transactions by
+default.
+They can be revealed, along with any rule-generated periodic
+transactions, by pressing the F key (or starting with --forecast) to
+enable \[dq]forecast mode\[dq].
 .SH OPTIONS
 .PP
 Note: if invoking hledger-ui as a hledger subcommand, write \f[C]--\f[R]
@@ -64,9 +62,6 @@
 .TP
 \f[B]\f[CB]-T --tree\f[B]\f[R]
 show accounts as a tree
-.TP
-\f[B]\f[CB]--future\f[B]\f[R]
-show transactions dated later than today (normally hidden)
 .PP
 hledger input options:
 .TP
@@ -91,7 +86,8 @@
 use some other field or tag for the account name
 .TP
 \f[B]\f[CB]-I --ignore-assertions\f[B]\f[R]
-ignore any failing balance assertions
+disable balance assertion checks (note: does not disable balance
+assignments)
 .PP
 hledger reporting options:
 .TP
@@ -154,8 +150,9 @@
 apply automated posting rules to modify transactions.
 .TP
 \f[B]\f[CB]--forecast\f[B]\f[R]
-apply periodic transaction rules to generate future transactions, to 6
-months from now or report end date.
+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.
 .PP
 When a reporting option appears more than once in the command line, the
 last one takes precedence.
@@ -217,12 +214,11 @@
 \f[C]BACKSPACE\f[R] or \f[C]DELETE\f[R] removes all filters, showing all
 transactions.
 .PP
-As mentioned above, hledger-ui shows auto-generated periodic
-transactions, and hides future transactions (auto-generated or not) by
-default.
-\f[C]F\f[R] toggles showing and hiding these future transactions.
-This is similar to using a query like \f[C]date:-tomorrow\f[R], but more
-convenient.
+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
+transactions are shown.
 (experimental)
 .PP
 \f[C]ESCAPE\f[R] removes all filters and jumps back to the top screen.
@@ -370,9 +366,6 @@
 a depth limit.
 In other words, the register always shows the transactions contributing
 to the balance shown on the accounts screen.
-.PD 0
-.P
-.PD
 Tree mode/flat mode can be toggled with \f[C]T\f[R] here also.
 .PP
 \f[C]U\f[R] toggles filtering by unmarked status, showing or hiding
@@ -427,6 +420,27 @@
 \f[C]-f\f[R].
 Default: \f[C]\[ti]/.hledger.journal\f[R] (on windows, perhaps
 \f[C]C:/Users/USER/.hledger.journal\f[R]).
+.PP
+A typical value is \f[C]\[ti]/DIR/YYYY.journal\f[R], where DIR is a
+version-controlled finance directory and YYYY is the current year.
+Or \f[C]\[ti]/DIR/current.journal\f[R], where current.journal is a
+symbolic link to YYYY.journal.
+.PP
+On Mac computers, you can set this and other environment variables in a
+more thorough way that also affects applications started from the GUI
+(say, an Emacs dock icon).
+Eg on MacOS Catalina I have a \f[C]\[ti]/.MacOSX/environment.plist\f[R]
+file containing
+.IP
+.nf
+\f[C]
+{
+  \[dq]LEDGER_FILE\[dq] : \[dq]\[ti]/finance/current.journal\[dq]
+}
+\f[R]
+.fi
+.PP
+To see the effect you may need to \f[C]killall Dock\f[R], or reboot.
 .SH FILES
 .PP
 Reads data from one or more files in hledger journal, timeclock,
diff --git a/embeddedfiles/hledger-ui.info b/embeddedfiles/hledger-ui.info
--- a/embeddedfiles/hledger-ui.info
+++ b/embeddedfiles/hledger-ui.info
@@ -3,33 +3,44 @@
 
 File: hledger-ui.info,  Node: Top,  Next: OPTIONS,  Up: (dir)
 
-hledger-ui(1) hledger-ui 1.16.2
-*******************************
+hledger-ui(1) hledger-ui 1.17
+*****************************
 
-hledger-ui is hledger's terminal interface, providing an efficient
+hledger-ui - terminal interface for the hledger accounting tool
+
+   'hledger-ui [OPTIONS] [QUERYARGS]'
+'hledger ui -- [OPTIONS] [QUERYARGS]'
+
+   hledger is a reliable, cross-platform set of programs for tracking
+money, time, or any other commodity, using double-entry accounting and a
+simple, editable file format.  hledger is inspired by and largely
+compatible with ledger(1).
+
+   hledger-ui is hledger's terminal interface, providing an efficient
 full-window text UI for viewing accounts and transactions, and some
 limited data entry capability.  It is easier than hledger's command-line
 interface, and sometimes quicker and more convenient than the web
 interface.
 
-   Note hledger-ui has some different defaults (experimental):
-
-   * it generates rule-based transactions and postings by default
-     (-forecast and -auto are always on).
-   * it hides transactions dated in the future by default (change this
-     with -future or the F key).
-
    Like hledger, it reads data from one or more files in hledger
 journal, timeclock, timedot, or CSV format specified with '-f', or
 '$LEDGER_FILE', or '$HOME/.hledger.journal' (on windows, perhaps
 'C:/Users/USER/.hledger.journal').  For more about this see hledger(1),
 hledger_journal(5) etc.
 
+   Unlike hledger, hledger-ui hides all future-dated transactions by
+default.  They can be revealed, along with any rule-generated periodic
+transactions, by pressing the F key (or starting with -forecast) to
+enable "forecast mode".
+
 * Menu:
 
 * OPTIONS::
 * KEYS::
 * SCREENS::
+* ENVIRONMENT::
+* FILES::
+* BUGS::
 
 
 File: hledger-ui.info,  Node: OPTIONS,  Next: KEYS,  Prev: Top,  Up: Top
@@ -62,10 +73,7 @@
 '-T --tree'
 
      show accounts as a tree
-'--future'
 
-     show transactions dated later than today (normally hidden)
-
    hledger input options:
 
 '-f FILE --file=FILE'
@@ -89,7 +97,8 @@
      use some other field or tag for the account name
 '-I --ignore-assertions'
 
-     ignore any failing balance assertions
+     disable balance assertion checks (note: does not disable balance
+     assignments)
 
    hledger reporting options:
 
@@ -154,8 +163,9 @@
      apply automated posting rules to modify transactions.
 '--forecast'
 
-     apply periodic transaction rules to generate future transactions,
-     to 6 months from now or report end date.
+     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.
 
    When a reporting option appears more than once in the command line,
 the last one takes precedence.
@@ -215,11 +225,10 @@
 below).  'BACKSPACE' or 'DELETE' removes all filters, showing all
 transactions.
 
-   As mentioned above, hledger-ui shows auto-generated periodic
-transactions, and hides future transactions (auto-generated or not) by
-default.  'F' toggles showing and hiding these future transactions.
-This is similar to using a query like 'date:-tomorrow', but more
-convenient.  (experimental)
+   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)
 
    'ESCAPE' removes all filters and jumps back to the top screen.  Or,
 it cancels a minibuffer edit or help dialog in progress.
@@ -277,7 +286,7 @@
    Additional screen-specific keys are described below.
 
 
-File: hledger-ui.info,  Node: SCREENS,  Prev: KEYS,  Up: Top
+File: hledger-ui.info,  Node: SCREENS,  Next: ENVIRONMENT,  Prev: KEYS,  Up: Top
 
 3 SCREENS
 *********
@@ -366,8 +375,8 @@
 the register if the accounts screen is in tree mode, or if it's in flat
 mode but this account has subaccounts which are not shown due to a depth
 limit.  In other words, the register always shows the transactions
-contributing to the balance shown on the accounts screen.
-Tree mode/flat mode can be toggled with 'T' here also.
+contributing to the balance shown on the accounts screen.  Tree
+mode/flat mode can be toggled with 'T' here also.
 
    'U' toggles filtering by unmarked status, showing or hiding unmarked
 transactions.  Similarly, 'P' toggles pending transactions, and 'C'
@@ -421,22 +430,95 @@
 to cancel the reload attempt.)
 
 
+File: hledger-ui.info,  Node: ENVIRONMENT,  Next: FILES,  Prev: SCREENS,  Up: Top
+
+4 ENVIRONMENT
+*************
+
+*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.journal').
+
+   A typical value is '~/DIR/YYYY.journal', where DIR is a
+version-controlled finance directory and YYYY is the current year.  Or
+'~/DIR/current.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
+(say, an Emacs dock icon).  Eg on MacOS Catalina I have a
+'~/.MacOSX/environment.plist' file containing
+
+{
+  "LEDGER_FILE" : "~/finance/current.journal"
+}
+
+   To see the effect you may need to 'killall Dock', or reboot.
+
+
+File: hledger-ui.info,  Node: FILES,  Next: BUGS,  Prev: ENVIRONMENT,  Up: Top
+
+5 FILES
+*******
+
+Reads data from one or more files in hledger journal, timeclock,
+timedot, or CSV format specified with '-f', or '$LEDGER_FILE', or
+'$HOME/.hledger.journal' (on windows, perhaps
+'C:/Users/USER/.hledger.journal').
+
+
+File: hledger-ui.info,  Node: BUGS,  Prev: FILES,  Up: Top
+
+6 BUGS
+******
+
+The need to precede options with '--' when invoked from hledger is
+awkward.
+
+   '-f-' doesn't work (hledger-ui can't read from stdin).
+
+   '-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 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. Symptoms
+include: unresponsive UI, periodic resetting of the cursor position,
+momentary display of parse errors, high CPU usage eventually subsiding,
+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' requires that both machine clocks are roughly in step.
+
+
 Tag Table:
 Node: Top71
-Node: OPTIONS1101
-Ref: #options1198
-Node: KEYS4589
-Ref: #keys4684
-Node: SCREENS8991
-Ref: #screens9076
-Node: Accounts screen9166
-Ref: #accounts-screen9294
-Node: Register screen11510
-Ref: #register-screen11665
-Node: Transaction screen13661
-Ref: #transaction-screen13819
-Node: Error screen14689
-Ref: #error-screen14811
+Node: OPTIONS1470
+Ref: #options1567
+Node: KEYS4998
+Ref: #keys5093
+Node: SCREENS9369
+Ref: #screens9474
+Node: Accounts screen9564
+Ref: #accounts-screen9692
+Node: Register screen11908
+Ref: #register-screen12063
+Node: Transaction screen14060
+Ref: #transaction-screen14218
+Node: Error screen15088
+Ref: #error-screen15210
+Node: ENVIRONMENT15454
+Ref: #environment15568
+Node: FILES16375
+Ref: #files16474
+Node: BUGS16687
+Ref: #bugs16764
 
 End Tag Table
 
diff --git a/embeddedfiles/hledger-ui.txt b/embeddedfiles/hledger-ui.txt
--- a/embeddedfiles/hledger-ui.txt
+++ b/embeddedfiles/hledger-ui.txt
@@ -11,10 +11,10 @@
        hledger ui -- [OPTIONS] [QUERYARGS]
 
 DESCRIPTION
-       hledger  is  a  cross-platform program for tracking money, time, or any
-       other commodity, using double-entry accounting and a  simple,  editable
-       file  format.   hledger  is  inspired  by  and  largely compatible with
-       ledger(1).
+       hledger  is  a  reliable,  cross-platform  set of programs for tracking
+       money, time, or any other commodity, using double-entry accounting  and
+       a  simple,  editable  file  format.  hledger is inspired by and largely
+       compatible with ledger(1).
 
        hledger-ui is hledger's  terminal  interface,  providing  an  efficient
        full-window  text  UI  for  viewing accounts and transactions, and some
@@ -22,25 +22,22 @@
        line  interface, and sometimes quicker and more convenient than the web
        interface.
 
-       Note hledger-ui has some different defaults (experimental):
-
-       o it generates rule-based transactions and postings by default (--fore-
-         cast and --auto are always on).
-
-       o it  hides  transactions  dated  in the future by default (change this
-         with --future or the F key).
-
        Like hledger, it reads data from one or more files in hledger  journal,
        timeclock,  timedot,  or CSV format specified with -f, or $LEDGER_FILE,
        or       $HOME/.hledger.journal       (on       windows,        perhaps
        C:/Users/USER/.hledger.journal).   For  more about this see hledger(1),
        hledger_journal(5) etc.
 
+       Unlike hledger, hledger-ui hides all future-dated transactions  by  de-
+       fault.   They  can  be revealed, along with any rule-generated periodic
+       transactions, by pressing the F key (or starting  with  --forecast)  to
+       enable "forecast mode".
+
 OPTIONS
-       Note: if invoking hledger-ui as a hledger subcommand, write  --  before
+       Note:  if  invoking hledger-ui as a hledger subcommand, write -- before
        options as shown above.
 
-       Any  QUERYARGS  are interpreted as a hledger search query which filters
+       Any QUERYARGS are interpreted as a hledger search query  which  filters
        the data.
 
        --watch
@@ -53,7 +50,7 @@
               start in the (first) matched account's register screen
 
        --change
-              show period balances (changes) at startup instead of  historical
+              show  period balances (changes) at startup instead of historical
               balances
 
        -F --flat
@@ -62,9 +59,6 @@
        -T --tree
               show accounts as a tree
 
-       --future
-              show transactions dated later than today (normally hidden)
-
        hledger input options:
 
        -f FILE --file=FILE
@@ -72,7 +66,7 @@
               $LEDGER_FILE or $HOME/.hledger.journal)
 
        --rules-file=RULESFILE
-              Conversion  rules  file  to  use  when  reading  CSV   (default:
+              Conversion   rules  file  to  use  when  reading  CSV  (default:
               FILE.rules)
 
        --separator=CHAR
@@ -87,7 +81,8 @@
               use some other field or tag for the account name
 
        -I --ignore-assertions
-              ignore any failing balance assertions
+              disable balance assertion checks (note: does not disable balance
+              assignments)
 
        hledger reporting options:
 
@@ -150,8 +145,9 @@
        --auto apply automated posting rules to modify transactions.
 
        --forecast
-              apply periodic transaction rules  to  generate  future  transac-
-              tions, to 6 months from now or report end date.
+              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.
 
        When a reporting option appears more than once in the command line, the
        last one takes precedence.
@@ -170,44 +166,43 @@
               show debug output (levels 1-9, default: 1)
 
        A @FILE argument will be expanded to the contents of FILE, which should
-       contain  one  command line option/argument per line.  (To prevent this,
+       contain one command line option/argument per line.  (To  prevent  this,
        insert a -- argument before.)
 
 KEYS
-       ? shows a help dialog listing all keys.  (Some of these also appear  in
+       ?  shows a help dialog listing all keys.  (Some of these also appear in
        the quick help at the bottom of each screen.) Press ? again (or ESCAPE,
        or LEFT) to close it.  The following keys work on most screens:
 
        The cursor keys navigate: right (or enter) goes deeper, left returns to
-       the  previous  screen,  up/down/page  up/page down/home/end move up and
-       down through lists.  Vi-style (h/j/k/l) and  Emacs-style  (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
+       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.)
 
-       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
+       With  shift pressed, the cursor keys adjust the report period, limiting
+       the transactions to be shown  (by  default,  all  are  shown).   shift-
+       down/up  steps downward and upward through these standard report period
+       durations: year, quarter, month,  week,  day.   Then,  shift-left/right
+       moves  to the previous/next period.  t sets the report period to today.
+       With the --watch option, when viewing a "current" period  (the  current
        day, week, month, quarter, or year), the period will move automatically
        to track the current date.  To set a non-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
+       /  lets  you  set a general filter query limiting the data shown, using
+       the same query terms as in hledger and hledger-web.  While editing  the
+       query,  you  can  use CTRL-a/e/d/k, BS, cursor keys; press ENTER to set
        it, or ESCAPEto cancel.  There are also keys for quickly adjusting some
-       common filters like account depth and transaction status  (see  below).
+       common  filters  like account depth and transaction status (see below).
        BACKSPACE or DELETE removes all filters, showing all transactions.
 
-       As  mentioned  above, hledger-ui shows auto-generated periodic transac-
-       tions, and hides future transactions (auto-generated  or  not)  by  de-
-       fault.   F  toggles showing and hiding these future transactions.  This
-       is similar to using a query like date:-tomorrow, but  more  convenient.
-       (experimental)
+       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-
+       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.
@@ -329,44 +324,44 @@
        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.
+       tions contributing to the balance shown on the accounts  screen.   Tree
+       mode/flat mode can be toggled with T here also.
 
-       U toggles filtering by unmarked  status,  showing  or  hiding  unmarked
+       U  toggles  filtering  by  unmarked  status, showing or hiding unmarked
        transactions.  Similarly, P toggles pending transactions, and C toggles
-       cleared transactions.  (By default, transactions with all statuses  are
-       shown;  if  you activate one or two status filters, only those transac-
+       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.)
 
@@ -374,9 +369,24 @@
        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-
+       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
+       (say, an Emacs dock icon).  Eg on MacOS Catalina I have a ~/.MacOSX/en-
+       vironment.plist file containing
+
+              {
+                "LEDGER_FILE" : "~/finance/current.journal"
+              }
+
+       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
@@ -431,4 +441,4 @@
 
 
 
-hledger-ui 1.16.2                January 2020                    hledger-ui(1)
+hledger-ui 1.17                   March 2020                     hledger-ui(1)
diff --git a/embeddedfiles/hledger-web.1 b/embeddedfiles/hledger-web.1
--- a/embeddedfiles/hledger-web.1
+++ b/embeddedfiles/hledger-web.1
@@ -1,5 +1,5 @@
 
-.TH "hledger-web" "1" "January 2020" "hledger-web 1.16.2" "hledger User Manuals"
+.TH "hledger-web" "1" "March 2020" "hledger-web 1.17" "hledger User Manuals"
 
 
 
@@ -15,9 +15,9 @@
 \f[C]hledger web -- [OPTIONS]\f[R]
 .SH DESCRIPTION
 .PP
-hledger is a cross-platform program for tracking money, time, or any
-other commodity, using double-entry accounting and a simple, editable
-file format.
+hledger is a reliable, cross-platform set of programs for tracking
+money, time, or any other commodity, using double-entry accounting and a
+simple, editable file format.
 hledger is inspired by and largely compatible with ledger(1).
 .PP
 hledger-web is hledger\[aq]s web interface.
@@ -64,6 +64,13 @@
 \f[B]\f[CB]--port=PORT\f[B]\f[R]
 listen on this TCP port (default: 5000)
 .TP
+\f[B]\f[CB]--socket=SOCKETFILE\f[B]\f[R]
+use a unix domain socket file to listen for requests instead of a TCP
+socket.
+Implies \f[C]--serve\f[R].
+It can only be used if the operating system can provide this type of
+socket.
+.TP
 \f[B]\f[CB]--base-url=URL\f[B]\f[R]
 set the base url (default: http://IPADDR:PORT).
 You would change this when sharing over the network, or integrating
@@ -105,7 +112,8 @@
 use some other field or tag for the account name
 .TP
 \f[B]\f[CB]-I --ignore-assertions\f[B]\f[R]
-ignore any failing balance assertions
+disable balance assertion checks (note: does not disable balance
+assignments)
 .PP
 hledger reporting options:
 .TP
@@ -168,8 +176,9 @@
 apply automated posting rules to modify transactions.
 .TP
 \f[B]\f[CB]--forecast\f[B]\f[R]
-apply periodic transaction rules to generate future transactions, to 6
-months from now or report end date.
+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.
 .PP
 When a reporting option appears more than once in the command line, the
 last one takes precedence.
@@ -209,6 +218,26 @@
 Similarly, use \f[C]--port\f[R] to set a TCP port other than 5000, eg if
 you are running multiple hledger-web instances.
 .PP
+Both of these options are ignored when \f[C]--socket\f[R] is used.
+In this case, it creates an \f[C]AF_UNIX\f[R] socket file at the
+supplied path and uses that for communication.
+This is an alternative way of running multiple hledger-web instances
+behind a reverse proxy that handles authentication for different users.
+The path can be derived in a predictable way, eg by using the username
+within the path.
+As an example, \f[C]nginx\f[R] as reverse proxy can use the variabel
+\f[C]$remote_user\f[R] to derive a path from the username used in a HTTP
+basic authentication.
+The following \f[C]proxy_pass\f[R] directive allows access to all
+\f[C]hledger-web\f[R] instances that created a socket in
+\f[C]/tmp/hledger/\f[R]:
+.IP
+.nf
+\f[C]
+  proxy_pass http://unix:/tmp/hledger/${remote_user}.socket;
+\f[R]
+.fi
+.PP
 You can use \f[C]--base-url\f[R] to change the protocol, hostname, port
 and path that appear in hyperlinks, useful eg for integrating
 hledger-web within a larger website.
@@ -314,8 +343,8 @@
 .PP
 Another way to generate test data is with the
 \f[C]readJsonFile\f[R]/\f[C]writeJsonFile\f[R] helpers in
-Hledger.Web.Json, which read or write any of hledger\[aq]s JSON-capable
-types from or to a file.
+Hledger.Web.Json, which can write or read most of hledger\[aq]s data
+types to or from a file.
 Eg here we write the first transaction of a sample journal:
 .IP
 .nf
@@ -347,6 +376,27 @@
 \f[C]-f\f[R].
 Default: \f[C]\[ti]/.hledger.journal\f[R] (on windows, perhaps
 \f[C]C:/Users/USER/.hledger.journal\f[R]).
+.PP
+A typical value is \f[C]\[ti]/DIR/YYYY.journal\f[R], where DIR is a
+version-controlled finance directory and YYYY is the current year.
+Or \f[C]\[ti]/DIR/current.journal\f[R], where current.journal is a
+symbolic link to YYYY.journal.
+.PP
+On Mac computers, you can set this and other environment variables in a
+more thorough way that also affects applications started from the GUI
+(say, an Emacs dock icon).
+Eg on MacOS Catalina I have a \f[C]\[ti]/.MacOSX/environment.plist\f[R]
+file containing
+.IP
+.nf
+\f[C]
+{
+  \[dq]LEDGER_FILE\[dq] : \[dq]\[ti]/finance/current.journal\[dq]
+}
+\f[R]
+.fi
+.PP
+To see the effect you may need to \f[C]killall Dock\f[R], or reboot.
 .SH FILES
 .PP
 Reads data from one or more files in hledger journal, timeclock,
diff --git a/embeddedfiles/hledger-web.info b/embeddedfiles/hledger-web.info
--- a/embeddedfiles/hledger-web.info
+++ b/embeddedfiles/hledger-web.info
@@ -3,10 +3,20 @@
 
 File: hledger-web.info,  Node: Top,  Next: OPTIONS,  Up: (dir)
 
-hledger-web(1) hledger-web 1.16.2
-*********************************
+hledger-web(1) hledger-web 1.17
+*******************************
 
-hledger-web is hledger's web interface.  It starts a simple web
+hledger-web - web interface for the hledger accounting tool
+
+   'hledger-web [OPTIONS]'
+'hledger web -- [OPTIONS]'
+
+   hledger is a reliable, cross-platform set of programs for tracking
+money, time, or any other commodity, using double-entry accounting and a
+simple, editable file format.  hledger is inspired by and largely
+compatible with ledger(1).
+
+   hledger-web is hledger's web interface.  It starts a simple web
 application for browsing and adding transactions, and optionally opens
 it in a web browser window if possible.  It provides a more
 user-friendly UI than the hledger CLI or hledger-ui interface, showing
@@ -33,6 +43,9 @@
 * EDITING UPLOADING DOWNLOADING::
 * RELOADING::
 * JSON API::
+* ENVIRONMENT::
+* FILES::
+* BUGS::
 
 
 File: hledger-web.info,  Node: OPTIONS,  Next: PERMISSIONS,  Prev: Top,  Up: Top
@@ -60,6 +73,11 @@
 '--port=PORT'
 
      listen on this TCP port (default: 5000)
+'--socket=SOCKETFILE'
+
+     use a unix domain socket file to listen for requests instead of a
+     TCP socket.  Implies '--serve'.  It can only be used if the
+     operating system can provide this type of socket.
 '--base-url=URL'
 
      set the base url (default: http://IPADDR:PORT). You would change
@@ -103,7 +121,8 @@
      use some other field or tag for the account name
 '-I --ignore-assertions'
 
-     ignore any failing balance assertions
+     disable balance assertion checks (note: does not disable balance
+     assignments)
 
    hledger reporting options:
 
@@ -168,8 +187,9 @@
      apply automated posting rules to modify transactions.
 '--forecast'
 
-     apply periodic transaction rules to generate future transactions,
-     to 6 months from now or report end date.
+     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.
 
    When a reporting option appears more than once in the command line,
 the last one takes precedence.
@@ -208,6 +228,19 @@
    Similarly, use '--port' to set a TCP port other than 5000, eg if you
 are running multiple hledger-web instances.
 
+   Both of these options are ignored when '--socket' is used.  In this
+case, it creates an 'AF_UNIX' socket file at the supplied path and uses
+that for communication.  This is an alternative way of running multiple
+hledger-web instances behind a reverse proxy that handles authentication
+for different users.  The path can be derived in a predictable way, eg
+by using the username within the path.  As an example, 'nginx' as
+reverse proxy can use the variabel '$remote_user' to derive a path from
+the username used in a HTTP basic authentication.  The following
+'proxy_pass' directive allows access to all 'hledger-web' instances that
+created a socket in '/tmp/hledger/':
+
+  proxy_pass http://unix:/tmp/hledger/${remote_user}.socket;
+
    You can use '--base-url' to change the protocol, hostname, port and
 path that appear in hyperlinks, useful eg for integrating hledger-web
 within a larger website.  The default is 'http://HOST:PORT/' using the
@@ -292,7 +325,7 @@
 sure that both machine clocks are roughly in step.)
 
 
-File: hledger-web.info,  Node: JSON API,  Prev: RELOADING,  Up: Top
+File: hledger-web.info,  Node: JSON API,  Next: ENVIRONMENT,  Prev: RELOADING,  Up: Top
 
 5 JSON API
 **********
@@ -317,8 +350,8 @@
 what you get from '/transactions' or '/accounttransactions'.
 
    Another way to generate test data is with the
-'readJsonFile'/'writeJsonFile' helpers in Hledger.Web.Json, which read
-or write any of hledger's JSON-capable types from or to a file.  Eg here
+'readJsonFile'/'writeJsonFile' helpers in Hledger.Web.Json, which can
+write or read most of hledger's data types to or from a file.  Eg here
 we write the first transaction of a sample journal:
 
 $ make ghci-web
@@ -338,18 +371,78 @@
 to serve the API.
 
 
+File: hledger-web.info,  Node: ENVIRONMENT,  Next: FILES,  Prev: JSON API,  Up: Top
+
+6 ENVIRONMENT
+*************
+
+*LEDGER_FILE* The journal file path when not specified with '-f'.
+Default: '~/.hledger.journal' (on windows, perhaps
+'C:/Users/USER/.hledger.journal').
+
+   A typical value is '~/DIR/YYYY.journal', where DIR is a
+version-controlled finance directory and YYYY is the current year.  Or
+'~/DIR/current.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
+(say, an Emacs dock icon).  Eg on MacOS Catalina I have a
+'~/.MacOSX/environment.plist' file containing
+
+{
+  "LEDGER_FILE" : "~/finance/current.journal"
+}
+
+   To see the effect you may need to 'killall Dock', or reboot.
+
+
+File: hledger-web.info,  Node: FILES,  Next: BUGS,  Prev: ENVIRONMENT,  Up: Top
+
+7 FILES
+*******
+
+Reads data from one or more files in hledger journal, timeclock,
+timedot, or CSV format specified with '-f', or '$LEDGER_FILE', or
+'$HOME/.hledger.journal' (on windows, perhaps
+'C:/Users/USER/.hledger.journal').
+
+
+File: hledger-web.info,  Node: BUGS,  Prev: FILES,  Up: Top
+
+8 BUGS
+******
+
+The need to precede options with '--' when invoked from hledger is
+awkward.
+
+   '-f-' doesn't work (hledger-web can't read from stdin).
+
+   Query arguments and some hledger options are ignored.
+
+   Does not work in text-mode browsers.
+
+   Does not work well on small screens.
+
+
 Tag Table:
 Node: Top72
-Node: OPTIONS1359
-Ref: #options1464
-Node: PERMISSIONS6743
-Ref: #permissions6882
-Node: EDITING UPLOADING DOWNLOADING8094
-Ref: #editing-uploading-downloading8275
-Node: RELOADING9109
-Ref: #reloading9243
-Node: JSON API9676
-Ref: #json-api9770
+Node: OPTIONS1746
+Ref: #options1851
+Node: PERMISSIONS8195
+Ref: #permissions8334
+Node: EDITING UPLOADING DOWNLOADING9546
+Ref: #editing-uploading-downloading9727
+Node: RELOADING10561
+Ref: #reloading10695
+Node: JSON API11128
+Ref: #json-api11242
+Node: ENVIRONMENT12680
+Ref: #environment12796
+Node: FILES13529
+Ref: #files13629
+Node: BUGS13842
+Ref: #bugs13920
 
 End Tag Table
 
diff --git a/embeddedfiles/hledger-web.txt b/embeddedfiles/hledger-web.txt
--- a/embeddedfiles/hledger-web.txt
+++ b/embeddedfiles/hledger-web.txt
@@ -11,10 +11,10 @@
        hledger web -- [OPTIONS]
 
 DESCRIPTION
-       hledger  is  a  cross-platform program for tracking money, time, or any
-       other commodity, using double-entry accounting and a  simple,  editable
-       file  format.   hledger  is  inspired  by  and  largely compatible with
-       ledger(1).
+       hledger  is  a  reliable,  cross-platform  set of programs for tracking
+       money, time, or any other commodity, using double-entry accounting  and
+       a  simple,  editable  file  format.  hledger is inspired by and largely
+       compatible with ledger(1).
 
        hledger-web is hledger's web interface.  It starts a simple web  appli-
        cation for browsing and adding transactions, and optionally opens it in
@@ -56,6 +56,11 @@
        --port=PORT
               listen on this TCP port (default: 5000)
 
+       --socket=SOCKETFILE
+              use  a unix domain socket file to listen for requests instead of
+              a TCP socket.  Implies --serve.  It can only be used if the  op-
+              erating system can provide this type of socket.
+
        --base-url=URL
               set  the  base  url  (default:  http://IPADDR:PORT).   You would
               change this when sharing over the network, or integrating within
@@ -97,7 +102,8 @@
               use some other field or tag for the account name
 
        -I --ignore-assertions
-              ignore any failing balance assertions
+              disable balance assertion checks (note: does not disable balance
+              assignments)
 
        hledger reporting options:
 
@@ -123,7 +129,7 @@
               multiperiod/multicolumn report by year
 
        -p --period=PERIODEXP
-              set start date, end date, and/or reporting interval all at  once
+              set  start date, end date, and/or reporting interval all at once
               using period expressions syntax
 
        --date2
@@ -146,22 +152,23 @@
               hide/aggregate accounts or postings more than NUM levels deep
 
        -E --empty
-              show items with zero amount, normally hidden (and vice-versa  in
+              show  items with zero amount, normally hidden (and vice-versa in
               hledger-ui/hledger-web)
 
        -B --cost
-              convert  amounts  to  their  cost at transaction time (using the
+              convert amounts to their cost at  transaction  time  (using  the
               transaction price, if any)
 
        -V --value
-              convert amounts to their market value on  the  report  end  date
+              convert  amounts  to  their  market value on the report end date
               (using the most recent applicable market price, if any)
 
        --auto apply automated posting rules to modify transactions.
 
        --forecast
-              apply  periodic  transaction  rules  to generate future transac-
-              tions, to 6 months from now or report end date.
+              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.
 
        When a reporting option appears more than once in the command line, the
        last one takes precedence.
@@ -199,22 +206,35 @@
        Similarly, use --port to set a TCP port other than 5000, eg if you  are
        running multiple hledger-web instances.
 
-       You  can use --base-url to change the protocol, hostname, port and path
+       Both of these options are ignored when --socket is used.  In this case,
+       it creates an AF_UNIX socket file at the supplied path  and  uses  that
+       for  communication.   This  is  an  alternative way of running multiple
+       hledger-web instances behind a reverse proxy that  handles  authentica-
+       tion  for  different  users.   The path can be derived in a predictable
+       way, eg by using the username within the path.  As an example, nginx as
+       reverse  proxy  can use the variabel $remote_user to derive a path from
+       the username used  in  a  HTTP  basic  authentication.   The  following
+       proxy_pass  directive  allows  access to all hledger-web instances that
+       created a socket in /tmp/hledger/:
+
+                proxy_pass http://unix:/tmp/hledger/${remote_user}.socket;
+
+       You can use --base-url to change the protocol, hostname, port and  path
        that appear in hyperlinks, useful eg for integrating hledger-web within
-       a  larger website.  The default is http://HOST:PORT/ using the server's
+       a larger website.  The default is http://HOST:PORT/ using the  server's
        configured host address and TCP port (or http://HOST if PORT is 80).
 
-       With --file-url you can set a different base url for static  files,  eg
+       With  --file-url  you can set a different base url for static files, eg
        for better caching or cookie-less serving on high performance websites.
 
 PERMISSIONS
-       By  default,  hledger-web  allows  anyone  who can reach it to view the
+       By default, hledger-web allows anyone who can  reach  it  to  view  the
        journal and to add new transactions, but not to change existing data.
 
        You can restrict who can reach it by
 
-       o setting the IP address it listens on (see --host above).  By  default
-         it  listens  on  127.0.0.1,  accessible to all users on the local ma-
+       o setting  the IP address it listens on (see --host above).  By default
+         it listens on 127.0.0.1, accessible to all users  on  the  local  ma-
          chine.
 
        o putting it behind an authenticating proxy, using eg apache or nginx
@@ -224,44 +244,44 @@
        You can restrict what the users who reach it can do, by
 
        o using the --capabilities=CAP[,CAP..] flag when you start it, enabling
-         one  or  more  of  the  following capabilities.  The default value is
+         one or more of the following  capabilities.   The  default  value  is
          view,add:
 
          o view - allows viewing the journal file and all included files
 
          o add - allows adding new transactions to the main journal file
 
-         o manage - allows editing, uploading or downloading the main  or  in-
+         o manage  -  allows editing, uploading or downloading the main or in-
            cluded files
 
-       o using  the  --capabilities-header=HTTPHEADER  flag  to specify a HTTP
-         header from which it will read capabilities to  enable.   hledger-web
-         on  Sandstorm  uses  the  X-Sandstorm-Permissions header to integrate
+       o using the --capabilities-header=HTTPHEADER flag  to  specify  a  HTTP
+         header  from  which it will read capabilities to enable.  hledger-web
+         on Sandstorm uses the  X-Sandstorm-Permissions  header  to  integrate
          with Sandstorm's permissions.  This is disabled by default.
 
 EDITING, UPLOADING, DOWNLOADING
-       If you enable the manage capability mentioned above, you'll see  a  new
-       "spanner"  button  to the right of the search form.  Clicking this will
-       let you edit, upload, or download the journal file or any files it  in-
+       If  you  enable the manage capability mentioned above, you'll see a new
+       "spanner" button to the right of the search form.  Clicking  this  will
+       let  you edit, upload, or download the journal file or any files it in-
        cludes.
 
-       Note,  unlike any other hledger command, in this mode you (or any visi-
+       Note, unlike any other hledger command, in this mode you (or any  visi-
        tor) can alter or wipe the data files.
 
-       Normally whenever a file is changed in this way,  hledger-web  saves  a
-       numbered  backup  (assuming  file permissions allow it, the disk is not
-       full, etc.) hledger-web is not aware of version control  systems,  cur-
-       rently;  if  you  use one, you'll have to arrange to commit the changes
+       Normally  whenever  a  file is changed in this way, hledger-web saves a
+       numbered backup (assuming file permissions allow it, the  disk  is  not
+       full,  etc.)  hledger-web is not aware of version control systems, cur-
+       rently; if you use one, you'll have to arrange to  commit  the  changes
        yourself (eg with a cron job or a file watcher like entr).
 
-       Changes which would leave the journal file(s) unparseable or  non-valid
-       (eg  with  failing balance assertions) are prevented.  (Probably.  This
+       Changes  which would leave the journal file(s) unparseable or non-valid
+       (eg with failing balance assertions) are prevented.   (Probably.   This
        needs re-testing.)
 
 RELOADING
        hledger-web detects changes made to the files by other means (eg if you
-       edit  it  directly,  outside  of hledger-web), and it will show the new
-       data when you reload the page or navigate to a new page.  If  a  change
+       edit it directly, outside of hledger-web), and it  will  show  the  new
+       data  when  you reload the page or navigate to a new page.  If a change
        makes a file unparseable, hledger-web will display an error message un-
        til the file has been fixed.
 
@@ -269,8 +289,8 @@
        that both machine clocks are roughly in step.)
 
 JSON API
-       In  addition  to  the web UI, hledger-web provides some API routes that
-       serve JSON in  response  to  GET  requests.   (And  when  started  with
+       In addition to the web UI, hledger-web provides some  API  routes  that
+       serve  JSON  in  response  to  GET  requests.   (And  when started with
        --serve-api, it provides only these routes.):
 
               /accountnames
@@ -280,17 +300,17 @@
               /accounts
               /accounttransactions/#AccountName
 
-       Also,  you can append a new transaction to the journal by sending a PUT
-       request to /add (hledger-web only).  As with the  web  UI's  add  form,
-       hledger-web  must  be started with the add capability for this (enabled
+       Also, you can append a new transaction to the journal by sending a  PUT
+       request  to  /add  (hledger-web  only).  As with the web UI's add form,
+       hledger-web must be started with the add capability for  this  (enabled
        by default).
 
-       The payload should be a valid hledger transaction as JSON,  similar  to
+       The  payload  should be a valid hledger transaction as JSON, similar to
        what you get from /transactions or /accounttransactions.
 
-       Another  way  to generate test data is with the readJsonFile/writeJson-
-       File helpers in Hledger.Web.Json, which read or write any of  hledger's
-       JSON-capable  types  from  or  to  a  file.  Eg here we write the first
+       Another way to generate test data is with  the  readJsonFile/writeJson-
+       File  helpers  in  Hledger.Web.Json,  which  can  write or read most of
+       hledger's data types to or from a file.  Eg here  we  write  the  first
        transaction of a sample journal:
 
               $ make ghci-web
@@ -305,15 +325,30 @@
 
               $ curl -s http://127.0.0.1:5000/add -X PUT -H 'Content-Type: application/json' --data-binary @txn.pretty.json; echo
 
-       By default, both the server-side HTML UI and the JSON API  are  served.
-       Running  with  --serve-api disables the former, useful if you only want
+       By  default,  both the server-side HTML UI and the JSON API are served.
+       Running with --serve-api disables the former, useful if you  only  want
        to serve the API.
 
 ENVIRONMENT
        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-
+       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
+       (say, an Emacs dock icon).  Eg on MacOS Catalina I have a ~/.MacOSX/en-
+       vironment.plist file containing
+
+              {
+                "LEDGER_FILE" : "~/finance/current.journal"
+              }
+
+       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
@@ -357,4 +392,4 @@
 
 
 
-hledger-web 1.16.2               January 2020                   hledger-web(1)
+hledger-web 1.17                  March 2020                    hledger-web(1)
diff --git a/embeddedfiles/hledger.1 b/embeddedfiles/hledger.1
--- a/embeddedfiles/hledger.1
+++ b/embeddedfiles/hledger.1
@@ -1,3711 +1,4260 @@
 .\"t
 
-.TH "hledger" "1" "January 2020" "hledger 1.16.2" "hledger User Manuals"
-
-
-
-.SH NAME
-.PP
-hledger - a command-line accounting tool
-.SH SYNOPSIS
-.PP
-\f[C]hledger [-f FILE] COMMAND [OPTIONS] [ARGS]\f[R]
-.PD 0
-.P
-.PD
-\f[C]hledger [-f FILE] ADDONCMD -- [OPTIONS] [ARGS]\f[R]
-.PD 0
-.P
-.PD
-\f[C]hledger\f[R]
-.SH DESCRIPTION
-.PP
-hledger is a cross-platform program for tracking money, time, or any
-other commodity, using double-entry accounting and a simple, editable
-file format.
-hledger is inspired by and largely compatible with ledger(1).
-.PD 0
-.P
-.PD
-Tested on unix, mac, windows, hledger aims to be a reliable, practical
-tool for daily use.
-.PP
-This is hledger\[cq]s command-line interface (there are also terminal
-and web interfaces).
-Its basic function is to read a plain text file describing financial
-transactions (in accounting terms, a general journal) and print useful
-reports on standard output, or export them as CSV.
-hledger can also read some other file formats such as CSV files,
-translating them to journal format.
-Additionally, hledger lists other hledger-* executables found in the
-user\[cq]s $PATH and can invoke them as subcommands.
-.PP
-hledger reads data from one or more files in hledger journal, timeclock,
-timedot, or CSV format specified with \f[C]-f\f[R], or
-\f[C]$LEDGER_FILE\f[R], or \f[C]$HOME/.hledger.journal\f[R] (on windows,
-perhaps \f[C]C:/Users/USER/.hledger.journal\f[R]).
-If using \f[C]$LEDGER_FILE\f[R], note this must be a real environment
-variable, not a shell variable.
-You can specify standard input with \f[C]-f-\f[R].
-.PP
-Transactions are dated movements of money between two (or more) named
-accounts, and are recorded with journal entries like this:
-.IP
-.nf
-\f[C]
-2015/10/16 bought food
- expenses:food          $10
- assets:cash
-\f[R]
-.fi
-.PP
-For more about this format, see hledger_journal(5).
-.PP
-Most users use a text editor to edit the journal, usually with an editor
-mode such as ledger-mode for added convenience.
-hledger\[cq]s interactive add command is another way to record new
-transactions.
-hledger never changes existing transactions.
-.PP
-To get started, you can either save some entries like the above in
-\f[C]\[ti]/.hledger.journal\f[R], or run \f[C]hledger add\f[R] and
-follow the prompts.
-Then try some commands like \f[C]hledger print\f[R] or
-\f[C]hledger balance\f[R].
-Run \f[C]hledger\f[R] with no arguments for a list of commands.
-.SH EXAMPLES
-.PP
-Two simple transactions in hledger journal format:
-.IP
-.nf
-\f[C]
-2015/9/30 gift received
-  assets:cash   $20
-  income:gifts
-
-2015/10/16 farmers market
-  expenses:food    $10
-  assets:cash
-\f[R]
-.fi
-.PP
-Some basic reports:
-.IP
-.nf
-\f[C]
-$ hledger print
-2015/09/30 gift received
-    assets:cash            $20
-    income:gifts          $-20
-
-2015/10/16 farmers market
-    expenses:food           $10
-    assets:cash            $-10
-\f[R]
-.fi
-.IP
-.nf
-\f[C]
-$ hledger accounts --tree
-assets
-  cash
-expenses
-  food
-income
-  gifts
-\f[R]
-.fi
-.IP
-.nf
-\f[C]
-$ hledger balance
-                 $10  assets:cash
-                 $10  expenses:food
-                $-20  income:gifts
---------------------
-                   0
-\f[R]
-.fi
-.IP
-.nf
-\f[C]
-$ hledger register cash
-2015/09/30 gift received   assets:cash               $20           $20
-2015/10/16 farmers market  assets:cash              $-10           $10
-\f[R]
-.fi
-.PP
-More commands:
-.IP
-.nf
-\f[C]
-$ hledger                                 # show available commands
-$ hledger add                             # add more transactions to the journal file
-$ hledger balance                         # all accounts with aggregated balances
-$ hledger balance --help                  # show detailed help for balance command
-$ hledger balance --depth 1               # only top-level accounts
-$ hledger register                        # show account postings, with running total
-$ hledger reg income                      # show postings to/from income accounts
-$ hledger reg \[aq]assets:some bank:checking\[aq] # show postings to/from this checking account
-$ hledger print desc:shop                 # show transactions with shop in the description
-$ hledger activity -W                     # show transaction counts per week as a bar chart
-\f[R]
-.fi
-.SH OPTIONS
-.SS General options
-.PP
-To see general usage help, including general options which are supported
-by most hledger commands, run \f[C]hledger -h\f[R].
-.PP
-General help options:
-.TP
-\f[B]\f[CB]-h --help\f[B]\f[R]
-show general usage (or after COMMAND, command usage)
-.TP
-\f[B]\f[CB]--version\f[B]\f[R]
-show version
-.TP
-\f[B]\f[CB]--debug[=N]\f[B]\f[R]
-show debug output (levels 1-9, default: 1)
-.PP
-General input options:
-.TP
-\f[B]\f[CB]-f FILE --file=FILE\f[B]\f[R]
-use a different input file.
-For stdin, use - (default: \f[C]$LEDGER_FILE\f[R] or
-\f[C]$HOME/.hledger.journal\f[R])
-.TP
-\f[B]\f[CB]--rules-file=RULESFILE\f[B]\f[R]
-Conversion rules file to use when reading CSV (default: FILE.rules)
-.TP
-\f[B]\f[CB]--separator=CHAR\f[B]\f[R]
-Field separator to expect when reading CSV (default: \[aq],\[aq])
-.TP
-\f[B]\f[CB]--alias=OLD=NEW\f[B]\f[R]
-rename accounts named OLD to NEW
-.TP
-\f[B]\f[CB]--anon\f[B]\f[R]
-anonymize accounts and payees
-.TP
-\f[B]\f[CB]--pivot FIELDNAME\f[B]\f[R]
-use some other field or tag for the account name
-.TP
-\f[B]\f[CB]-I --ignore-assertions\f[B]\f[R]
-ignore any failing balance assertions
-.PP
-General reporting options:
-.TP
-\f[B]\f[CB]-b --begin=DATE\f[B]\f[R]
-include postings/txns on or after this date
-.TP
-\f[B]\f[CB]-e --end=DATE\f[B]\f[R]
-include postings/txns before this date
-.TP
-\f[B]\f[CB]-D --daily\f[B]\f[R]
-multiperiod/multicolumn report by day
-.TP
-\f[B]\f[CB]-W --weekly\f[B]\f[R]
-multiperiod/multicolumn report by week
-.TP
-\f[B]\f[CB]-M --monthly\f[B]\f[R]
-multiperiod/multicolumn report by month
-.TP
-\f[B]\f[CB]-Q --quarterly\f[B]\f[R]
-multiperiod/multicolumn report by quarter
-.TP
-\f[B]\f[CB]-Y --yearly\f[B]\f[R]
-multiperiod/multicolumn report by year
-.TP
-\f[B]\f[CB]-p --period=PERIODEXP\f[B]\f[R]
-set start date, end date, and/or reporting interval all at once using
-period expressions syntax
-.TP
-\f[B]\f[CB]--date2\f[B]\f[R]
-match the secondary date instead (see command help for other effects)
-.TP
-\f[B]\f[CB]-U --unmarked\f[B]\f[R]
-include only unmarked postings/txns (can combine with -P or -C)
-.TP
-\f[B]\f[CB]-P --pending\f[B]\f[R]
-include only pending postings/txns
-.TP
-\f[B]\f[CB]-C --cleared\f[B]\f[R]
-include only cleared postings/txns
-.TP
-\f[B]\f[CB]-R --real\f[B]\f[R]
-include only non-virtual postings
-.TP
-\f[B]\f[CB]-NUM --depth=NUM\f[B]\f[R]
-hide/aggregate accounts or postings more than NUM levels deep
-.TP
-\f[B]\f[CB]-E --empty\f[B]\f[R]
-show items with zero amount, normally hidden (and vice-versa in
-hledger-ui/hledger-web)
-.TP
-\f[B]\f[CB]-B --cost\f[B]\f[R]
-convert amounts to their cost at transaction time (using the transaction
-price, if any)
-.TP
-\f[B]\f[CB]-V --value\f[B]\f[R]
-convert amounts to their market value on the report end date (using the
-most recent applicable market price, if any)
-.TP
-\f[B]\f[CB]--auto\f[B]\f[R]
-apply automated posting rules to modify transactions.
-.TP
-\f[B]\f[CB]--forecast\f[B]\f[R]
-apply periodic transaction rules to generate future transactions, to 6
-months from now or report end date.
-.PP
-When a reporting option appears more than once in the command line, the
-last one takes precedence.
-.PP
-Some reporting options can also be written as query arguments.
-.SS Command options
-.PP
-To see options for a particular command, including command-specific
-options, run: \f[C]hledger COMMAND -h\f[R].
-.PP
-Command-specific options must be written after the command name, eg:
-\f[C]hledger print -x\f[R].
-.PP
-Additionally, if the command is an addon, you may need to put its
-options after a double-hyphen, eg: \f[C]hledger ui -- --watch\f[R].
-Or, you can run the addon executable directly:
-\f[C]hledger-ui --watch\f[R].
-.SS Command arguments
-.PP
-Most hledger commands accept arguments after the command name, which are
-often a query, filtering the data in some way.
-.SS Argument files
-.PP
-You can save a set of command line options/arguments in a file, one per
-line, and then reuse them by writing \f[C]\[at]FILENAME\f[R] in a
-command line.
-To prevent this expansion of \f[C]\[at]\f[R]-arguments, precede them
-with a \f[C]--\f[R] argument.
-For more, see Save frequently used options.
-.SS Special characters in arguments and queries
-.PP
-In shell command lines, option and argument values which contain
-\[dq]problematic\[dq] characters, ie spaces, and also characters
-significant to your shell such as \f[C]<\f[R], \f[C]>\f[R], \f[C](\f[R],
-\f[C])\f[R], \f[C]|\f[R] and \f[C]$\f[R], should be escaped by enclosing
-them in quotes or by writing backslashes before the characters.
-Eg:
-.PP
-\f[C]hledger register -p \[aq]last year\[aq] \[dq]accounts receivable (receivable|payable)\[dq] amt:\[rs]>100\f[R].
-.SS More escaping
-.PP
-Characters significant both to the shell and in regular expressions may
-need one extra level of escaping.
-These include parentheses, the pipe symbol and the dollar sign.
-Eg, to match the dollar symbol, bash users should do:
-.PP
-\f[C]hledger balance cur:\[aq]\[rs]$\[aq]\f[R]
-.PP
-or:
-.PP
-\f[C]hledger balance cur:\[rs]\[rs]$\f[R]
-.SS Even more escaping
-.PP
-When hledger runs an addon executable (eg you type \f[C]hledger ui\f[R],
-hledger runs \f[C]hledger-ui\f[R]), it de-escapes command-line options
-and arguments once, so you might need to \f[I]triple\f[R]-escape.
-Eg in bash, running the ui command and matching the dollar sign,
-it\[aq]s:
-.PP
-\f[C]hledger ui cur:\[aq]\[rs]\[rs]$\[aq]\f[R]
-.PP
-or:
-.PP
-\f[C]hledger ui cur:\[rs]\[rs]\[rs]\[rs]$\f[R]
-.PP
-If you asked why \f[I]four\f[R] slashes above, this may help:
-.PP
-.TS
-tab(@);
-l l.
-T{
-unescaped:
-T}@T{
-\f[C]$\f[R]
-T}
-T{
-escaped:
-T}@T{
-\f[C]\[rs]$\f[R]
-T}
-T{
-double-escaped:
-T}@T{
-\f[C]\[rs]\[rs]$\f[R]
-T}
-T{
-triple-escaped:
-T}@T{
-\f[C]\[rs]\[rs]\[rs]\[rs]$\f[R]
-T}
-.TE
-.PP
-(The number of backslashes in fish shell is left as an exercise for the
-reader.)
-.PP
-You can always avoid the extra escaping for addons by running the addon
-directly:
-.PP
-\f[C]hledger-ui cur:\[rs]\[rs]$\f[R]
-.SS Less escaping
-.PP
-Inside an argument file, or in the search field of hledger-ui or
-hledger-web, or at a GHCI prompt, you need one less level of escaping
-than at the command line.
-And backslashes may work better than quotes.
-Eg:
-.PP
-\f[C]ghci> :main balance cur:\[rs]$\f[R]
-.SS Command line tips
-.PP
-If in doubt, keep things simple:
-.IP \[bu] 2
-write options after the command (\f[C]hledger CMD -OPTIONS ARGS\f[R])
-.IP \[bu] 2
-run add-on executables directly (\f[C]hledger-ui -OPTIONS ARGS\f[R])
-.IP \[bu] 2
-enclose problematic args in single quotes
-.IP \[bu] 2
-if needed, also add a backslash to escape regexp metacharacters
-.PP
-To find out exactly how a command line is being parsed, add
-\f[C]--debug=2\f[R] to troubleshoot.
-.SS Unicode characters
-.PP
-hledger is expected to handle non-ascii characters correctly:
-.IP \[bu] 2
-they should be parsed correctly in input files and on the command line,
-by all hledger tools (add, iadd, hledger-web\[aq]s search/add/edit
-forms, etc.)
-.IP \[bu] 2
-they should be displayed correctly by all hledger tools, and on-screen
-alignment should be preserved.
-.PP
-This requires a well-configured environment.
-Here are some tips:
-.IP \[bu] 2
-A system locale must be configured, and it must be one that can decode
-the characters being used.
-In bash, you can set a locale like this:
-\f[C]export LANG=en_US.UTF-8\f[R].
-There are some more details in Troubleshooting.
-This step is essential - without it, hledger will quit on encountering a
-non-ascii character (as with all GHC-compiled programs).
-.IP \[bu] 2
-your terminal software (eg Terminal.app, iTerm, CMD.exe, xterm..) must
-support unicode
-.IP \[bu] 2
-the terminal must be using a font which includes the required unicode
-glyphs
-.IP \[bu] 2
-the terminal should be configured to display wide characters as double
-width (for report alignment)
-.IP \[bu] 2
-on Windows, for best results you should run hledger in the same kind of
-environment in which it was built.
-Eg hledger built in the standard CMD.EXE environment (like the binaries
-on our download page) might show display problems when run in a cygwin
-or msys terminal, and vice versa.
-(See eg #961).
-.SS Input files
-.PP
-hledger reads transactions from a data file (and the add command writes
-to it).
-By default this file is \f[C]$HOME/.hledger.journal\f[R] (or on Windows,
-something like \f[C]C:/Users/USER/.hledger.journal\f[R]).
-You can override this with the \f[C]$LEDGER_FILE\f[R] environment
-variable:
-.IP
-.nf
-\f[C]
-$ setenv LEDGER_FILE \[ti]/finance/2016.journal
-$ hledger stats
-\f[R]
-.fi
-.PP
-or with the \f[C]-f/--file\f[R] option:
-.IP
-.nf
-\f[C]
-$ hledger -f /some/file stats
-\f[R]
-.fi
-.PP
-The file name \f[C]-\f[R] (hyphen) means standard input:
-.IP
-.nf
-\f[C]
-$ cat some.journal | hledger -f-
-\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:
-.PP
-.TS
-tab(@);
-lw(7.6n) lw(31.2n) lw(31.2n).
-T{
-Reader:
-T}@T{
-Reads:
-T}@T{
-Used for file extensions:
-T}
-_
-T{
-\f[C]journal\f[R]
-T}@T{
-hledger\[aq]s journal format, also some Ledger journals
-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)
-T}@T{
-\f[C].timeclock\f[R]
-T}
-T{
-\f[C]timedot\f[R]
-T}@T{
-timedot files (approximate time logging)
-T}@T{
-\f[C].timedot\f[R]
-T}
-T{
-\f[C]csv\f[R]
-T}@T{
-comma-separated values (data interchange)
-T}@T{
-\f[C].csv\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:
-.IP
-.nf
-\f[C]
-$ hledger -f csv:/some/csv-file.dat stats
-$ echo \[aq]i 2009/13/1 08:00:00\[aq] | hledger print -ftimeclock:-
-\f[R]
-.fi
-.PP
-You can also 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].
-.SS Smart dates
-.PP
-hledger\[aq]s user interfaces accept a flexible \[dq]smart date\[dq]
-syntax (unlike dates in the journal file).
-Smart dates allow some english words, can be relative to today\[aq]s
-date, and can have less-significant date parts omitted (defaulting to
-1).
-.PP
-Examples:
-.PP
-.TS
-tab(@);
-l l.
-T{
-\f[C]2004/10/1\f[R], \f[C]2004-01-01\f[R], \f[C]2004.9.1\f[R]
-T}@T{
-exact date, several separators allowed.
-Year is 4+ digits, month is 1-12, day is 1-31
-T}
-T{
-\f[C]2004\f[R]
-T}@T{
-start of year
-T}
-T{
-\f[C]2004/10\f[R]
-T}@T{
-start of month
-T}
-T{
-\f[C]10/1\f[R]
-T}@T{
-month and day in current year
-T}
-T{
-\f[C]21\f[R]
-T}@T{
-day in current month
-T}
-T{
-\f[C]october, oct\f[R]
-T}@T{
-start of month in current year
-T}
-T{
-\f[C]yesterday, today, tomorrow\f[R]
-T}@T{
--1, 0, 1 days from today
-T}
-T{
-\f[C]last/this/next day/week/month/quarter/year\f[R]
-T}@T{
--1, 0, 1 periods from the current period
-T}
-T{
-\f[C]20181201\f[R]
-T}@T{
-8 digit YYYYMMDD with valid year month and day
-T}
-T{
-\f[C]201812\f[R]
-T}@T{
-6 digit YYYYMM with valid year and month
-T}
-.TE
-.PP
-Counterexamples - malformed digit sequences might give surprising
-results:
-.PP
-.TS
-tab(@);
-l l.
-T{
-\f[C]201813\f[R]
-T}@T{
-6 digits with an invalid month is parsed as start of 6-digit year
-T}
-T{
-\f[C]20181301\f[R]
-T}@T{
-8 digits with an invalid month is parsed as start of 8-digit year
-T}
-T{
-\f[C]20181232\f[R]
-T}@T{
-8 digits with an invalid day gives an error
-T}
-T{
-\f[C]201801012\f[R]
-T}@T{
-9+ digits beginning with a valid YYYYMMDD gives an error
-T}
-.TE
-.SS Report start & end date
-.PP
-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 the journal.
-.PP
-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 \f[C]-b/--begin\f[R],
-\f[C]-e/--end\f[R], \f[C]-p/--period\f[R] or a \f[C]date:\f[R] query
-(described below).
-All of these accept the smart date syntax.
-.PP
-Some notes:
-.IP \[bu] 2
-As in Ledger, end dates are exclusive, so you need to write the date
-\f[I]after\f[R] the last day you want to include.
-.IP \[bu] 2
-As noted in reporting options: among start/end dates specified with
-\f[I]options\f[R], the last (i.e.
-right-most) option takes precedence.
-.IP \[bu] 2
-The effective report start and end dates are the intersection of the
-start/end dates from options and that from \f[C]date:\f[R] queries.
-That is, \f[C]date:2019-01 date:2019 -p\[aq]2000 to 2030\[aq]\f[R]
-yields January 2019, the smallest common time span.
-.PP
-Examples:
-.PP
-.TS
-tab(@);
-l l.
-T{
-\f[C]-b 2016/3/17\f[R]
-T}@T{
-begin on St.
-Patrick\[aq]s day 2016
-T}
-T{
-\f[C]-e 12/1\f[R]
-T}@T{
-end at the start of december 1st of the current year (11/30 will be the
-last date included)
-T}
-T{
-\f[C]-b thismonth\f[R]
-T}@T{
-all transactions on or after the 1st of the current month
-T}
-T{
-\f[C]-p thismonth\f[R]
-T}@T{
-all transactions in the current month
-T}
-T{
-\f[C]date:2016/3/17-\f[R]
-T}@T{
-the above written as queries instead
-T}
-T{
-\f[C]date:-12/1\f[R]
-T}@T{
-T}
-T{
-\f[C]date:thismonth-\f[R]
-T}@T{
-T}
-T{
-\f[C]date:thismonth\f[R]
-T}@T{
-T}
-.TE
-.SS Report intervals
-.PP
-A report interval can be specified so that commands like register,
-balance and activity will divide their reports into multiple subperiods.
-The basic intervals can be selected with one of \f[C]-D/--daily\f[R],
-\f[C]-W/--weekly\f[R], \f[C]-M/--monthly\f[R], \f[C]-Q/--quarterly\f[R],
-or \f[C]-Y/--yearly\f[R].
-More complex intervals may be specified with a period expression.
-Report intervals can not be specified with a query.
-.SS Period expressions
-.PP
-The \f[C]-p/--period\f[R] option accepts period expressions, a shorthand
-way of expressing a start date, end date, and/or report interval all at
-once.
-.PP
-Here\[aq]s a basic period expression specifying the first quarter of
-2009.
-Note, hledger always treats start dates as inclusive and end dates as
-exclusive:
-.PP
-\f[C]-p \[dq]from 2009/1/1 to 2009/4/1\[dq]\f[R]
-.PP
-Keywords like \[dq]from\[dq] and \[dq]to\[dq] are optional, and so are
-the spaces, as long as you don\[aq]t run two dates together.
-\[dq]to\[dq] can also be written as \[dq]-\[dq].
-These are equivalent to the above:
-.PP
-.TS
-tab(@);
-l.
-T{
-\f[C]-p \[dq]2009/1/1 2009/4/1\[dq]\f[R]
-T}
-T{
-\f[C]-p2009/1/1to2009/4/1\f[R]
-T}
-T{
-\f[C]-p2009/1/1-2009/4/1\f[R]
-T}
-.TE
-.PP
-Dates are smart dates, so if the current year is 2009, the above can
-also be written as:
-.PP
-.TS
-tab(@);
-l.
-T{
-\f[C]-p \[dq]1/1 4/1\[dq]\f[R]
-T}
-T{
-\f[C]-p \[dq]january-apr\[dq]\f[R]
-T}
-T{
-\f[C]-p \[dq]this year to 4/1\[dq]\f[R]
-T}
-.TE
-.PP
-If you specify only one date, the missing start or end date will be the
-earliest or latest transaction in your journal:
-.PP
-.TS
-tab(@);
-l l.
-T{
-\f[C]-p \[dq]from 2009/1/1\[dq]\f[R]
-T}@T{
-everything after january 1, 2009
-T}
-T{
-\f[C]-p \[dq]from 2009/1\[dq]\f[R]
-T}@T{
-the same
-T}
-T{
-\f[C]-p \[dq]from 2009\[dq]\f[R]
-T}@T{
-the same
-T}
-T{
-\f[C]-p \[dq]to 2009\[dq]\f[R]
-T}@T{
-everything before january 1, 2009
-T}
-.TE
-.PP
-A single date with no \[dq]from\[dq] or \[dq]to\[dq] defines both the
-start and end date like so:
-.PP
-.TS
-tab(@);
-l r.
-T{
-\f[C]-p \[dq]2009\[dq]\f[R]
-T}@T{
-the year 2009; equivalent to \[dq]2009/1/1 to 2010/1/1\[dq]
-T}
-T{
-\f[C]-p \[dq]2009/1\[dq]\f[R]
-T}@T{
-the month of jan; equivalent to \[dq]2009/1/1 to 2009/2/1\[dq]
-T}
-T{
-\f[C]-p \[dq]2009/1/1\[dq]\f[R]
-T}@T{
-just that day; equivalent to \[dq]2009/1/1 to 2009/1/2\[dq]
-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],
-\f[C]monthly\f[R], \f[C]quarterly\f[R], or \f[C]yearly\f[R], which have
-the same effect as the
-\f[C]-D\f[R],\f[C]-W\f[R],\f[C]-M\f[R],\f[C]-Q\f[R], or \f[C]-Y\f[R]
-flags.
-Between report interval and start/end dates (if any), the word
-\f[C]in\f[R] is optional.
-Examples:
-.PP
-.TS
-tab(@);
-l.
-T{
-\f[C]-p \[dq]weekly from 2009/1/1 to 2009/4/1\[dq]\f[R]
-T}
-T{
-\f[C]-p \[dq]monthly in 2008\[dq]\f[R]
-T}
-T{
-\f[C]-p \[dq]quarterly\[dq]\f[R]
-T}
-.TE
-.PP
-Note that \f[C]weekly\f[R], \f[C]monthly\f[R], \f[C]quarterly\f[R] and
-\f[C]yearly\f[R] intervals will always start on the first day on week,
-month, quarter or year accordingly, and will end on the last day of same
-period, even if associated period expression specifies different
-explicit start and end date.
-.PP
-For example:
-.PP
-.TS
-tab(@);
-l.
-T{
-\f[C]-p \[dq]weekly from 2009/1/1 to 2009/4/1\[dq]\f[R] -- starts on
-2008/12/29, closest preceding Monday
-T}
-T{
-\f[C]-p \[dq]monthly in 2008/11/25\[dq]\f[R] -- starts on 2018/11/01
-T}
-T{
-\f[C]-p \[dq]quarterly from 2009-05-05 to 2009-06-01\[dq]\f[R] - starts
-on 2009/04/01, ends on 2009/06/30, which are first and last days of Q2
-2009
-T}
-T{
-\f[C]-p \[dq]yearly from 2009-12-29\[dq]\f[R] - starts on 2009/01/01,
-first day of 2009
-T}
-.TE
-.PP
-The following more complex report intervals are also supported:
-\f[C]biweekly\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
-All of these will start on the first day of the requested period and end
-on the last one, as described above.
-.PP
-Examples:
-.PP
-.TS
-tab(@);
-l.
-T{
-\f[C]-p \[dq]bimonthly from 2008\[dq]\f[R] -- periods will have
-boundaries on 2008/01/01, 2008/03/01, ...
-T}
-T{
-\f[C]-p \[dq]every 2 weeks\[dq]\f[R] -- starts on closest preceding
-Monday
-T}
-T{
-\f[C]-p \[dq]every 5 month from 2009/03\[dq]\f[R] -- periods will have
-boundaries on 2009/03/01, 2009/08/01, ...
-T}
-.TE
-.PP
-If you want intervals that start on arbitrary day of your choosing and
-span a week, month or year, you need to use any of the following:
-.PP
-\f[C]every Nth day of week\f[R], \f[C]every <weekday>\f[R],
-\f[C]every Nth day [of month]\f[R],
-\f[C]every Nth weekday [of month]\f[R], \f[C]every MM/DD [of year]\f[R],
-\f[C]every Nth MMM [of year]\f[R], \f[C]every MMM Nth [of year]\f[R].
-.PP
-Examples:
-.PP
-.TS
-tab(@);
-l.
-T{
-\f[C]-p \[dq]every 2nd day of week\[dq]\f[R] -- periods will go from Tue
-to Tue
-T}
-T{
-\f[C]-p \[dq]every Tue\[dq]\f[R] -- same
-T}
-T{
-\f[C]-p \[dq]every 15th day\[dq]\f[R] -- period boundaries will be on
-15th of each month
-T}
-T{
-\f[C]-p \[dq]every 2nd Monday\[dq]\f[R] -- period boundaries will be on
-second Monday of each month
-T}
-T{
-\f[C]-p \[dq]every 11/05\[dq]\f[R] -- yearly periods with boundaries on
-5th of Nov
-T}
-T{
-\f[C]-p \[dq]every 5th Nov\[dq]\f[R] -- same
-T}
-T{
-\f[C]-p \[dq]every Nov 5th\[dq]\f[R] -- same
-T}
-.TE
-.PP
-Show historical balances at end of 15th each month (N is exclusive end
-date):
-.PP
-\f[C]hledger balance -H -p \[dq]every 16th day\[dq]\f[R]
-.PP
-Group postings from start of wednesday to end of next tuesday (N is
-start date and exclusive end date):
-.PP
-\f[C]hledger register checking -p \[dq]every 3rd day of week\[dq]\f[R]
-.SS Depth limiting
-.PP
-With the \f[C]--depth N\f[R] option (short form: \f[C]-N\f[R]), commands
-like account, balance and register will show only the uppermost accounts
-in the account tree, down to level N.
-Use this when you want a summary with less detail.
-This flag has the same effect as a \f[C]depth:\f[R] query argument (so
-\f[C]-2\f[R], \f[C]--depth=2\f[R] or \f[C]depth:2\f[R] are basically
-equivalent).
-.SS Pivoting
-.PP
-Normally hledger sums amounts, and organizes them in a hierarchy, based
-on account name.
-The \f[C]--pivot FIELD\f[R] option causes it to sum and organize
-hierarchy based on the value of some other field instead.
-FIELD can be: \f[C]code\f[R], \f[C]description\f[R], \f[C]payee\f[R],
-\f[C]note\f[R], or the full name (case insensitive) of any tag.
-As with account names, values containing \f[C]colon:separated:parts\f[R]
-will be displayed hierarchically in reports.
-.PP
-\f[C]--pivot\f[R] is a general option affecting all reports; you can
-think of hledger transforming the journal before any other processing,
-replacing every posting\[aq]s account name with the value of the
-specified field on that posting, inheriting it from the transaction or
-using a blank value if it\[aq]s not present.
-.PP
-An example:
-.IP
-.nf
-\f[C]
-2016/02/16 Member Fee Payment
-    assets:bank account                    2 EUR
-    income:member fees                    -2 EUR  ; member: John Doe
-\f[R]
-.fi
-.PP
-Normal balance report showing account names:
-.IP
-.nf
-\f[C]
-$ hledger balance
-               2 EUR  assets:bank account
-              -2 EUR  income:member fees
---------------------
-                   0
-\f[R]
-.fi
-.PP
-Pivoted balance report, using member: tag values instead:
-.IP
-.nf
-\f[C]
-$ hledger balance --pivot member
-               2 EUR
-              -2 EUR  John Doe
---------------------
-                   0
-\f[R]
-.fi
-.PP
-One way to show only amounts with a member: value (using a query,
-described below):
-.IP
-.nf
-\f[C]
-$ hledger balance --pivot member tag:member=.
-              -2 EUR  John Doe
---------------------
-              -2 EUR
-\f[R]
-.fi
-.PP
-Another way (the acct: query matches against the pivoted \[dq]account
-name\[dq]):
-.IP
-.nf
-\f[C]
-$ hledger balance --pivot member acct:.
-              -2 EUR  John Doe
---------------------
-              -2 EUR
-\f[R]
-.fi
-.SS Valuation
-.SS -B: Cost
-.PP
-The \f[C]-B/--cost\f[R] flag converts amounts to their cost (or selling
-price) at transaction time, if they have a transaction price specified.
-This flag is equivalent to \f[C]--value=cost\f[R], described below.
-.SS -V: Market value
-.PP
-The \f[C]-V/--market\f[R] flag converts reported amounts to their market
-value in a default valuation commodity, using the market prices in
-effect on a default valuation date.
-For single period reports, the valuation date is today (equivalent to
-\f[C]--value=now\f[R]); for multiperiod reports, it is the last day of
-each subperiod (equivalent to \f[C]--value=end\f[R]).
-.PP
-The default valuation commodity is the one referenced in the latest
-applicable market price dated on or before the valuation date.
-If most of your P declarations lead to a single home currency, this will
-usually be what you want.
-(To specify the commodity, see -X below.)
-.PP
-Note that in hledger, market prices are always declared explicitly with
-P directives; we do not infer them from transaction prices as Ledger
-does.
-.PP
-Here\[aq]s a quick example of -V:
-.IP
-.nf
-\f[C]
-; one euro is worth this many dollars from nov 1
-P 2016/11/01 \[Eu] $1.10
-
-; purchase some euros on nov 3
-2016/11/3
-    assets:euros        \[Eu]100
-    assets:checking
-
-; the euro is worth fewer dollars by dec 21
-P 2016/12/21 \[Eu] $1.03
-\f[R]
-.fi
-.PP
-How many euros do I have ?
-.IP
-.nf
-\f[C]
-$ hledger -f t.j bal -N euros
-                \[Eu]100  assets:euros
-\f[R]
-.fi
-.PP
-What are they worth at end of nov 3 ?
-.IP
-.nf
-\f[C]
-$ hledger -f t.j bal -N euros -V -e 2016/11/4
-             $110.00  assets:euros
-\f[R]
-.fi
-.PP
-What are they worth after 2016/12/21 ?
-(no report end date specified, defaults to today)
-.IP
-.nf
-\f[C]
-$ hledger -f t.j bal -N euros -V
-             $103.00  assets:euros
-\f[R]
-.fi
-.SS -X: Market value in specified commodity
-.PP
-The \f[C]-X/--exchange\f[R] option is like \f[C]-V\f[R], except it
-specifies the target commodity you would like to convert to.
-It is equivalent to \f[C]--value=now,COMM\f[R] or
-\f[C]--value=end,COMM\f[R].
-.SS --value: Flexible valuation
-.PP
-\f[I](experimental, added 201905)\f[R]
-.PP
-\f[C]-B\f[R], \f[C]-V\f[R] and \f[C]-X\f[R] are special cases of the
-more general \f[C]--value\f[R] option:
-.IP
-.nf
-\f[C]
- --value=TYPE[,COMM]  TYPE is cost, end, now or YYYY-MM-DD.
-                      COMM is an optional commodity symbol.
-                      Shows amounts converted to:
-                      - cost commodity using transaction prices (then optionally to COMM using market prices at period end(s))
-                      - default valuation commodity (or COMM) using market prices at period end(s)
-                      - default valuation commodity (or COMM) using current market prices
-                      - default valuation commodity (or COMM) using market prices at some date
-\f[R]
-.fi
-.PP
-The TYPE part basically selects either \[dq]cost\[dq], or \[dq]market
-value\[dq] plus a valuation date:
-.TP
-\f[B]\f[CB]--value=cost\f[B]\f[R]
-Convert amounts to cost, using the prices recorded in transactions.
-.TP
-\f[B]\f[CB]--value=end\f[B]\f[R]
-Convert amounts to their value in a default valuation commodity, using
-market prices on the last day of the report period (or if unspecified,
-the journal\[aq]s end date); or in multiperiod reports, market prices on
-the last day of each subperiod.
-.TP
-\f[B]\f[CB]--value=now\f[B]\f[R]
-Convert amounts to their value in default valuation commodity using
-current market prices (as of when report is generated).
-.TP
-\f[B]\f[CB]--value=YYYY-MM-DD\f[B]\f[R]
-Convert amounts to their value in default valuation commodity using
-market prices on this date.
-.PP
-The default valuation commodity is the commodity mentioned in the most
-recent applicable market price declaration.
-When all your price declarations lead to a single home currency, this
-will usually do what you want.
-.PP
-To select a different valuation commodity, add the optional
-\f[C],COMM\f[R] part: a comma, then the target commodity\[aq]s symbol.
-Eg: \f[B]\f[CB]--value=now,EUR\f[B]\f[R].
-hledger will do its best to convert amounts to this commodity, using:
-.IP \[bu] 2
-declared prices (from source commodity to valuation commodity)
-.IP \[bu] 2
-reverse prices (declared prices from valuation to source commodity,
-inverted)
-.IP \[bu] 2
-indirect prices (prices calculated from the shortest chain of declared
-or reverse prices from source to valuation commodity)
-.PP
-in that order.
-.PP
-Here are some examples showing the effect of \f[C]--value\f[R] as seen
-with \f[C]print\f[R]:
-.IP
-.nf
-\f[C]
-P 2000-01-01 A  1 B
-P 2000-02-01 A  2 B
-P 2000-03-01 A  3 B
-P 2000-04-01 A  4 B
-
-2000-01-01
-  (a)      1 A \[at] 5 B
-
-2000-02-01
-  (a)      1 A \[at] 6 B
-
-2000-03-01
-  (a)      1 A \[at] 7 B
-\f[R]
-.fi
-.PP
-Show the cost of each posting:
-.IP
-.nf
-\f[C]
-$ hledger -f- print --value=cost
-2000/01/01
-    (a)             5 B
-
-2000/02/01
-    (a)             6 B
-
-2000/03/01
-    (a)             7 B
-\f[R]
-.fi
-.PP
-Show the value as of the last day of the report period (2000-02-29):
-.IP
-.nf
-\f[C]
-$ hledger -f- print --value=end date:2000/01-2000/03
-2000-01-01
-    (a)             2 B
-
-2000-02-01
-    (a)             2 B
-\f[R]
-.fi
-.PP
-With no report period specified, that shows the value as of the last day
-of the journal (2000-03-01):
-.IP
-.nf
-\f[C]
-$ hledger -f- print --value=end
-2000/01/01
-    (a)             3 B
-
-2000/02/01
-    (a)             3 B
-
-2000/03/01
-    (a)             3 B
-\f[R]
-.fi
-.PP
-Show the current value (the 2000-04-01 price is still in effect today):
-.IP
-.nf
-\f[C]
-$ hledger -f- print --value=now
-2000-01-01
-    (a)             4 B
-
-2000-02-01
-    (a)             4 B
-
-2000-03-01
-    (a)             4 B
-\f[R]
-.fi
-.PP
-Show the value on 2000/01/15:
-.IP
-.nf
-\f[C]
-$ hledger -f- print --value=2000-01-15
-2000/01/01
-    (a)             1 B
-
-2000/02/01
-    (a)             1 B
-
-2000/03/01
-    (a)             1 B
-\f[R]
-.fi
-.PP
-You may need to explicitly set a commodity\[aq]s display style, when
-reverse prices are used.
-Eg this output might be surprising:
-.IP
-.nf
-\f[C]
-P 2000-01-01 A 2B
-
-2000-01-01
-  a  1B
-  b
-\f[R]
-.fi
-.IP
-.nf
-\f[C]
-$ hledger print -x -X A
-2000/01/01
-    a               0
-    b               0
-\f[R]
-.fi
-.PP
-Explanation: because there\[aq]s no amount or commodity directive
-specifying a display style for A, 0.5A gets the default style, which
-shows no decimal digits.
-Because the displayed amount looks like zero, the commodity symbol and
-minus sign are not displayed either.
-Adding a commodity directive sets a more useful display style for A:
-.IP
-.nf
-\f[C]
-P 2000-01-01 A 2B
-commodity 0.00A
-
-2000-01-01
-  a  1B
-  b
-\f[R]
-.fi
-.IP
-.nf
-\f[C]
-$ hledger print -X A
-2000/01/01
-    a           0.50A
-    b          -0.50A
-\f[R]
-.fi
-.SS Effect of --value on reports
-.PP
-Here is a reference for how \f[C]--value\f[R] currently affects each
-part of hledger\[aq]s reports.
-It\[aq]s work in progress, but may be useful for troubleshooting or
-reporting bugs.
-See also the definitions and notes below.
-If you find problems, please report them, ideally with a reproducible
-example.
-Related: #329, #1083.
-.PP
-.TS
-tab(@);
-lw(14.4n) lw(13.8n) lw(14.6n) lw(15.2n) lw(12.0n).
-T{
-Report type
-T}@T{
-\f[C]-B\f[R], \f[C]--value=cost\f[R]
-T}@T{
-\f[C]-V\f[R], \f[C]-X\f[R]
-T}@T{
-\f[C]--value=end\f[R]
-T}@T{
-\f[C]--value=DATE\f[R], \f[C]--value=now\f[R]
-T}
-_
-T{
-\f[B]print\f[R]
-T}@T{
-T}@T{
-T}@T{
-T}@T{
-T}
-T{
-posting amounts
-T}@T{
-cost
-T}@T{
-value at report end or today
-T}@T{
-value at report or journal end
-T}@T{
-value at DATE/today
-T}
-T{
-balance assertions / assignments
-T}@T{
-unchanged
-T}@T{
-unchanged
-T}@T{
-unchanged
-T}@T{
-unchanged
-T}
-T{
-T}@T{
-T}@T{
-T}@T{
-T}@T{
-T}
-T{
-\f[B]register\f[R]
-T}@T{
-T}@T{
-T}@T{
-T}@T{
-T}
-T{
-starting balance (with -H)
-T}@T{
-cost
-T}@T{
-value at day before report or journal start
-T}@T{
-value at day before report or journal start
-T}@T{
-value at DATE/today
-T}
-T{
-posting amounts (no report interval)
-T}@T{
-cost
-T}@T{
-value at report end or today
-T}@T{
-value at report or journal end
-T}@T{
-value at DATE/today
-T}
-T{
-summary posting amounts (with report interval)
-T}@T{
-summarised cost
-T}@T{
-value at period ends
-T}@T{
-value at period ends
-T}@T{
-value at DATE/today
-T}
-T{
-running total/average
-T}@T{
-sum/average of displayed values
-T}@T{
-sum/average of displayed values
-T}@T{
-sum/average of displayed values
-T}@T{
-sum/average of displayed values
-T}
-T{
-T}@T{
-T}@T{
-T}@T{
-T}@T{
-T}
-T{
-\f[B]balance (bs, bse, cf, is..)\f[R]
-T}@T{
-T}@T{
-T}@T{
-T}@T{
-T}
-T{
-balances (no report interval)
-T}@T{
-sums of costs
-T}@T{
-value at report end or today of sums of postings
-T}@T{
-value at report or journal end of sums of postings
-T}@T{
-value at DATE/today of sums of postings
-T}
-T{
-balances (with report interval)
-T}@T{
-sums of costs
-T}@T{
-value at period ends of sums of postings
-T}@T{
-value at period ends of sums of postings
-T}@T{
-value at DATE/today of sums of postings
-T}
-T{
-starting balances (with report interval and -H)
-T}@T{
-sums of costs of postings before report start
-T}@T{
-sums of postings before report start
-T}@T{
-sums of postings before report start
-T}@T{
-sums of postings before report start
-T}
-T{
-budget amounts with --budget
-T}@T{
-like balances
-T}@T{
-like balances
-T}@T{
-like balances
-T}@T{
-like balances
-T}
-T{
-grand total (no report interval)
-T}@T{
-sum of displayed values
-T}@T{
-sum of displayed values
-T}@T{
-sum of displayed values
-T}@T{
-sum of displayed values
-T}
-T{
-row totals/averages (with report interval)
-T}@T{
-sums/averages of displayed values
-T}@T{
-sums/averages of displayed values
-T}@T{
-sums/averages of displayed values
-T}@T{
-sums/averages of displayed values
-T}
-T{
-column totals
-T}@T{
-sums of displayed values
-T}@T{
-sums of displayed values
-T}@T{
-sums of displayed values
-T}@T{
-sums of displayed values
-T}
-T{
-grand total/average
-T}@T{
-sum/average of column totals
-T}@T{
-sum/average of column totals
-T}@T{
-sum/average of column totals
-T}@T{
-sum/average of column totals
-T}
-T{
-T}@T{
-T}@T{
-T}@T{
-T}@T{
-T}
-.TE
-.PP
-\f[B]Additional notes\f[R]
-.TP
-\f[I]cost\f[R]
-calculated using price(s) recorded in the transaction(s).
-.TP
-\f[I]value\f[R]
-market value using available market price declarations, or the unchanged
-amount if no conversion rate can be found.
-.TP
-\f[I]report start\f[R]
-the first day of the report period specified with -b or -p or date:,
-otherwise today.
-.TP
-\f[I]report or journal start\f[R]
-the first day of the report period specified with -b or -p or date:,
-otherwise the earliest transaction date in the journal, otherwise today.
-.TP
-\f[I]report end\f[R]
-the last day of the report period specified with -e or -p or date:,
-otherwise today.
-.TP
-\f[I]report or journal end\f[R]
-the last day of the report period specified with -e or -p or date:,
-otherwise the latest transaction date in the journal, otherwise today.
-.TP
-\f[I]report interval\f[R]
-a flag (-D/-W/-M/-Q/-Y) or period expression that activates the
-report\[aq]s multi-period mode (whether showing one or many subperiods).
-.SS Combining -B, -V, -X, --value
-.PP
-The rightmost of these flags wins.
-.SS Output destination
-.PP
-Some commands (print, register, stats, the balance commands) can write
-their output to a destination other than the console.
-This is controlled by the \f[C]-o/--output-file\f[R] option.
-.IP
-.nf
-\f[C]
-$ hledger balance -o -     # write to stdout (the default)
-$ hledger balance -o FILE  # write to FILE
-\f[R]
-.fi
-.SS Output format
-.PP
-Some commands can write their output in other formats.
-Eg print and register can output CSV, and the balance commands can
-output CSV or HTML.
-This is controlled by the \f[C]-O/--output-format\f[R] option, or by
-specifying a \f[C].csv\f[R] or \f[C].html\f[R] file extension with
-\f[C]-o/--output-file\f[R].
-.IP
-.nf
-\f[C]
-$ hledger balance -O csv       # write CSV to stdout
-$ hledger balance -o FILE.csv  # write CSV to FILE.csv
-\f[R]
-.fi
-.SS Regular expressions
-.PP
-hledger uses regular expressions in a number of places:
-.IP \[bu] 2
-query terms, on the command line and in the hledger-web search form:
-\f[C]REGEX\f[R], \f[C]desc:REGEX\f[R], \f[C]cur:REGEX\f[R],
-\f[C]tag:...=REGEX\f[R]
-.IP \[bu] 2
-CSV rules conditional blocks: \f[C]if REGEX ...\f[R]
-.IP \[bu] 2
-account alias directives and options:
-\f[C]alias /REGEX/ = REPLACEMENT\f[R],
-\f[C]--alias /REGEX/=REPLACEMENT\f[R]
-.PP
-hledger\[aq]s regular expressions come from the regex-tdfa library.
-In general they:
-.IP \[bu] 2
-are case insensitive
-.IP \[bu] 2
-are infix matching (do not need to match the entire thing being matched)
-.IP \[bu] 2
-are POSIX extended regular expressions
-.IP \[bu] 2
-also support GNU word boundaries (\[rs]<, \[rs]>, \[rs]b, \[rs]B)
-.IP \[bu] 2
-and parenthesised capturing groups and numeric backreferences in
-replacement strings
-.IP \[bu] 2
-do not support mode modifiers like (?s)
-.PP
-Some things to note:
-.IP \[bu] 2
-In the \f[C]alias\f[R] directive and \f[C]--alias\f[R] option, regular
-expressions must be enclosed in forward slashes (\f[C]/REGEX/\f[R]).
-Elsewhere in hledger, these are not required.
-.IP \[bu] 2
-In queries, to match a regular expression metacharacter like \f[C]$\f[R]
-as a literal character, prepend a backslash.
-Eg to search for amounts with the dollar sign in hledger-web, write
-\f[C]cur:\[rs]$\f[R].
-.IP \[bu] 2
-On the command line, some metacharacters like \f[C]$\f[R] have a special
-meaning to the shell and so must be escaped at least once more.
-See Special characters.
-.SH QUERIES
-.PP
-One of hledger\[aq]s strengths is being able to quickly report on
-precise subsets of your data.
-Most commands accept an optional query expression, written as arguments
-after the command name, to filter the data by date, account name or
-other criteria.
-The syntax is similar to a web search: one or more space-separated
-search terms, quotes to enclose whitespace, prefixes to match specific
-fields, a not: prefix to negate the match.
-.PP
-We do not yet support arbitrary boolean combinations of search terms;
-instead most commands show transactions/postings/accounts which match
-(or negatively match):
-.IP \[bu] 2
-any of the description terms AND
-.IP \[bu] 2
-any of the account terms AND
-.IP \[bu] 2
-any of the status terms AND
-.IP \[bu] 2
-all the other terms.
-.PP
-The print command instead shows transactions which:
-.IP \[bu] 2
-match any of the description terms AND
-.IP \[bu] 2
-have any postings matching any of the positive account terms AND
-.IP \[bu] 2
-have no postings matching any of the negative account terms AND
-.IP \[bu] 2
-match all the other terms.
-.PP
-The following kinds of search terms can be used.
-Remember these can also be prefixed with \f[B]\f[CB]not:\f[B]\f[R], eg
-to exclude a particular subaccount.
-.TP
-\f[B]\f[R]\f[C]REGEX\f[R]\f[B], \f[R]\f[C]acct:REGEX\f[R]\f[B]\f[R]
-match account names by this regular expression.
-(With no prefix, \f[C]acct:\f[R] is assumed.)
-same as above
-.TP
-\f[B]\f[R]\f[C]amt:N, amt:<N, amt:<=N, amt:>N, amt:>=N\f[R]\f[B]\f[R]
-match postings with a single-commodity amount that is equal to, less
-than, or greater than N.
-(Multi-commodity amounts are not tested, and will always match.) The
-comparison has two modes: if N is preceded by a + or - sign (or is 0),
-the two signed numbers are compared.
-Otherwise, the absolute magnitudes are compared, ignoring sign.
-.TP
-\f[B]\f[R]\f[C]code:REGEX\f[R]\f[B]\f[R]
-match by transaction code (eg check number)
-.TP
-\f[B]\f[R]\f[C]cur:REGEX\f[R]\f[B]\f[R]
-match postings or transactions including any amounts whose
-currency/commodity symbol is fully matched by REGEX.
-(For a partial match, use \f[C].*REGEX.*\f[R]).
-Note, to match characters which are regex-significant, like the dollar
-sign (\f[C]$\f[R]), you need to prepend \f[C]\[rs]\f[R].
-And when using the command line you need to add one more level of
-quoting to hide it from the shell, so eg do:
-\f[C]hledger print cur:\[aq]\[rs]$\[aq]\f[R] or
-\f[C]hledger print cur:\[rs]\[rs]$\f[R].
-.TP
-\f[B]\f[R]\f[C]desc:REGEX\f[R]\f[B]\f[R]
-match transaction descriptions.
-.TP
-\f[B]\f[R]\f[C]date:PERIODEXPR\f[R]\f[B]\f[R]
-match dates within the specified period.
-PERIODEXPR is a period expression (with no report interval).
-Examples: \f[C]date:2016\f[R], \f[C]date:thismonth\f[R],
-\f[C]date:2000/2/1-2/15\f[R], \f[C]date:lastweek-\f[R].
-If the \f[C]--date2\f[R] command line flag is present, this matches
-secondary dates instead.
-.TP
-\f[B]\f[R]\f[C]date2:PERIODEXPR\f[R]\f[B]\f[R]
-match secondary dates within the specified period.
-.TP
-\f[B]\f[R]\f[C]depth:N\f[R]\f[B]\f[R]
-match (or display, depending on command) accounts at or above this depth
-.TP
-\f[B]\f[R]\f[C]note:REGEX\f[R]\f[B]\f[R]
-match transaction notes (part of description right of \f[C]|\f[R], or
-whole description when there\[aq]s no \f[C]|\f[R])
-.TP
-\f[B]\f[R]\f[C]payee:REGEX\f[R]\f[B]\f[R]
-match transaction payee/payer names (part of description left of
-\f[C]|\f[R], or whole description when there\[aq]s no \f[C]|\f[R])
-.TP
-\f[B]\f[R]\f[C]real:, real:0\f[R]\f[B]\f[R]
-match real or virtual postings respectively
-.TP
-\f[B]\f[R]\f[C]status:, status:!, status:*\f[R]\f[B]\f[R]
-match unmarked, pending, or cleared transactions respectively
-.TP
-\f[B]\f[R]\f[C]tag:REGEX[=REGEX]\f[R]\f[B]\f[R]
-match by tag name, and optionally also by tag value.
-Note a tag: query is considered to match a transaction if it matches any
-of the postings.
-Also remember that postings inherit the tags of their parent
-transaction.
-.PP
-The following special search term is used automatically in hledger-web,
-only:
-.TP
-\f[B]\f[R]\f[C]inacct:ACCTNAME\f[R]\f[B]\f[R]
-tells hledger-web to show the transaction register for this account.
-Can be filtered further with \f[C]acct\f[R] etc.
-.PP
-Some of these can also be expressed as command-line options (eg
-\f[C]depth:2\f[R] is equivalent to \f[C]--depth 2\f[R]).
-Generally you can mix options and query arguments, and the resulting
-query will be their intersection (perhaps excluding the
-\f[C]-p/--period\f[R] option).
-.SH COMMANDS
-.PP
-hledger provides a number of subcommands; \f[C]hledger\f[R] with no
-arguments shows a list.
-.PP
-If you install additional \f[C]hledger-*\f[R] packages, or if you put
-programs or scripts named \f[C]hledger-NAME\f[R] in your PATH, these
-will also be listed as subcommands.
-.PP
-Run a subcommand by writing its name as first argument (eg
-\f[C]hledger incomestatement\f[R]).
-You can also write one of the standard short aliases displayed in
-parentheses in the command list (\f[C]hledger b\f[R]), or any any
-unambiguous prefix of a command name (\f[C]hledger inc\f[R]).
-.PP
-Here are all the builtin commands in alphabetical order.
-See also \f[C]hledger\f[R] for a more organised command list, and
-\f[C]hledger CMD -h\f[R] for detailed command help.
-.SS accounts
-.PP
-accounts, a
-.PD 0
-.P
-.PD
-Show account names.
-.PP
-This command lists account names, either declared with account
-directives (--declared), posted to (--used), or both (the default).
-With query arguments, only matched account names and account names
-referenced by matched postings are shown.
-It shows a flat list by default.
-With \f[C]--tree\f[R], it uses indentation to show the account
-hierarchy.
-In flat mode you can add \f[C]--drop N\f[R] to omit the first few
-account name components.
-Account names can be depth-clipped with \f[C]depth:N\f[R] or
-\f[C]--depth N\f[R] or \f[C]-N\f[R].
-.PP
-Examples:
-.IP
-.nf
-\f[C]
-$ hledger accounts
-assets:bank:checking
-assets:bank:saving
-assets:cash
-expenses:food
-expenses:supplies
-income:gifts
-income:salary
-liabilities:debts
-\f[R]
-.fi
-.SS activity
-.PP
-activity
-.PD 0
-.P
-.PD
-Show an ascii barchart of posting counts per interval.
-.PP
-The activity command displays an ascii histogram showing transaction
-counts by day, week, month or other reporting interval (by day is the
-default).
-With query arguments, it counts only matched transactions.
-.PP
-Examples:
-.IP
-.nf
-\f[C]
-$ hledger activity --quarterly
-2008-01-01 **
-2008-04-01 *******
-2008-07-01 
-2008-10-01 **
-\f[R]
-.fi
-.SS add
-.PP
-add
-.PD 0
-.P
-.PD
-Prompt for transactions and add them to the journal.
-.PP
-Many hledger users edit their journals directly with a text editor, or
-generate them from CSV.
-For more interactive data entry, there is the \f[C]add\f[R] command,
-which prompts interactively on the console for new transactions, and
-appends them to the journal file (if there are multiple
-\f[C]-f FILE\f[R] options, the first file is used.) Existing
-transactions are not changed.
-This is the only hledger command that writes to the journal file.
-.PP
-To use it, just run \f[C]hledger add\f[R] and follow the prompts.
-You can add as many transactions as you like; when you are finished,
-enter \f[C].\f[R] or press control-d or control-c to exit.
-.PP
-Features:
-.IP \[bu] 2
-add tries to provide useful defaults, using the most similar (by
-description) recent transaction (filtered by the query, if any) as a
-template.
-.IP \[bu] 2
-You can also set the initial defaults with command line arguments.
-.IP \[bu] 2
-Readline-style edit keys can be used during data entry.
-.IP \[bu] 2
-The tab key will auto-complete whenever possible - accounts,
-descriptions, dates (\f[C]yesterday\f[R], \f[C]today\f[R],
-\f[C]tomorrow\f[R]).
-If the input area is empty, it will insert the default value.
-.IP \[bu] 2
-If the journal defines a default commodity, it will be added to any bare
-numbers entered.
-.IP \[bu] 2
-A parenthesised transaction code may be entered following a date.
-.IP \[bu] 2
-Comments and tags may be entered following a description or amount.
-.IP \[bu] 2
-If you make a mistake, enter \f[C]<\f[R] at any prompt to restart the
-transaction.
-.IP \[bu] 2
-Input prompts are displayed in a different colour when the terminal
-supports it.
-.PP
-Example (see the tutorial for a detailed explanation):
-.IP
-.nf
-\f[C]
-$ hledger add
-Adding transactions to journal file /src/hledger/examples/sample.journal
-Any command line arguments will be used as defaults.
-Use tab key to complete, readline keys to edit, enter to accept defaults.
-An optional (CODE) may follow transaction dates.
-An optional ; COMMENT may follow descriptions or amounts.
-If you make a mistake, enter < at any prompt to restart the transaction.
-To end a transaction, enter . when prompted.
-To quit, enter . at a date prompt or press control-d or control-c.
-Date [2015/05/22]: 
-Description: supermarket
-Account 1: expenses:food
-Amount  1: $10
-Account 2: assets:checking
-Amount  2 [$-10.0]: 
-Account 3 (or . or enter to finish this transaction): .
-2015/05/22 supermarket
-    expenses:food             $10
-    assets:checking        $-10.0
-
-Save this transaction to the journal ? [y]: 
-Saved.
-Starting the next transaction (. or ctrl-D/ctrl-C to quit)
-Date [2015/05/22]: <CTRL-D> $
-\f[R]
-.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).
-.SS balance
-.PP
-balance, bal, b
-.PD 0
-.P
-.PD
-Show accounts and their balances.
-.PP
-The balance command is hledger\[aq]s most versatile command.
-Note, despite the name, it is not always used for showing real-world
-account balances; the more accounting-aware balancesheet and
-incomestatement may be more convenient for that.
-.PP
-By default, it displays all accounts, and each account\[aq]s change in
-balance during the entire period of the journal.
-Balance changes are calculated by adding up the postings in each
-account.
-You can limit the postings matched, by a query, to see fewer accounts,
-changes over a different time period, changes from only cleared
-transactions, etc.
-.PP
-If you include an account\[aq]s complete history of postings in the
-report, the balance change is equivalent to the account\[aq]s current
-ending balance.
-For a real-world account, typically you won\[aq]t have all transactions
-in the journal; instead you\[aq]ll have all transactions after a certain
-date, and an \[dq]opening balances\[dq] transaction setting the correct
-starting balance on that date.
-Then the balance command will show real-world account balances.
-In some cases the -H/--historical flag is used to ensure this (more
-below).
-.PP
-The balance command can produce several styles of report:
-.SS Classic balance report
-.PP
-This is the original balance report, as found in Ledger.
-It usually looks like this:
-.IP
-.nf
-\f[C]
-$ hledger balance
-                 $-1  assets
-                  $1    bank:saving
-                 $-2    cash
-                  $2  expenses
-                  $1    food
-                  $1    supplies
-                 $-2  income
-                 $-1    gifts
-                 $-1    salary
-                  $1  liabilities:debts
---------------------
-                   0
-\f[R]
-.fi
-.PP
-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 \f[C]-S/--sort-amount\f[R], by their balance amount.
-.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
-compact output.
-(Eg above, the \[dq]liabilities\[dq] account.) Use \f[C]--no-elide\f[R]
-to prevent this.
-.PP
-Account balances are \[dq]inclusive\[dq] - they include the balances of
-any subaccounts.
-.PP
-Accounts which have zero balance (and no non-zero subaccounts) are
-omitted.
-Use \f[C]-E/--empty\f[R] to show them.
-.PP
-A final total is displayed by default; use \f[C]-N/--no-total\f[R] to
-suppress it, eg:
-.IP
-.nf
-\f[C]
-$ hledger balance -p 2008/6 expenses --no-total
-                  $2  expenses
-                  $1    food
-                  $1    supplies
-\f[R]
-.fi
-.SS Customising the classic balance report
-.PP
-You can customise the layout of classic balance reports with
-\f[C]--format FMT\f[R]:
-.IP
-.nf
-\f[C]
-$ hledger balance --format \[dq]%20(account) %12(total)\[dq]
-              assets          $-1
-         bank:saving           $1
-                cash          $-2
-            expenses           $2
-                food           $1
-            supplies           $1
-              income          $-2
-               gifts          $-1
-              salary          $-1
-   liabilities:debts           $1
----------------------------------
-                                0
-\f[R]
-.fi
-.PP
-The FMT format string (plus a newline) specifies the formatting applied
-to each account/balance pair.
-It may contain any suitable text, with data fields interpolated like so:
-.PP
-\f[C]%[MIN][.MAX](FIELDNAME)\f[R]
-.IP \[bu] 2
-MIN pads with spaces to at least this width (optional)
-.IP \[bu] 2
-MAX truncates at this width (optional)
-.IP \[bu] 2
-FIELDNAME must be enclosed in parentheses, and can be one of:
-.RS 2
-.IP \[bu] 2
-\f[C]depth_spacer\f[R] - a number of spaces equal to the account\[aq]s
-depth, or if MIN is specified, MIN * depth spaces.
-.IP \[bu] 2
-\f[C]account\f[R] - the account\[aq]s name
-.IP \[bu] 2
-\f[C]total\f[R] - the account\[aq]s balance/posted total, right
-justified
-.RE
-.PP
-Also, FMT can begin with an optional prefix to control how
-multi-commodity amounts are rendered:
-.IP \[bu] 2
-\f[C]%_\f[R] - render on multiple lines, bottom-aligned (the default)
-.IP \[bu] 2
-\f[C]%\[ha]\f[R] - render on multiple lines, top-aligned
-.IP \[bu] 2
-\f[C]%,\f[R] - render on one line, comma-separated
-.PP
-There are some quirks.
-Eg in one-line mode, \f[C]%(depth_spacer)\f[R] has no effect, instead
-\f[C]%(account)\f[R] has indentation built in.
-Experimentation may be needed to get pleasing results.
-.PP
-Some example formats:
-.IP \[bu] 2
-\f[C]%(total)\f[R] - the account\[aq]s total
-.IP \[bu] 2
-\f[C]%-20.20(account)\f[R] - the account\[aq]s name, left justified,
-padded to 20 characters and clipped at 20 characters
-.IP \[bu] 2
-\f[C]%,%-50(account)  %25(total)\f[R] - account name padded to 50
-characters, total padded to 20 characters, with multiple commodities
-rendered on one line
-.IP \[bu] 2
-\f[C]%20(total)  %2(depth_spacer)%-(account)\f[R] - the default format
-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
-.SS Flat mode
-.PP
-To see a flat list instead of the default hierarchical display, use
-\f[C]--flat\f[R].
-In this mode, accounts (unless depth-clipped) show their full names and
-\[dq]exclusive\[dq] balance, excluding any subaccount balances.
-In this mode, you can also use \f[C]--drop N\f[R] to omit the first few
-account name components.
-.IP
-.nf
-\f[C]
-$ hledger balance -p 2008/6 expenses -N --flat --drop 1
-                  $1  food
-                  $1  supplies
-\f[R]
-.fi
-.SS Depth limited balance reports
-.PP
-With \f[C]--depth N\f[R] or \f[C]depth:N\f[R] or just \f[C]-N\f[R],
-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.
-.IP
-.nf
-\f[C]
-$ hledger balance -N -1
-                 $-1  assets
-                  $2  expenses
-                 $-2  income
-                  $1  liabilities
-\f[R]
-.fi
-.PP
-Flat-mode balance reports, which normally show exclusive balances, show
-inclusive balances at the depth limit.
-.SS Percentages
-.PP
-With \f[C]-%\f[R] or \f[C]--percent\f[R], balance reports show each
-account\[aq]s value expressed as a percentage of the column\[aq]s total.
-This is useful to get an overview of the relative sizes of account
-balances.
-For example to obtain an overview of expenses:
-.IP
-.nf
-\f[C]
-$ hledger balance expenses -%
-             100.0 %  expenses
-              50.0 %    food
-              50.0 %    supplies
---------------------
-             100.0 %
-\f[R]
-.fi
-.PP
-Note that \f[C]--tree\f[R] does not have an effect on \f[C]-%\f[R].
-The percentages are always relative to the total sum of each column,
-they are never relative to the parent account.
-.PP
-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
-\f[C]hledger balance -B\f[R]) all percentage values will be zero.
-.PP
-This flag does not work if the report contains any mixed commodity
-accounts.
-If there are mixed commodity accounts in the report be sure to use
-\f[C]-V\f[R] or \f[C]-B\f[R] to coerce the report into using a single
-commodity.
-.SS Multicolumn balance report
-.PP
-Multicolumn or tabular balance reports are a very useful hledger
-feature, and usually the preferred style.
-They share many of the above features, but they show the report as a
-table, with columns representing time periods.
-This mode is activated by providing a reporting interval.
-.PP
-There are three types of multicolumn balance report, showing different
-information:
-.IP "1." 3
-By default: each column shows the sum of postings in that period, ie the
-account\[aq]s change of balance in that period.
-This is useful eg for a monthly income statement:
-.RS 4
-.IP
-.nf
-\f[C]
-$ hledger balance --quarterly income expenses -E
-Balance changes in 2008:
-
-                   ||  2008q1  2008q2  2008q3  2008q4 
-===================++=================================
- expenses:food     ||       0      $1       0       0 
- expenses:supplies ||       0      $1       0       0 
- income:gifts      ||       0     $-1       0       0 
- income:salary     ||     $-1       0       0       0 
--------------------++---------------------------------
-                   ||     $-1      $1       0       0 
-\f[R]
-.fi
-.RE
-.IP "2." 3
-With \f[C]--cumulative\f[R]: each column shows the ending balance for
-that period, accumulating the changes across periods, starting from 0 at
-the report start date:
-.RS 4
-.IP
-.nf
-\f[C]
-$ hledger balance --quarterly income expenses -E --cumulative
-Ending balances (cumulative) in 2008:
-
-                   ||  2008/03/31  2008/06/30  2008/09/30  2008/12/31 
-===================++=================================================
- expenses:food     ||           0          $1          $1          $1 
- expenses:supplies ||           0          $1          $1          $1 
- income:gifts      ||           0         $-1         $-1         $-1 
- income:salary     ||         $-1         $-1         $-1         $-1 
--------------------++-------------------------------------------------
-                   ||         $-1           0           0           0 
-\f[R]
-.fi
-.RE
-.IP "3." 3
-With \f[C]--historical/-H\f[R]: 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 useful eg for a multi-period balance sheet, and when you are
-showing only the data after a certain start date:
-.RS 4
-.IP
-.nf
-\f[C]
-$ hledger balance \[ha]assets \[ha]liabilities --quarterly --historical --begin 2008/4/1
-Ending balances (historical) in 2008/04/01-2008/12/31:
-
-                      ||  2008/06/30  2008/09/30  2008/12/31 
-======================++=====================================
- assets:bank:checking ||          $1          $1           0 
- assets:bank:saving   ||          $1          $1          $1 
- assets:cash          ||         $-2         $-2         $-2 
- liabilities:debts    ||           0           0          $1 
-----------------------++-------------------------------------
-                      ||           0           0           0 
-\f[R]
-.fi
-.RE
-.PP
-Note that \f[C]--cumulative\f[R] or \f[C]--historical/-H\f[R] disable
-\f[C]--row-total/-T\f[R], since summing end balances generally does not
-make sense.
-.PP
-Multicolumn balance reports display accounts in flat mode by default; to
-see the hierarchy, use \f[C]--tree\f[R].
-.PP
-With a reporting interval (like \f[C]--quarterly\f[R] 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 periods will be \[dq]full\[dq] and
-comparable to the others.
-.PP
-The \f[C]-E/--empty\f[R] flag does two things in multicolumn balance
-reports: first, the report will show all columns within the specified
-report period (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).
-.PP
-The \f[C]-T/--row-total\f[R] flag adds an additional column showing the
-total for each row.
-.PP
-The \f[C]-A/--average\f[R] flag adds a column showing the average value
-in each row.
-.PP
-Here\[aq]s an example of all three:
-.IP
-.nf
-\f[C]
-$ hledger balance -Q income expenses --tree -ETA
-Balance changes in 2008:
-
-            ||  2008q1  2008q2  2008q3  2008q4    Total  Average 
-============++===================================================
- expenses   ||       0      $2       0       0       $2       $1 
-   food     ||       0      $1       0       0       $1        0 
-   supplies ||       0      $1       0       0       $1        0 
- income     ||     $-1     $-1       0       0      $-2      $-1 
-   gifts    ||       0     $-1       0       0      $-1        0 
-   salary   ||     $-1       0       0       0      $-1        0 
-------------++---------------------------------------------------
-            ||     $-1      $1       0       0        0        0 
-
-# Average is rounded to the dollar here since all journal amounts are
-\f[R]
-.fi
-.PP
-Limitations:
-.PP
-In multicolumn reports the \f[C]-V/--value\f[R] flag uses the market
-price on the report end date, for all columns (not the price on each
-column\[aq]s end date).
-.PP
-Eliding of boring parent accounts in tree mode, as in the classic
-balance report, is not yet supported in multicolumn reports.
-.SS Budget report
-.PP
-With \f[C]--budget\f[R], 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 income, expenses,
-time usage, etc.
---budget is most often combined with a report interval.
-.PP
-For example, you can take average monthly expenses in the common expense
-categories to construct a minimal monthly budget:
-.IP
-.nf
-\f[C]
-;; Budget
-\[ti] monthly
-  income  $2000
-  expenses:food    $400
-  expenses:bus     $50
-  expenses:movies  $30
-  assets:bank:checking
-
-;; Two months worth of expenses
-2017-11-01
-  income  $1950
-  expenses:food    $396
-  expenses:bus     $49
-  expenses:movies  $30
-  expenses:supplies  $20
-  assets:bank:checking
-
-2017-12-01
-  income  $2100
-  expenses:food    $412
-  expenses:bus     $53
-  expenses:gifts   $100
-  assets:bank:checking
-\f[R]
-.fi
-.PP
-You can now see a monthly budget report:
-.IP
-.nf
-\f[C]
-$ hledger balance -M --budget
-Budget performance in 2017/11/01-2017/12/31:
-
-                      ||                      Nov                       Dec 
-======================++====================================================
- assets               || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
- assets:bank          || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
- assets:bank:checking || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
- expenses             ||   $495 [ 103% of   $480]    $565 [ 118% of   $480] 
- expenses:bus         ||    $49 [  98% of    $50]     $53 [ 106% of    $50] 
- expenses:food        ||   $396 [  99% of   $400]    $412 [ 103% of   $400] 
- expenses:movies      ||    $30 [ 100% of    $30]       0 [   0% of    $30] 
- income               ||  $1950 [  98% of  $2000]   $2100 [ 105% of  $2000] 
-----------------------++----------------------------------------------------
-                      ||      0 [              0]       0 [              0] 
-\f[R]
-.fi
-.PP
-Note this is different from a normal balance report in several ways:
-.IP \[bu] 2
-Only accounts with budget goals during the report period are shown, by
-default.
-.IP \[bu] 2
-In each column, in square brackets after the actual amount, budgeted
-amounts are shown, along with the percentage of budget used.
-.IP \[bu] 2
-All parent accounts are always shown, even in flat mode.
-Eg assets, assets:bank, and expenses above.
-.IP \[bu] 2
-Amounts always include all subaccounts, budgeted or unbudgeted, even in
-flat mode.
-.PP
-This means that the numbers displayed will not always add up! Eg above,
-the \f[C]expenses\f[R] actual amount includes the gifts and supplies
-transactions, but the \f[C]expenses:gifts\f[R] and
-\f[C]expenses:supplies\f[R] accounts are not shown, as they have no
-budget amounts declared.
-.PP
-This can be confusing.
-When you need to make things clearer, use the \f[C]-E/--empty\f[R] flag,
-which will reveal all accounts including unbudgeted ones, giving the
-full picture.
-Eg:
-.IP
-.nf
-\f[C]
-$ hledger balance -M --budget --empty
-Budget performance in 2017/11/01-2017/12/31:
-
-                      ||                      Nov                       Dec 
-======================++====================================================
- assets               || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
- assets:bank          || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
- assets:bank:checking || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
- expenses             ||   $495 [ 103% of   $480]    $565 [ 118% of   $480] 
- expenses:bus         ||    $49 [  98% of    $50]     $53 [ 106% of    $50] 
- expenses:food        ||   $396 [  99% of   $400]    $412 [ 103% of   $400] 
- expenses:gifts       ||      0                      $100                   
- expenses:movies      ||    $30 [ 100% of    $30]       0 [   0% of    $30] 
- expenses:supplies    ||    $20                         0                   
- income               ||  $1950 [  98% of  $2000]   $2100 [ 105% of  $2000] 
-----------------------++----------------------------------------------------
-                      ||      0 [              0]       0 [              0] 
-\f[R]
-.fi
-.PP
-You can roll over unspent budgets to next period with
-\f[C]--cumulative\f[R]:
-.IP
-.nf
-\f[C]
-$ hledger balance -M --budget --cumulative
-Budget performance in 2017/11/01-2017/12/31:
-
-                      ||                      Nov                       Dec 
-======================++====================================================
- assets               || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960] 
- assets:bank          || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960] 
- assets:bank:checking || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960] 
- expenses             ||   $495 [ 103% of   $480]   $1060 [ 110% of   $960] 
- expenses:bus         ||    $49 [  98% of    $50]    $102 [ 102% of   $100] 
- expenses:food        ||   $396 [  99% of   $400]    $808 [ 101% of   $800] 
- expenses:movies      ||    $30 [ 100% of    $30]     $30 [  50% of    $60] 
- income               ||  $1950 [  98% of  $2000]   $4050 [ 101% of  $4000] 
-----------------------++----------------------------------------------------
-                      ||      0 [              0]       0 [              0] 
-\f[R]
-.fi
-.PP
-For more examples, see Budgeting and Forecasting.
-.SS Nested budgets
-.PP
-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 budget(s) of the child account(s) would be added to the budget of
-their parent, much like account balances behave.
-.PP
-In the most simple case this means that once you add a budget to any
-account, all its parents would have budget as well.
-.PP
-To illustrate this, consider the following budget:
-.IP
-.nf
-\f[C]
-\[ti] monthly from 2019/01
-    expenses:personal             $1,000.00
-    expenses:personal:electronics    $100.00
-    liabilities
-\f[R]
-.fi
-.PP
-With this, monthly budget for electronics is defined to be $100 and
-budget for personal expenses is an additional $1000, which implicity
-means that budget for both \f[C]expenses:personal\f[R] and
-\f[C]expenses\f[R] is $1100.
-.PP
-Transactions in \f[C]expenses:personal:electronics\f[R] will be counted
-both towards its $100 budget and $1100 of \f[C]expenses:personal\f[R] ,
-and transactions in any other subaccount of \f[C]expenses:personal\f[R]
-would be counted towards only towards the budget of
-\f[C]expenses:personal\f[R].
-.PP
-For example, let\[aq]s consider these transactions:
-.IP
-.nf
-\f[C]
-\[ti] monthly from 2019/01
-    expenses:personal             $1,000.00
-    expenses:personal:electronics    $100.00
-    liabilities
-
-2019/01/01 Google home hub
-    expenses:personal:electronics          $90.00
-    liabilities                           $-90.00
-
-2019/01/02 Phone screen protector
-    expenses:personal:electronics:upgrades          $10.00
-    liabilities
-
-2019/01/02 Weekly train ticket
-    expenses:personal:train tickets       $153.00
-    liabilities
-
-2019/01/03 Flowers
-    expenses:personal          $30.00
-    liabilities
-\f[R]
-.fi
-.PP
-As you can see, we have transactions in
-\f[C]expenses:personal:electronics:upgrades\f[R] and
-\f[C]expenses:personal:train tickets\f[R], and since both of these
-accounts are without explicitly defined budget, these transactions would
-be counted towards budgets of \f[C]expenses:personal:electronics\f[R]
-and \f[C]expenses:personal\f[R] accordingly:
-.IP
-.nf
-\f[C]
-$ hledger balance --budget -M
-Budget performance in 2019/01:
-
-                               ||                           Jan 
-===============================++===============================
- expenses                      ||  $283.00 [  26% of  $1100.00] 
- expenses:personal             ||  $283.00 [  26% of  $1100.00] 
- expenses:personal:electronics ||  $100.00 [ 100% of   $100.00] 
- liabilities                   || $-283.00 [  26% of $-1100.00] 
--------------------------------++-------------------------------
-                               ||        0 [                 0] 
-\f[R]
-.fi
-.PP
-And with \f[C]--empty\f[R], we can get a better picture of budget
-allocation and consumption:
-.IP
-.nf
-\f[C]
-$ hledger balance --budget -M --empty
-Budget performance in 2019/01:
-
-                                        ||                           Jan 
-========================================++===============================
- expenses                               ||  $283.00 [  26% of  $1100.00] 
- expenses:personal                      ||  $283.00 [  26% of  $1100.00] 
- expenses:personal:electronics          ||  $100.00 [ 100% of   $100.00] 
- expenses:personal:electronics:upgrades ||   $10.00                      
- expenses:personal:train tickets        ||  $153.00                      
- liabilities                            || $-283.00 [  26% of $-1100.00] 
-----------------------------------------++-------------------------------
-                                        ||        0 [                 0] 
-\f[R]
-.fi
-.SS Output format
-.PP
-The balance command supports output destination and output format
-selection.
-.SS balancesheet
-.PP
-balancesheet, bs
-.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).
-.PP
-Note this report shows all account balances with normal positive sign
-(like conventional financial statements, unlike balance/print/register)
-(experimental).
-.PP
-Example:
-.IP
-.nf
-\f[C]
-$ hledger balancesheet
-Balance Sheet
-
-Assets:
-                 $-1  assets
-                  $1    bank:saving
-                 $-2    cash
---------------------
-                 $-1
-
-Liabilities:
-                  $1  liabilities:debts
---------------------
-                  $1
-
-Total:
---------------------
-                   0
-\f[R]
-.fi
-.PP
-With a reporting interval, multiple columns will be shown, one for each
-report period.
-As with multicolumn balance reports, you can alter the report mode with
-\f[C]--change\f[R]/\f[C]--cumulative\f[R]/\f[C]--historical\f[R].
-Normally balancesheet shows historical ending balances, which is what
-you need for a balance sheet; note this means it ignores report begin
-dates (and \f[C]-T/--row-total\f[R], since summing end balances
-generally does not make sense).
-Instead of absolute values percentages can be displayed with
-\f[C]-%\f[R].
-.PP
-This command also supports output destination and output format
-selection.
-.SS balancesheetequity
-.PP
-balancesheetequity, bse
-.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).
-.PP
-Example:
-.IP
-.nf
-\f[C]
-$ hledger balancesheetequity
-Balance Sheet With Equity
-
-Assets:
-                 $-2  assets
-                  $1    bank:saving
-                 $-3    cash
---------------------
-                 $-2
-
-Liabilities:
-                  $1  liabilities:debts
---------------------
-                  $1
-
-Equity:
-          $1  equity:owner
---------------------
-          $1
-
-Total:
---------------------
-                   0
-\f[R]
-.fi
-.SS cashflow
-.PP
-cashflow, cf
-.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).
-.PP
-Example:
-.IP
-.nf
-\f[C]
-$ hledger cashflow
-Cashflow Statement
-
-Cash flows:
-                 $-1  assets
-                  $1    bank:saving
-                 $-2    cash
---------------------
-                 $-1
-
-Total:
---------------------
-                 $-1
-\f[R]
-.fi
-.PP
-With a reporting interval, multiple columns will be shown, one for each
-report period.
-Normally cashflow shows changes in assets per period, though as with
-multicolumn balance reports you can alter the report mode with
-\f[C]--change\f[R]/\f[C]--cumulative\f[R]/\f[C]--historical\f[R].
-Instead of absolute values percentages can be displayed with
-\f[C]-%\f[R].
-.PP
-This command also supports output destination and output format
-selection.
-.SS check-dates
-.PP
-check-dates
-.PD 0
-.P
-.PD
-Check that transactions are sorted by increasing date.
-With --date2, checks secondary dates instead.
-With --strict, dates must also be unique.
-With a query, only matched transactions\[aq] dates are checked.
-Reads the default journal file, or another specified with -f.
-.SS check-dupes
-.PP
-check-dupes
-.PD 0
-.P
-.PD
-Reports account names having the same leaf but different prefixes.
-In other words, two or more leaves that are categorized differently.
-Reads the default journal file, or another specified as an argument.
-.PP
-An example: http://stefanorodighiero.net/software/hledger-dupes.html
-.SS close
-.PP
-close, equity
-.PD 0
-.P
-.PD
-Prints a \[dq]closing balances\[dq] transaction and an \[dq]opening
-balances\[dq] transaction that bring account balances to and from zero,
-respectively.
-Useful for bringing asset/liability balances forward into a new journal
-file, or for closing out revenues/expenses to retained earnings at the
-end of a period.
-.PP
-The closing transaction transfers balances to \[dq]equity:closing
-balances\[dq], and the opening transaction transfers balances from
-\[dq]equity:opening balances\[dq], or you can customise these with the
-\f[C]--close-to\f[R] and \f[C]--open-from\f[R] options.
-You can choose to print just one of the transactions by using the
-\f[C]--opening\f[R] or \f[C]--closing\f[R] flag.
-.PP
-If you split your journal files by time (eg yearly), you will typically
-run this command at the end of the year, and save the closing
-transaction as last entry of the old file, and the opening transaction
-as the first entry of the new file.
-This makes the files self contained, so that correct balances are
-reported no matter which of them are loaded.
-Ie, if you load just one file, the balances are initialised correctly;
-or if you load several files, the redundant closing/opening transactions
-cancel each other out.
-(They will show up in print or register reports; you can exclude them
-with a query like
-\f[C]not:desc:\[aq](opening|closing) balances\[aq]\f[R].)
-.PP
-If you\[aq]re running a business, you might also use this command to
-\[dq]close the books\[dq] at the end of an accounting period,
-transferring income statement account balances to retained earnings.
-(You may want to change the equity account name to something like
-\[dq]equity:retained earnings\[dq].)
-.PP
-By default, the closing transaction is dated yesterday, the balances are
-calculated as of end of yesterday, and the opening transaction is dated
-today.
-To close on some other date, use:
-\f[C]hledger close -e OPENINGDATE\f[R].
-Eg, to close/open on the 2018/2019 boundary, use \f[C]-e 2019\f[R].
-You can also use -p or \f[C]date:PERIOD\f[R] (any starting date is
-ignored).
-.PP
-Both transactions will include balance assertions for the
-closed/reopened accounts.
-You probably shouldn\[aq]t use status or realness filters (like -C or -R
-or \f[C]status:\f[R]) with this command, or the generated balance
-assertions will depend on these flags.
-Likewise, if you run this command with --auto, the balance assertions
-will probably always require --auto.
-.PP
-When account balances have cost information (transaction prices), the
-closing/opening transactions will preserve it, so that eg balance -B
-reports will not be affected.
-.PP
-Examples:
-.PP
-Carrying asset/liability balances into a new file for 2019, all from
-command line:
-.PP
-\f[I]Warning: we use \f[CI]>>\f[I] here to append; be careful not to
-type a single \f[CI]>\f[I] which would wipe your journal!\f[R]
-.IP
-.nf
-\f[C]
-$ hledger close -f 2018.journal -e 2019 assets liabilities --opening >>2019.journal
-$ hledger close -f 2018.journal -e 2019 assets liabilities --closing >>2018.journal
-\f[R]
-.fi
-.PP
-Now:
-.IP
-.nf
-\f[C]
-$ hledger bs -f 2019.journal                   # one file - balances are correct
-$ hledger bs -f 2018.journal -f 2019.journal   # two files - balances still correct
-$ hledger bs -f 2018.journal not:desc:closing  # to see year-end balances, must exclude closing txn
-\f[R]
-.fi
-.PP
-Transactions spanning the closing date can complicate matters, breaking
-balance assertions:
-.IP
-.nf
-\f[C]
-2018/12/30 a purchase made in 2018, clearing the following year
-    expenses:food          5
-    assets:bank:checking  -5  ; [2019/1/2]
-\f[R]
-.fi
-.PP
-Here\[aq]s one way to resolve that:
-.IP
-.nf
-\f[C]
-; in 2018.journal:
-2018/12/30 a purchase made in 2018, clearing the following year
-    expenses:food          5
-    liabilities:pending
-
-; in 2019.journal:
-2019/1/2 clearance of last year\[aq]s pending transactions
-    liabilities:pending    5 = 0
-    assets:checking
-\f[R]
-.fi
-.SS commodities
-.PP
-commodities
-.PD 0
-.P
-.PD
-List all commodity/currency symbols used or declared in the journal.
-.SS descriptions
-.PP
-descriptions Show descriptions.
-.PP
-This command lists all descriptions that appear in transactions.
-.PP
-Examples:
-.IP
-.nf
-\f[C]
-$ hledger descriptions
-Store Name
-Gas Station | Petrol
-Person A
-\f[R]
-.fi
-.SS diff
-.PP
-diff
-.PD 0
-.P
-.PD
-Compares a particular account\[aq]s transactions in two input files.
-It shows any transactions to this account which are in one file but not
-in the other.
-.PP
-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.) Since
-postings not transactions are compared, this also works when multiple
-bank transactions have been combined into a single journal entry.
-.PP
-This is useful eg if you have downloaded an account\[aq]s transactions
-from 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.
-.PP
-Examples:
-.IP
-.nf
-\f[C]
-$ hledger diff -f $LEDGER_FILE -f bank.csv assets:bank:giro 
-These transactions are in the first file only:
-
-2014/01/01 Opening Balances
-    assets:bank:giro              EUR ...
-    ...
-    equity:opening balances       EUR -...
-
-These transactions are in the second file only:
-\f[R]
-.fi
-.SS files
-.PP
-files
-.PD 0
-.P
-.PD
-List all files included in the journal.
-With a REGEX argument, only file names matching the regular expression
-(case sensitive) are shown.
-.SS help
-.PP
-help
-.PD 0
-.P
-.PD
-Show any of the hledger manuals.
-.PP
-The \f[C]help\f[R] 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.
-.PP
-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 \f[C]--info\f[R],
-\f[C]--man\f[R], \f[C]--pager\f[R], \f[C]--cat\f[R] flags.
-.PP
-Examples:
-.IP
-.nf
-\f[C]
-$ hledger help
-Please choose a manual by typing \[dq]hledger help MANUAL\[dq] (a substring is ok).
-Manuals: hledger hledger-ui hledger-web journal csv timeclock timedot
-\f[R]
-.fi
-.IP
-.nf
-\f[C]
-$ hledger help h --man
-
-hledger(1)                    hledger User Manuals                    hledger(1)
-
-NAME
-       hledger - a command-line accounting tool
-
-SYNOPSIS
-       hledger [-f FILE] COMMAND [OPTIONS] [ARGS]
-       hledger [-f FILE] ADDONCMD -- [OPTIONS] [ARGS]
-       hledger
-
-DESCRIPTION
-       hledger  is  a  cross-platform  program  for tracking money, time, or any
-\&...
-\f[R]
-.fi
-.SS import
-.PP
-import
-.PD 0
-.P
-.PD
-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 transactions that would be added.
-Or with --catchup, just mark all of the FILEs\[aq] transactions as
-imported, without actually importing any.
-.PP
-The input files are specified as arguments - no need to write -f before
-each one.
-So eg to add new transactions from all CSV files to the main journal,
-it\[aq]s just: \f[C]hledger import *.csv\f[R]
-.PP
-New transactions are detected in the same way as print --new: by
-assuming transactions are always added to the input files in increasing
-date order, and by saving \f[C].latest.FILE\f[R] state files.
-.PP
-The --dry-run output is in journal format, so you can filter it, eg to
-see only uncategorised transactions:
-.IP
-.nf
-\f[C]
-$ hledger import --dry ... | hledger -f- print unknown --ignore-assertions
-\f[R]
-.fi
-.SS Importing balance assignments
-.PP
-Entries added by import will have their posting amounts made explicit
-(like \f[C]hledger print -x\f[R]).
-This means that any balance assignments in imported files must be
-evaluated; but, imported files don\[aq]t get to see the main file\[aq]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 amounts.
-To avoid this problem, use print instead of import:
-.IP
-.nf
-\f[C]
-$ hledger print IMPORTFILE [--new] >> $LEDGER_FILE
-\f[R]
-.fi
-.PP
-(If you think import should leave amounts implicit like print does,
-please test it and send a pull request.)
-.SS incomestatement
-.PP
-incomestatement, is
-.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.)
-.IP
-.nf
-\f[C]
-$ hledger incomestatement
-Income Statement
-
-Revenues:
-                 $-2  income
-                 $-1    gifts
-                 $-1    salary
---------------------
-                 $-2
-
-Expenses:
-                  $2  expenses
-                  $1    food
-                  $1    supplies
---------------------
-                  $2
-
-Total:
---------------------
-                   0
-\f[R]
-.fi
-.PP
-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
-\f[C]--change\f[R]/\f[C]--cumulative\f[R]/\f[C]--historical\f[R].
-Instead of absolute values percentages can be displayed with
-\f[C]-%\f[R].
-.PP
-This command also supports output destination and output format
-selection.
-.SS notes
-.PP
-notes Show notes.
-.PP
-This command lists all notes that appear in transactions.
-.PP
-Examples:
-.IP
-.nf
-\f[C]
-$ hledger notes
-Petrol
-Snacks
-\f[R]
-.fi
-.SS payees
-.PP
-payees Show payee names.
-.PP
-This command lists all payee names that appear in transactions.
-.PP
-Examples:
-.IP
-.nf
-\f[C]
-$ hledger payees
-Store Name
-Gas Station
-Person A
-\f[R]
-.fi
-.SS prices
-.PP
-prices
-.PD 0
-.P
-.PD
-Print market price directives from the journal.
-With --costs, also print synthetic market prices based on transaction
-prices.
-With --inverted-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.
-.SS print
-.PP
-print, txns, p
-.PD 0
-.P
-.PD
-Show transaction journal entries, sorted by date.
-.PP
-The print command displays full journal entries (transactions) from the
-journal file in date order, tidily formatted.
-With --date2, transactions are sorted by secondary date instead.
-.PP
-print\[aq]s output is always a valid hledger journal.
-.PD 0
-.P
-.PD
-It preserves all transaction information, but it does not preserve
-directives or inter-transaction comments
-.IP
-.nf
-\f[C]
-$ hledger print
-2008/01/01 income
-    assets:bank:checking            $1
-    income:salary                  $-1
-
-2008/06/01 gift
-    assets:bank:checking            $1
-    income:gifts                   $-1
-
-2008/06/02 save
-    assets:bank:saving              $1
-    assets:bank:checking           $-1
-
-2008/06/03 * eat & shop
-    expenses:food                $1
-    expenses:supplies            $1
-    assets:cash                 $-2
-
-2008/12/31 * pay off
-    liabilities:debts               $1
-    assets:bank:checking           $-1
-\f[R]
-.fi
-.PP
-Normally, the journal entry\[aq]s explicit or implicit amount style is
-preserved.
-Ie when an amount is omitted in the journal, it will be omitted in the
-output.
-You can use the \f[C]-x\f[R]/\f[C]--explicit\f[R] flag to make all
-amounts explicit, which can be useful for troubleshooting or for making
-your journal more readable and robust against data entry errors.
-Note, \f[C]-x\f[R] will cause postings with a multi-commodity amount
-(these can arise when a multi-commodity transaction has an implicit
-amount) will be split into multiple single-commodity postings, for valid
-journal output.
-.PP
-With \f[C]-B\f[R]/\f[C]--cost\f[R], amounts with transaction prices are
-converted to cost using that price.
-This can be used for troubleshooting.
-.PP
-With \f[C]-m\f[R]/\f[C]--match\f[R] and a STR argument, print will show
-at most one transaction: 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.
-.PP
-With \f[C]--new\f[R], for each FILE being read, hledger reads (and
-writes) a special state file (\f[C].latest.FILE\f[R] 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 ignoring already-seen entries in import data, such as
-downloaded CSV files.
-Eg:
-.IP
-.nf
-\f[C]
-$ hledger -f bank1.csv print --new
-# shows transactions added since last print --new on this file
-\f[R]
-.fi
-.PP
-This assumes that transactions added to FILE always have same or
-increasing dates, and that transactions on the same day do not get
-reordered.
-See also the import command.
-.PP
-This command also supports output destination and output format
-selection.
-Here\[aq]s an example of print\[aq]s CSV output:
-.IP
-.nf
-\f[C]
-$ hledger print -Ocsv
-\[dq]txnidx\[dq],\[dq]date\[dq],\[dq]date2\[dq],\[dq]status\[dq],\[dq]code\[dq],\[dq]description\[dq],\[dq]comment\[dq],\[dq]account\[dq],\[dq]amount\[dq],\[dq]commodity\[dq],\[dq]credit\[dq],\[dq]debit\[dq],\[dq]posting-status\[dq],\[dq]posting-comment\[dq]
-\[dq]1\[dq],\[dq]2008/01/01\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]income\[dq],\[dq]\[dq],\[dq]assets:bank:checking\[dq],\[dq]1\[dq],\[dq]$\[dq],\[dq]\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq]
-\[dq]1\[dq],\[dq]2008/01/01\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]income\[dq],\[dq]\[dq],\[dq]income:salary\[dq],\[dq]-1\[dq],\[dq]$\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq]
-\[dq]2\[dq],\[dq]2008/06/01\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]gift\[dq],\[dq]\[dq],\[dq]assets:bank:checking\[dq],\[dq]1\[dq],\[dq]$\[dq],\[dq]\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq]
-\[dq]2\[dq],\[dq]2008/06/01\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]gift\[dq],\[dq]\[dq],\[dq]income:gifts\[dq],\[dq]-1\[dq],\[dq]$\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq]
-\[dq]3\[dq],\[dq]2008/06/02\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]save\[dq],\[dq]\[dq],\[dq]assets:bank:saving\[dq],\[dq]1\[dq],\[dq]$\[dq],\[dq]\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq]
-\[dq]3\[dq],\[dq]2008/06/02\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]save\[dq],\[dq]\[dq],\[dq]assets:bank:checking\[dq],\[dq]-1\[dq],\[dq]$\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq]
-\[dq]4\[dq],\[dq]2008/06/03\[dq],\[dq]\[dq],\[dq]*\[dq],\[dq]\[dq],\[dq]eat & shop\[dq],\[dq]\[dq],\[dq]expenses:food\[dq],\[dq]1\[dq],\[dq]$\[dq],\[dq]\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq]
-\[dq]4\[dq],\[dq]2008/06/03\[dq],\[dq]\[dq],\[dq]*\[dq],\[dq]\[dq],\[dq]eat & shop\[dq],\[dq]\[dq],\[dq]expenses:supplies\[dq],\[dq]1\[dq],\[dq]$\[dq],\[dq]\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq]
-\[dq]4\[dq],\[dq]2008/06/03\[dq],\[dq]\[dq],\[dq]*\[dq],\[dq]\[dq],\[dq]eat & shop\[dq],\[dq]\[dq],\[dq]assets:cash\[dq],\[dq]-2\[dq],\[dq]$\[dq],\[dq]2\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq]
-\[dq]5\[dq],\[dq]2008/12/31\[dq],\[dq]\[dq],\[dq]*\[dq],\[dq]\[dq],\[dq]pay off\[dq],\[dq]\[dq],\[dq]liabilities:debts\[dq],\[dq]1\[dq],\[dq]$\[dq],\[dq]\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq]
-\[dq]5\[dq],\[dq]2008/12/31\[dq],\[dq]\[dq],\[dq]*\[dq],\[dq]\[dq],\[dq]pay off\[dq],\[dq]\[dq],\[dq]assets:bank:checking\[dq],\[dq]-1\[dq],\[dq]$\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq]
-\f[R]
-.fi
-.IP \[bu] 2
-There is one CSV record per posting, with the parent transaction\[aq]s
-fields repeated.
-.IP \[bu] 2
-The \[dq]txnidx\[dq] (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 order, etc.)
-.IP \[bu] 2
-The amount is separated into \[dq]commodity\[dq] (the symbol) and
-\[dq]amount\[dq] (numeric quantity) fields.
-.IP \[bu] 2
-The numeric amount is repeated in either the \[dq]credit\[dq] or
-\[dq]debit\[dq] column, for convenience.
-(Those names are not accurate in the accounting sense; it just puts
-negative amounts under credit and zero or greater amounts under debit.)
-.SS print-unique
-.PP
-print-unique
-.PD 0
-.P
-.PD
-Print transactions which do not reuse an already-seen description.
-.PP
-Example:
-.IP
-.nf
-\f[C]
-$ cat unique.journal
-1/1 test
- (acct:one)  1
-2/2 test
- (acct:two)  2
-$ LEDGER_FILE=unique.journal hledger print-unique
-(-f option not supported)
-2015/01/01 test
-    (acct:one)             1
-\f[R]
-.fi
-.SS register
-.PP
-register, reg, r
-.PD 0
-.P
-.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:
-.IP
-.nf
-\f[C]
-$ hledger register checking
-2008/01/01 income               assets:bank:checking            $1           $1
-2008/06/01 gift                 assets:bank:checking            $1           $2
-2008/06/02 save                 assets:bank:checking           $-1           $1
-2008/12/31 pay off              assets:bank:checking           $-1            0
-\f[R]
-.fi
-.PP
-With --date2, it shows and sorts by secondary date instead.
-.PP
-The \f[C]--historical\f[R]/\f[C]-H\f[R] flag adds the balance from any
-undisplayed prior postings to the running total.
-This is useful when you want to see only recent activity, with a
-historically accurate running balance:
-.IP
-.nf
-\f[C]
-$ hledger register checking -b 2008/6 --historical
-2008/06/01 gift                 assets:bank:checking            $1           $2
-2008/06/02 save                 assets:bank:checking           $-1           $1
-2008/12/31 pay off              assets:bank:checking           $-1            0
-\f[R]
-.fi
-.PP
-The \f[C]--depth\f[R] option limits the amount of sub-account detail
-displayed.
-.PP
-The \f[C]--average\f[R]/\f[C]-A\f[R] flag shows the running average
-posting amount instead of the running total (so, the final number
-displayed is the average for the whole report period).
-This flag implies \f[C]--empty\f[R] (see below).
-It is affected by \f[C]--historical\f[R].
-It works best when showing just one account and one commodity.
-.PP
-The \f[C]--related\f[R]/\f[C]-r\f[R] flag shows the \f[I]other\f[R]
-postings in the transactions of the postings which would normally be
-shown.
-.PP
-The \f[C]--invert\f[R] flag negates all amounts.
-For example, it can be used on an income account where amounts are
-normally displayed as negative numbers.
-It\[aq]s also useful to show postings on the checking account together
-with the related account:
-.IP
-.nf
-\f[C]
-$ hledger register --related --invert assets:checking
-\f[R]
-.fi
-.PP
-With a reporting interval, register shows summary postings, one per
-interval, aggregating the postings to each account:
-.IP
-.nf
-\f[C]
-$ hledger register --monthly income
-2008/01                 income:salary                          $-1          $-1
-2008/06                 income:gifts                           $-1          $-2
-\f[R]
-.fi
-.PP
-Periods with no activity, and summary postings with a zero amount, are
-not shown by default; use the \f[C]--empty\f[R]/\f[C]-E\f[R] flag to see
-them:
-.IP
-.nf
-\f[C]
-$ hledger register --monthly income -E
-2008/01                 income:salary                          $-1          $-1
-2008/02                                                          0          $-1
-2008/03                                                          0          $-1
-2008/04                                                          0          $-1
-2008/05                                                          0          $-1
-2008/06                 income:gifts                           $-1          $-2
-2008/07                                                          0          $-2
-2008/08                                                          0          $-2
-2008/09                                                          0          $-2
-2008/10                                                          0          $-2
-2008/11                                                          0          $-2
-2008/12                                                          0          $-2
-\f[R]
-.fi
-.PP
-Often, you\[aq]ll want to see just one line per interval.
-The \f[C]--depth\f[R] option helps with this, causing subaccounts to be
-aggregated:
-.IP
-.nf
-\f[C]
-$ hledger register --monthly assets --depth 1h
-2008/01                 assets                                  $1           $1
-2008/06                 assets                                 $-1            0
-2008/12                 assets                                 $-1          $-1
-\f[R]
-.fi
-.PP
-Note when using report intervals, if you specify start/end dates these
-will be adjusted outward if necessary to contain a whole number of
-intervals.
-This ensures that the first and last intervals are full length and
-comparable to the others in the report.
-.SS Custom register output
-.PP
-register uses the full terminal width by default, except on windows.
-You can override this by setting the \f[C]COLUMNS\f[R] environment
-variable (not a bash shell variable) or by using the
-\f[C]--width\f[R]/\f[C]-w\f[R] option.
-.PP
-The description and account columns normally share the space equally
-(about half of (width - 40) each).
-You can adjust this by adding a description width as part of
---width\[aq]s argument, comma-separated: \f[C]--width W,D\f[R] .
-Here\[aq]s a diagram (won\[aq]t display correctly in --help):
-.IP
-.nf
-\f[C]
-<--------------------------------- width (W) ---------------------------------->
-date (10)  description (D)       account (W-41-D)     amount (12)   balance (12)
-DDDDDDDDDD dddddddddddddddddddd  aaaaaaaaaaaaaaaaaaa  AAAAAAAAAAAA  AAAAAAAAAAAA
-\f[R]
-.fi
-.PP
-and some examples:
-.IP
-.nf
-\f[C]
-$ hledger reg                     # use terminal width (or 80 on windows)
-$ hledger reg -w 100              # use width 100
-$ COLUMNS=100 hledger reg         # set with one-time environment variable
-$ export COLUMNS=100; hledger reg # set till session end (or window resize)
-$ hledger reg -w 100,40           # set overall width 100, description width 40
-$ hledger reg -w $COLUMNS,40      # use terminal width, & description width 40
-\f[R]
-.fi
-.PP
-This command also supports output destination and output format
-selection.
-.SS register-match
-.PP
-register-match
-.PD 0
-.P
-.PD
-Print the one posting whose transaction description is closest to DESC,
-in the style of the register command.
-If there are multiple equally good matches, it shows the most recent.
-Query options (options, not arguments) can be used to restrict the
-search space.
-Helps ledger-autosync detect already-seen transactions when importing.
-.SS rewrite
-.PP
-rewrite
-.PD 0
-.P
-.PD
-Print all transactions, rewriting the postings of matched transactions.
-For now the only rewrite available is adding new postings, like print
---auto.
-.PP
-This is a start at a generic rewriter of transaction entries.
-It reads the default journal and prints the transactions, like print,
-but adds one or more specified postings to any transactions matching
-QUERY.
-The posting amounts can be fixed, or a multiplier of the existing
-transaction\[aq]s first posting amount.
-.PP
-Examples:
-.IP
-.nf
-\f[C]
-$ hledger-rewrite.hs \[ha]income --add-posting \[aq](liabilities:tax)  *.33  ; income tax\[aq] --add-posting \[aq](reserve:gifts)  $100\[aq]
-$ hledger-rewrite.hs expenses:gifts --add-posting \[aq](reserve:gifts)  *-1\[dq]\[aq]
-$ hledger-rewrite.hs -f rewrites.hledger
-\f[R]
-.fi
-.PP
-rewrites.hledger may consist of entries like:
-.IP
-.nf
-\f[C]
-= \[ha]income amt:<0 date:2017
-  (liabilities:tax)  *0.33  ; tax on income
-  (reserve:grocery)  *0.25  ; reserve 25% for grocery
-  (reserve:)  *0.25  ; reserve 25% for grocery
-\f[R]
-.fi
-.PP
-Note the single quotes to protect the dollar sign from bash, and the two
-spaces between account and amount.
-.PP
-More:
-.IP
-.nf
-\f[C]
-$ hledger rewrite -- [QUERY]        --add-posting \[dq]ACCT  AMTEXPR\[dq] ...
-$ hledger rewrite -- \[ha]income        --add-posting \[aq](liabilities:tax)  *.33\[aq]
-$ hledger rewrite -- expenses:gifts --add-posting \[aq](budget:gifts)  *-1\[dq]\[aq]
-$ hledger rewrite -- \[ha]income        --add-posting \[aq](budget:foreign currency)  *0.25 JPY; diversify\[aq]
-\f[R]
-.fi
-.PP
-Argument for \f[C]--add-posting\f[R] option is a usual posting of
-transaction with an exception for amount specification.
-More precisely, you can use \f[C]\[aq]*\[aq]\f[R] (star symbol) before
-the amount to indicate that that this is a factor for an amount of
-original matched posting.
-If the amount includes a commodity name, the new posting amount will be
-in the new commodity; otherwise, it will be in the matched posting
-amount\[aq]s commodity.
-.SS Re-write rules in a file
-.PP
-During the run this tool will execute so called \[dq]Automated
-Transactions\[dq] found in any journal it process.
-I.e instead of specifying this operations in command line you can put
-them in a journal file.
-.IP
-.nf
-\f[C]
-$ rewrite-rules.journal
-\f[R]
-.fi
-.PP
-Make contents look like this:
-.IP
-.nf
-\f[C]
-= \[ha]income
-    (liabilities:tax)  *.33
-
-= expenses:gifts
-    budget:gifts  *-1
-    assets:budget  *1
-\f[R]
-.fi
-.PP
-Note that \f[C]\[aq]=\[aq]\f[R] (equality symbol) that is used instead
-of date in transactions you usually write.
-It indicates the query by which you want to match the posting to add new
-ones.
-.IP
-.nf
-\f[C]
-$ hledger rewrite -- -f input.journal -f rewrite-rules.journal > rewritten-tidy-output.journal
-\f[R]
-.fi
-.PP
-This is something similar to the commands pipeline:
-.IP
-.nf
-\f[C]
-$ hledger rewrite -- -f input.journal \[aq]\[ha]income\[aq] --add-posting \[aq](liabilities:tax)  *.33\[aq] \[rs]
-  | hledger rewrite -- -f - expenses:gifts      --add-posting \[aq]budget:gifts  *-1\[aq]       \[rs]
-                                                --add-posting \[aq]assets:budget  *1\[aq]       \[rs]
-  > rewritten-tidy-output.journal
-\f[R]
-.fi
-.PP
-It is important to understand that relative order of such entries in
-journal is important.
-You can re-use result of previously added postings.
-.SS Diff output format
-.PP
-To use this tool for batch modification of your journal files you may
-find useful output in form of unified diff.
-.IP
-.nf
-\f[C]
-$ hledger rewrite -- --diff -f examples/sample.journal \[aq]\[ha]income\[aq] --add-posting \[aq](liabilities:tax)  *.33\[aq]
-\f[R]
-.fi
-.PP
-Output might look like:
-.IP
-.nf
-\f[C]
---- /tmp/examples/sample.journal
-+++ /tmp/examples/sample.journal
-\[at]\[at] -18,3 +18,4 \[at]\[at]
- 2008/01/01 income
--    assets:bank:checking  $1
-+    assets:bank:checking            $1
-     income:salary
-+    (liabilities:tax)                0
-\[at]\[at] -22,3 +23,4 \[at]\[at]
- 2008/06/01 gift
--    assets:bank:checking  $1
-+    assets:bank:checking            $1
-     income:gifts
-+    (liabilities:tax)                0
-\f[R]
-.fi
-.PP
-If you\[aq]ll pass this through \f[C]patch\f[R] tool you\[aq]ll get
-transactions containing the posting that matches your query be updated.
-Note that multiple files might be update according to list of input
-files specified via \f[C]--file\f[R] options and \f[C]include\f[R]
-directives inside of these files.
-.PP
-Be careful.
-Whole transaction being re-formatted in a style of output from
-\f[C]hledger print\f[R].
-.PP
-See also:
-.PP
-https://github.com/simonmichael/hledger/issues/99
-.SS rewrite vs. print --auto
-.PP
-This command predates print --auto, and currently does much the same
-thing, but with these differences:
-.IP \[bu] 2
-with multiple files, rewrite lets rules in any file affect all other
-files.
-print --auto uses standard directive scoping; rules affect only child
-files.
-.IP \[bu] 2
-rewrite\[aq]s query limits which transactions can be rewritten; all are
-printed.
-print --auto\[aq]s query limits which transactions are printed.
-.IP \[bu] 2
-rewrite applies rules specified on command line or in the journal.
-print --auto applies rules specified in the journal.
-.SS roi
-.PP
-roi
-.PD 0
-.P
-.PD
-Shows the time-weighted (TWR) and money-weighted (IRR) rate of return on
-your investments.
-.PP
-This command assumes that you have account(s) that hold nothing but your
-investments and whenever you record current appraisal/valuation of these
-investments you offset unrealized profit and loss into account(s) that,
-again, hold nothing but unrealized profit and loss.
-.PP
-Any transactions affecting balance of investment account(s) and not
-originating from unrealized profit and loss account(s) are assumed to be
-your investments or withdrawals.
-.PP
-At a minimum, you need to supply a query (which could be just an account
-name) to select your investments with \f[C]--inv\f[R], and another query
-to identify your profit and loss transactions with \f[C]--pnl\f[R].
-.PP
-It will compute and display the internalized rate of return (IRR) and
-time-weighted rate of return (TWR) for your investments for the time
-period requested.
-Both rates of return are annualized before display, regardless of the
-length of reporting interval.
-.SS stats
-.PP
-stats
-.PD 0
-.P
-.PD
-Show some journal statistics.
-.PP
-The stats command displays summary information for the whole journal, or
-a matched part of it.
-With a reporting interval, it shows a report for each report period.
-.PP
-Example:
-.IP
-.nf
-\f[C]
-$ hledger stats
-Main journal file        : /src/hledger/examples/sample.journal
-Included journal files   : 
-Transactions span        : 2008-01-01 to 2009-01-01 (366 days)
-Last transaction         : 2008-12-31 (2333 days ago)
-Transactions             : 5 (0.0 per day)
-Transactions last 30 days: 0 (0.0 per day)
-Transactions last 7 days : 0 (0.0 per day)
-Payees/descriptions      : 5
-Accounts                 : 8 (depth 3)
-Commodities              : 1 ($)
-Market prices            : 12 ($)
-\f[R]
-.fi
-.PP
-This command also supports output destination and output format
-selection.
-.SS tags
-.PP
-tags
-.PD 0
-.P
-.PD
-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\[aq] unique values are listed instead.
-.SS test
-.PP
-test
-.PD 0
-.P
-.PD
-Run built-in unit tests.
-.PP
-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.
-.PP
-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!
-.PP
-This command also accepts tasty test runner options, written after a --
-(double hyphen).
-Eg to run only the tests in Hledger.Data.Amount, with ANSI colour codes
-disabled:
-.IP
-.nf
-\f[C]
-$ hledger test -- -pData.Amount --color=never
-\f[R]
-.fi
-.PP
-For help on these, see https://github.com/feuerbach/tasty#options
-(\f[C]-- --help\f[R] currently doesn\[aq]t show them).
-.SH ADD-ON COMMANDS
-.PP
-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
-\f[C]hledger-\f[R] and ends with a recognised file extension (currently:
-no extension, \f[C]bat\f[R],\f[C]com\f[R],\f[C]exe\f[R],
-\f[C]hs\f[R],\f[C]lhs\f[R],\f[C]pl\f[R],\f[C]py\f[R],\f[C]rb\f[R],\f[C]rkt\f[R],\f[C]sh\f[R]).
-.PP
-Add-ons can be invoked like any hledger command, but there are a few
-things to be aware of.
-Eg if the \f[C]hledger-web\f[R] add-on is installed,
-.IP \[bu] 2
-\f[C]hledger -h web\f[R] shows hledger\[aq]s help, while
-\f[C]hledger web -h\f[R] shows hledger-web\[aq]s help.
-.IP \[bu] 2
-Flags specific to the add-on must have a preceding \f[C]--\f[R] to hide
-them from hledger.
-So \f[C]hledger web --serve --port 9000\f[R] will be rejected; you must
-use \f[C]hledger web -- --serve --port 9000\f[R].
-.IP \[bu] 2
-You can always run add-ons directly if preferred:
-\f[C]hledger-web --serve --port 9000\f[R].
-.PP
-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.
-.PP
-Here are some hledger add-ons available:
-.SS Official add-ons
-.PP
-These are maintained and released along with hledger.
-.SS ui
-.PP
-hledger-ui provides an efficient terminal interface.
-.SS web
-.PP
-hledger-web provides a simple web interface.
-.SS Third party add-ons
-.PP
-These are maintained separately, and usually updated shortly after a
-hledger release.
-.SS diff
-.PP
-hledger-diff shows differences in an account\[aq]s transactions between
-one journal file and another.
-.SS iadd
-.PP
-hledger-iadd is a more interactive, terminal UI replacement for the add
-command.
-.SS interest
-.PP
-hledger-interest generates interest transactions for an account
-according to various schemes.
-.SS irr
-.PP
-hledger-irr calculates the internal rate of return of an investment
-account, but it\[aq]s superseded now by the built-in roi command.
-.SS Experimental add-ons
-.PP
-These are available in source form in the hledger repo\[aq]s bin/
-directory.
-They may be less mature and documented than built-in commands.
-Reading and tweaking these is a good way to start making your own!
-.SS autosync
-.PP
-hledger-autosync is a symbolic link for easily running ledger-autosync,
-if installed.
-ledger-autosync does deduplicating conversion of OFX data and some CSV
-formats, and can also download the data if your bank offers OFX Direct
-Connect.
-.SS chart
-.PP
-hledger-chart.hs is an old pie chart generator, in need of some love.
-.SS check
-.PP
-hledger-check.hs checks more powerful account balance assertions.
-.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
-\f[C]C:/Users/USER/.hledger.journal\f[R]).
+.TH "hledger" "1" "March 2020" "hledger 1.17" "hledger User Manuals"
+
+
+
+.SH NAME
+.PP
+hledger - a command-line accounting tool
+.SH SYNOPSIS
+.PP
+\f[C]hledger [-f FILE] COMMAND [OPTIONS] [ARGS]\f[R]
+.PD 0
+.P
+.PD
+\f[C]hledger [-f FILE] ADDONCMD -- [OPTIONS] [ARGS]\f[R]
+.PD 0
+.P
+.PD
+\f[C]hledger\f[R]
+.SH DESCRIPTION
+.PP
+hledger is a reliable, cross-platform set of programs for tracking
+money, time, or any other commodity, using double-entry accounting and a
+simple, editable file format.
+hledger is inspired by and largely compatible with ledger(1).
+.PP
+This is hledger\[cq]s command-line interface (there are also terminal
+and web interfaces).
+Its basic function is to read a plain text file describing financial
+transactions (in accounting terms, a general journal) and print useful
+reports on standard output, or export them as CSV.
+hledger can also read some other file formats such as CSV files,
+translating them to journal format.
+Additionally, hledger lists other hledger-* executables found in the
+user\[cq]s $PATH and can invoke them as subcommands.
+.PP
+hledger reads data from one or more files in hledger journal, timeclock,
+timedot, or CSV format specified with \f[C]-f\f[R], or
+\f[C]$LEDGER_FILE\f[R], or \f[C]$HOME/.hledger.journal\f[R] (on windows,
+perhaps \f[C]C:/Users/USER/.hledger.journal\f[R]).
+If using \f[C]$LEDGER_FILE\f[R], note this must be a real environment
+variable, not a shell variable.
+You can specify standard input with \f[C]-f-\f[R].
+.PP
+Transactions are dated movements of money between two (or more) named
+accounts, and are recorded with journal entries like this:
+.IP
+.nf
+\f[C]
+2015/10/16 bought food
+ expenses:food          $10
+ assets:cash
+\f[R]
+.fi
+.PP
+For more about this format, see hledger_journal(5).
+.PP
+Most users use a text editor to edit the journal, usually with an editor
+mode such as ledger-mode for added convenience.
+hledger\[cq]s interactive add command is another way to record new
+transactions.
+hledger never changes existing transactions.
+.PP
+To get started, you can either save some entries like the above in
+\f[C]\[ti]/.hledger.journal\f[R], or run \f[C]hledger add\f[R] and
+follow the prompts.
+Then try some commands like \f[C]hledger print\f[R] or
+\f[C]hledger balance\f[R].
+Run \f[C]hledger\f[R] with no arguments for a list of commands.
+.SH COMMON TASKS
+.PP
+Here are some quick examples of how to do some basic tasks with hledger.
+For more details, see the reference section below, the
+hledger_journal(5) manual, or the more extensive docs at
+https://hledger.org.
+.SS Getting help
+.IP
+.nf
+\f[C]
+$ hledger                 # show available commands
+$ hledger --help          # show common options
+$ hledger CMD --help      # show common and command options, and command help
+$ hledger help            # show available manuals/topics
+$ hledger help hledger    # show hledger manual as info/man/text (auto-chosen)
+$ hledger help journal --man  # show the journal manual as a man page
+$ hledger help --help     # show more detailed help for the help command
+\f[R]
+.fi
+.PP
+Find more docs, chat, mail list, reddit, issue tracker:
+https://hledger.org#help-feedback
+.SS Constructing command lines
+.PP
+hledger has an extensive and powerful command line interface.
+We strive to keep it simple and ergonomic, but you may run into one of
+the confusing real world details described in OPTIONS, below.
+If that happens, here are some tips that may help:
+.IP \[bu] 2
+command-specific options must go after the command (it\[aq]s fine to put
+all options there) (\f[C]hledger CMD OPTS ARGS\f[R])
+.IP \[bu] 2
+running add-on executables directly simplifies command line parsing
+(\f[C]hledger-ui OPTS ARGS\f[R])
+.IP \[bu] 2
+enclose \[dq]problematic\[dq] args in single quotes
+.IP \[bu] 2
+if needed, also add a backslash to hide regular expression
+metacharacters from the shell
+.IP \[bu] 2
+to see how a misbehaving command is being parsed, add
+\f[C]--debug=2\f[R].
+.SS Starting a journal file
+.PP
+hledger looks for your accounting data in a journal file,
+\f[C]$HOME/.hledger.journal\f[R] by default:
+.IP
+.nf
+\f[C]
+$ hledger stats
+The hledger journal file \[dq]/Users/simon/.hledger.journal\[dq] was not found.
+Please create it first, eg with \[dq]hledger add\[dq] or a text editor.
+Or, specify an existing journal file with -f or LEDGER_FILE.
+\f[R]
+.fi
+.PP
+You can override this by setting the \f[C]LEDGER_FILE\f[R] environment
+variable.
+It\[aq]s a good practice to keep this important file under version
+control, and to start a new file each year.
+So you could do something like this:
+.IP
+.nf
+\f[C]
+$ mkdir \[ti]/finance
+$ cd \[ti]/finance
+$ git init
+Initialized empty Git repository in /Users/simon/finance/.git/
+$ touch 2020.journal
+$ echo \[dq]export LEDGER_FILE=$HOME/finance/2020.journal\[dq] >> \[ti]/.bashrc
+$ source \[ti]/.bashrc
+$ hledger stats
+Main file                : /Users/simon/finance/2020.journal
+Included files           : 
+Transactions span        :  to  (0 days)
+Last transaction         : none
+Transactions             : 0 (0.0 per day)
+Transactions last 30 days: 0 (0.0 per day)
+Transactions last 7 days : 0 (0.0 per day)
+Payees/descriptions      : 0
+Accounts                 : 0 (depth 0)
+Commodities              : 0 ()
+Market prices            : 0 ()
+\f[R]
+.fi
+.SS Setting opening balances
+.PP
+Pick a starting date for which you can look up the balances of some
+real-world assets (bank accounts, wallet..) and liabilities (credit
+cards..).
+.PP
+To avoid a lot of data entry, you may want to start with just one or two
+accounts, like your checking account or cash wallet; and pick a recent
+starting date, like today or the start of the week.
+You can always come back later and add more accounts and older
+transactions, eg going back to january 1st.
+.PP
+Add an opening balances transaction to the journal, declaring the
+balances on this date.
+Here are two ways to do it:
+.IP \[bu] 2
+The first way: open the journal in any text editor and save an entry
+like this:
+.RS 2
+.IP
+.nf
+\f[C]
+2020-01-01 * opening balances
+    assets:bank:checking                $1000   = $1000
+    assets:bank:savings                 $2000   = $2000
+    assets:cash                          $100   = $100
+    liabilities:creditcard               $-50   = $-50
+    equity:opening/closing balances
+\f[R]
+.fi
+.PP
+These are start-of-day balances, ie whatever was in the account at the
+end of the previous day.
+.PP
+The * after the date is an optional status flag.
+Here it means \[dq]cleared & confirmed\[dq].
+.PP
+The currency symbols are optional, but usually a good idea as you\[aq]ll
+be dealing with multiple currencies sooner or later.
+.PP
+The = amounts are optional balance assertions, providing extra error
+checking.
+.RE
+.IP \[bu] 2
+The second way: run \f[C]hledger add\f[R] and follow the prompts to
+record a similar transaction:
+.RS 2
+.IP
+.nf
+\f[C]
+$ hledger add
+Adding transactions to journal file /Users/simon/finance/2020.journal
+Any command line arguments will be used as defaults.
+Use tab key to complete, readline keys to edit, enter to accept defaults.
+An optional (CODE) may follow transaction dates.
+An optional ; COMMENT may follow descriptions or amounts.
+If you make a mistake, enter < at any prompt to go one step backward.
+To end a transaction, enter . when prompted.
+To quit, enter . at a date prompt or press control-d or control-c.
+Date [2020-02-07]: 2020-01-01
+Description: * opening balances
+Account 1: assets:bank:checking
+Amount  1: $1000
+Account 2: assets:bank:savings
+Amount  2 [$-1000]: $2000
+Account 3: assets:cash
+Amount  3 [$-3000]: $100
+Account 4: liabilities:creditcard
+Amount  4 [$-3100]: $-50
+Account 5: equity:opening/closing balances
+Amount  5 [$-3050]: 
+Account 6 (or . or enter to finish this transaction): .
+2020-01-01 * opening balances
+    assets:bank:checking                      $1000
+    assets:bank:savings                       $2000
+    assets:cash                                $100
+    liabilities:creditcard                     $-50
+    equity:opening/closing balances          $-3050
+
+Save this transaction to the journal ? [y]: 
+Saved.
+Starting the next transaction (. or ctrl-D/ctrl-C to quit)
+Date [2020-01-01]: .
+\f[R]
+.fi
+.RE
+.PP
+If you\[aq]re using version control, this could be a good time to commit
+the journal.
+Eg:
+.IP
+.nf
+\f[C]
+$ git commit -m \[aq]initial balances\[aq] 2020.journal
+\f[R]
+.fi
+.SS Recording transactions
+.PP
+As you spend or receive money, you can record these transactions using
+one of the methods above (text editor, hledger add) or by using the
+hledger-iadd or hledger-web add-ons, or by using the import command to
+convert CSV data downloaded from your bank.
+.PP
+Here are some simple transactions, see the hledger_journal(5) manual and
+hledger.org for more ideas:
+.IP
+.nf
+\f[C]
+2020/1/10 * gift received
+  assets:cash   $20
+  income:gifts
+
+2020.1.12 * farmers market
+  expenses:food    $13
+  assets:cash
+
+2020-01-15 paycheck
+  income:salary
+  assets:bank:checking    $1000
+\f[R]
+.fi
+.SS Reconciling
+.PP
+Periodically you should reconcile - compare your hledger-reported
+balances against external sources of truth, like bank statements or your
+bank\[aq]s website - to be sure that your ledger accurately represents
+the real-world balances (and, that the real-world institutions have not
+made a mistake!).
+This gets easy and fast with (1) practice and (2) frequency.
+If you do it daily, it can take 2-10 minutes.
+If you let it pile up, expect it to take longer as you hunt down errors
+and discrepancies.
+.PP
+A typical workflow:
+.IP "1." 3
+Reconcile cash.
+Count what\[aq]s in your wallet.
+Compare with what hledger reports (\f[C]hledger bal cash\f[R]).
+If they are different, try to remember the missing transaction, or look
+for the error in the already-recorded transactions.
+A register report can be helpful (\f[C]hledger reg cash\f[R]).
+If you can\[aq]t find the error, add an adjustment transaction.
+Eg if you have $105 after the above, and can\[aq]t explain the missing
+$2, it could be:
+.RS 4
+.IP
+.nf
+\f[C]
+2020-01-16 * adjust cash
+    assets:cash    $-2 = $105
+    expenses:misc
+\f[R]
+.fi
+.RE
+.IP "2." 3
+Reconcile checking.
+Log in to your bank\[aq]s website.
+Compare today\[aq]s (cleared) balance with hledger\[aq]s cleared balance
+(\f[C]hledger bal checking -C\f[R]).
+If they are different, track down the error or record the missing
+transaction(s) or add an adjustment transaction, similar to the above.
+Unlike the cash case, you can usually compare the transaction history
+and running balance from your bank with the one reported by
+\f[C]hledger reg checking -C\f[R].
+This will be easier if you generally record transaction dates quite
+similar to your bank\[aq]s clearing dates.
+.IP "3." 3
+Repeat for other asset/liability accounts.
+.PP
+Tip: instead of the register command, use hledger-ui to see a
+live-updating register while you edit the journal:
+\f[C]hledger-ui --watch --register checking -C\f[R]
+.PP
+After reconciling, it could be a good time to mark the reconciled
+transactions\[aq] status as \[dq]cleared and confirmed\[dq], if you want
+to track that, by adding the \f[C]*\f[R] marker.
+Eg in the paycheck transaction above, insert \f[C]*\f[R] between
+\f[C]2020-01-15\f[R] and \f[C]paycheck\f[R]
+.PP
+If you\[aq]re using version control, this can be another good time to
+commit:
+.IP
+.nf
+\f[C]
+$ git commit -m \[aq]txns\[aq] 2020.journal
+\f[R]
+.fi
+.SS Reporting
+.PP
+Here are some basic reports.
+.PP
+Show all transactions:
+.IP
+.nf
+\f[C]
+$ hledger print
+2020-01-01 * opening balances
+    assets:bank:checking                      $1000
+    assets:bank:savings                       $2000
+    assets:cash                                $100
+    liabilities:creditcard                     $-50
+    equity:opening/closing balances          $-3050
+
+2020-01-10 * gift received
+    assets:cash              $20
+    income:gifts
+
+2020-01-12 * farmers market
+    expenses:food             $13
+    assets:cash
+
+2020-01-15 * paycheck
+    income:salary
+    assets:bank:checking           $1000
+
+2020-01-16 * adjust cash
+    assets:cash               $-2 = $105
+    expenses:misc
+\f[R]
+.fi
+.PP
+Show account names, and their hierarchy:
+.IP
+.nf
+\f[C]
+$ hledger accounts --tree
+assets
+  bank
+    checking
+    savings
+  cash
+equity
+  opening/closing balances
+expenses
+  food
+  misc
+income
+  gifts
+  salary
+liabilities
+  creditcard
+\f[R]
+.fi
+.PP
+Show all account totals:
+.IP
+.nf
+\f[C]
+$ hledger balance
+               $4105  assets
+               $4000    bank
+               $2000      checking
+               $2000      savings
+                $105    cash
+              $-3050  equity:opening/closing balances
+                 $15  expenses
+                 $13    food
+                  $2    misc
+              $-1020  income
+                $-20    gifts
+              $-1000    salary
+                $-50  liabilities:creditcard
+--------------------
+                   0
+\f[R]
+.fi
+.PP
+Show only asset and liability balances, as a flat list, limited to depth
+2:
+.IP
+.nf
+\f[C]
+$ hledger bal assets liabilities --flat -2
+               $4000  assets:bank
+                $105  assets:cash
+                $-50  liabilities:creditcard
+--------------------
+               $4055
+\f[R]
+.fi
+.PP
+Show the same thing without negative numbers, formatted as a simple
+balance sheet:
+.IP
+.nf
+\f[C]
+$ hledger bs --flat -2
+Balance Sheet 2020-01-16
+
+                        || 2020-01-16 
+========================++============
+ Assets                 ||            
+------------------------++------------
+ assets:bank            ||      $4000 
+ assets:cash            ||       $105 
+------------------------++------------
+                        ||      $4105 
+========================++============
+ Liabilities            ||            
+------------------------++------------
+ liabilities:creditcard ||        $50 
+------------------------++------------
+                        ||        $50 
+========================++============
+ Net:                   ||      $4055 
+\f[R]
+.fi
+.PP
+The final total is your \[dq]net worth\[dq] on the end date.
+(Or use \f[C]bse\f[R] for a full balance sheet with equity.)
+.PP
+Show income and expense totals, formatted as an income statement:
+.IP
+.nf
+\f[C]
+hledger is 
+Income Statement 2020-01-01-2020-01-16
+
+               || 2020-01-01-2020-01-16 
+===============++=======================
+ Revenues      ||                       
+---------------++-----------------------
+ income:gifts  ||                   $20 
+ income:salary ||                 $1000 
+---------------++-----------------------
+               ||                 $1020 
+===============++=======================
+ Expenses      ||                       
+---------------++-----------------------
+ expenses:food ||                   $13 
+ expenses:misc ||                    $2 
+---------------++-----------------------
+               ||                   $15 
+===============++=======================
+ Net:          ||                 $1005 
+\f[R]
+.fi
+.PP
+The final total is your net income during this period.
+.PP
+Show transactions affecting your wallet, with running total:
+.IP
+.nf
+\f[C]
+$ hledger register cash
+2020-01-01 opening balances     assets:cash                   $100          $100
+2020-01-10 gift received        assets:cash                    $20          $120
+2020-01-12 farmers market       assets:cash                   $-13          $107
+2020-01-16 adjust cash          assets:cash                    $-2          $105
+\f[R]
+.fi
+.PP
+Show weekly posting counts as a bar chart:
+.IP
+.nf
+\f[C]
+$ hledger activity -W
+2019-12-30 *****
+2020-01-06 ****
+2020-01-13 ****
+\f[R]
+.fi
+.SS Migrating to a new file
+.PP
+At the end of the year, you may want to continue your journal in a new
+file, so that old transactions don\[aq]t slow down or clutter your
+reports, and to help ensure the integrity of your accounting history.
+See the close command.
+.PP
+If using version control, don\[aq]t forget to \f[C]git add\f[R] the new
+file.
+.SH OPTIONS
+.SS General options
+.PP
+To see general usage help, including general options which are supported
+by most hledger commands, run \f[C]hledger -h\f[R].
+.PP
+General help options:
+.TP
+\f[B]\f[CB]-h --help\f[B]\f[R]
+show general usage (or after COMMAND, command usage)
+.TP
+\f[B]\f[CB]--version\f[B]\f[R]
+show version
+.TP
+\f[B]\f[CB]--debug[=N]\f[B]\f[R]
+show debug output (levels 1-9, default: 1)
+.PP
+General input options:
+.TP
+\f[B]\f[CB]-f FILE --file=FILE\f[B]\f[R]
+use a different input file.
+For stdin, use - (default: \f[C]$LEDGER_FILE\f[R] or
+\f[C]$HOME/.hledger.journal\f[R])
+.TP
+\f[B]\f[CB]--rules-file=RULESFILE\f[B]\f[R]
+Conversion rules file to use when reading CSV (default: FILE.rules)
+.TP
+\f[B]\f[CB]--separator=CHAR\f[B]\f[R]
+Field separator to expect when reading CSV (default: \[aq],\[aq])
+.TP
+\f[B]\f[CB]--alias=OLD=NEW\f[B]\f[R]
+rename accounts named OLD to NEW
+.TP
+\f[B]\f[CB]--anon\f[B]\f[R]
+anonymize accounts and payees
+.TP
+\f[B]\f[CB]--pivot FIELDNAME\f[B]\f[R]
+use some other field or tag for the account name
+.TP
+\f[B]\f[CB]-I --ignore-assertions\f[B]\f[R]
+disable balance assertion checks (note: does not disable balance
+assignments)
+.PP
+General reporting options:
+.TP
+\f[B]\f[CB]-b --begin=DATE\f[B]\f[R]
+include postings/txns on or after this date
+.TP
+\f[B]\f[CB]-e --end=DATE\f[B]\f[R]
+include postings/txns before this date
+.TP
+\f[B]\f[CB]-D --daily\f[B]\f[R]
+multiperiod/multicolumn report by day
+.TP
+\f[B]\f[CB]-W --weekly\f[B]\f[R]
+multiperiod/multicolumn report by week
+.TP
+\f[B]\f[CB]-M --monthly\f[B]\f[R]
+multiperiod/multicolumn report by month
+.TP
+\f[B]\f[CB]-Q --quarterly\f[B]\f[R]
+multiperiod/multicolumn report by quarter
+.TP
+\f[B]\f[CB]-Y --yearly\f[B]\f[R]
+multiperiod/multicolumn report by year
+.TP
+\f[B]\f[CB]-p --period=PERIODEXP\f[B]\f[R]
+set start date, end date, and/or reporting interval all at once using
+period expressions syntax
+.TP
+\f[B]\f[CB]--date2\f[B]\f[R]
+match the secondary date instead (see command help for other effects)
+.TP
+\f[B]\f[CB]-U --unmarked\f[B]\f[R]
+include only unmarked postings/txns (can combine with -P or -C)
+.TP
+\f[B]\f[CB]-P --pending\f[B]\f[R]
+include only pending postings/txns
+.TP
+\f[B]\f[CB]-C --cleared\f[B]\f[R]
+include only cleared postings/txns
+.TP
+\f[B]\f[CB]-R --real\f[B]\f[R]
+include only non-virtual postings
+.TP
+\f[B]\f[CB]-NUM --depth=NUM\f[B]\f[R]
+hide/aggregate accounts or postings more than NUM levels deep
+.TP
+\f[B]\f[CB]-E --empty\f[B]\f[R]
+show items with zero amount, normally hidden (and vice-versa in
+hledger-ui/hledger-web)
+.TP
+\f[B]\f[CB]-B --cost\f[B]\f[R]
+convert amounts to their cost at transaction time (using the transaction
+price, if any)
+.TP
+\f[B]\f[CB]-V --value\f[B]\f[R]
+convert amounts to their market value on the report end date (using the
+most recent applicable market price, if any)
+.TP
+\f[B]\f[CB]--auto\f[B]\f[R]
+apply automated posting rules to modify transactions.
+.TP
+\f[B]\f[CB]--forecast\f[B]\f[R]
+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.
+.PP
+When a reporting option appears more than once in the command line, the
+last one takes precedence.
+.PP
+Some reporting options can also be written as query arguments.
+.SS Command options
+.PP
+To see options for a particular command, including command-specific
+options, run: \f[C]hledger COMMAND -h\f[R].
+.PP
+Command-specific options must be written after the command name, eg:
+\f[C]hledger print -x\f[R].
+.PP
+Additionally, if the command is an addon, you may need to put its
+options after a double-hyphen, eg: \f[C]hledger ui -- --watch\f[R].
+Or, you can run the addon executable directly:
+\f[C]hledger-ui --watch\f[R].
+.SS Command arguments
+.PP
+Most hledger commands accept arguments after the command name, which are
+often a query, filtering the data in some way.
+.PP
+You can save a set of command line options/arguments in a file, and then
+reuse them by writing \f[C]\[at]FILENAME\f[R] as a command line
+argument.
+Eg: \f[C]hledger bal \[at]foo.args\f[R].
+(To prevent this, eg if you have an argument that begins with a literal
+\f[C]\[at]\f[R], precede it with \f[C]--\f[R], eg:
+\f[C]hledger bal -- \[at]ARG\f[R]).
+.PP
+Inside the argument file, each line should contain just one option or
+argument.
+Avoid the use of spaces, except inside quotes (or you\[aq]ll see a
+confusing error).
+Between a flag and its argument, use = (or nothing).
+Bad:
+.IP
+.nf
+\f[C]
+assets depth:2
+-X USD
+\f[R]
+.fi
+.PP
+Good:
+.IP
+.nf
+\f[C]
+assets
+depth:2
+-X=USD
+\f[R]
+.fi
+.PP
+For special characters (see below), use one less level of quoting than
+you would at the command prompt.
+Bad:
+.IP
+.nf
+\f[C]
+-X\[dq]$\[dq]
+\f[R]
+.fi
+.PP
+Good:
+.IP
+.nf
+\f[C]
+-X$
+\f[R]
+.fi
+.PP
+See also: Save frequently used options.
+.SS Queries
+.PP
+One of hledger\[aq]s strengths is being able to quickly report on
+precise subsets of your data.
+Most commands accept an optional query expression, written as arguments
+after the command name, to filter the data by date, account name or
+other criteria.
+The syntax is similar to a web search: one or more space-separated
+search terms, quotes to enclose whitespace, prefixes to match specific
+fields, a not: prefix to negate the match.
+.PP
+We do not yet support arbitrary boolean combinations of search terms;
+instead most commands show transactions/postings/accounts which match
+(or negatively match):
+.IP \[bu] 2
+any of the description terms AND
+.IP \[bu] 2
+any of the account terms AND
+.IP \[bu] 2
+any of the status terms AND
+.IP \[bu] 2
+all the other terms.
+.PP
+The print command instead shows transactions which:
+.IP \[bu] 2
+match any of the description terms AND
+.IP \[bu] 2
+have any postings matching any of the positive account terms AND
+.IP \[bu] 2
+have no postings matching any of the negative account terms AND
+.IP \[bu] 2
+match all the other terms.
+.PP
+The following kinds of search terms can be used.
+Remember these can also be prefixed with \f[B]\f[CB]not:\f[B]\f[R], eg
+to exclude a particular subaccount.
+.TP
+\f[B]\f[R]\f[C]REGEX\f[R]\f[B], \f[R]\f[C]acct:REGEX\f[R]\f[B]\f[R]
+match account names by this regular expression.
+(With no prefix, \f[C]acct:\f[R] is assumed.)
+same as above
+.TP
+\f[B]\f[R]\f[C]amt:N, amt:<N, amt:<=N, amt:>N, amt:>=N\f[R]\f[B]\f[R]
+match postings with a single-commodity amount that is equal to, less
+than, or greater than N.
+(Multi-commodity amounts are not tested, and will always match.) The
+comparison has two modes: if N is preceded by a + or - sign (or is 0),
+the two signed numbers are compared.
+Otherwise, the absolute magnitudes are compared, ignoring sign.
+.TP
+\f[B]\f[R]\f[C]code:REGEX\f[R]\f[B]\f[R]
+match by transaction code (eg check number)
+.TP
+\f[B]\f[R]\f[C]cur:REGEX\f[R]\f[B]\f[R]
+match postings or transactions including any amounts whose
+currency/commodity symbol is fully matched by REGEX.
+(For a partial match, use \f[C].*REGEX.*\f[R]).
+Note, to match characters which are regex-significant, like the dollar
+sign (\f[C]$\f[R]), you need to prepend \f[C]\[rs]\f[R].
+And when using the command line you need to add one more level of
+quoting to hide it from the shell, so eg do:
+\f[C]hledger print cur:\[aq]\[rs]$\[aq]\f[R] or
+\f[C]hledger print cur:\[rs]\[rs]$\f[R].
+.TP
+\f[B]\f[R]\f[C]desc:REGEX\f[R]\f[B]\f[R]
+match transaction descriptions.
+.TP
+\f[B]\f[R]\f[C]date:PERIODEXPR\f[R]\f[B]\f[R]
+match dates within the specified period.
+PERIODEXPR is a period expression (with no report interval).
+Examples: \f[C]date:2016\f[R], \f[C]date:thismonth\f[R],
+\f[C]date:2000/2/1-2/15\f[R], \f[C]date:lastweek-\f[R].
+If the \f[C]--date2\f[R] command line flag is present, this matches
+secondary dates instead.
+.TP
+\f[B]\f[R]\f[C]date2:PERIODEXPR\f[R]\f[B]\f[R]
+match secondary dates within the specified period.
+.TP
+\f[B]\f[R]\f[C]depth:N\f[R]\f[B]\f[R]
+match (or display, depending on command) accounts at or above this depth
+.TP
+\f[B]\f[R]\f[C]note:REGEX\f[R]\f[B]\f[R]
+match transaction notes (part of description right of \f[C]|\f[R], or
+whole description when there\[aq]s no \f[C]|\f[R])
+.TP
+\f[B]\f[R]\f[C]payee:REGEX\f[R]\f[B]\f[R]
+match transaction payee/payer names (part of description left of
+\f[C]|\f[R], or whole description when there\[aq]s no \f[C]|\f[R])
+.TP
+\f[B]\f[R]\f[C]real:, real:0\f[R]\f[B]\f[R]
+match real or virtual postings respectively
+.TP
+\f[B]\f[R]\f[C]status:, status:!, status:*\f[R]\f[B]\f[R]
+match unmarked, pending, or cleared transactions respectively
+.TP
+\f[B]\f[R]\f[C]tag:REGEX[=REGEX]\f[R]\f[B]\f[R]
+match by tag name, and optionally also by tag value.
+Note a tag: query is considered to match a transaction if it matches any
+of the postings.
+Also remember that postings inherit the tags of their parent
+transaction.
+.PP
+The following special search term is used automatically in hledger-web,
+only:
+.TP
+\f[B]\f[R]\f[C]inacct:ACCTNAME\f[R]\f[B]\f[R]
+tells hledger-web to show the transaction register for this account.
+Can be filtered further with \f[C]acct\f[R] etc.
+.PP
+Some of these can also be expressed as command-line options (eg
+\f[C]depth:2\f[R] is equivalent to \f[C]--depth 2\f[R]).
+Generally you can mix options and query arguments, and the resulting
+query will be their intersection (perhaps excluding the
+\f[C]-p/--period\f[R] option).
+.SS Special characters in arguments and queries
+.PP
+In shell command lines, option and argument values which contain
+\[dq]problematic\[dq] characters, ie spaces, and also characters
+significant to your shell such as \f[C]<\f[R], \f[C]>\f[R], \f[C](\f[R],
+\f[C])\f[R], \f[C]|\f[R] and \f[C]$\f[R], should be escaped by enclosing
+them in quotes or by writing backslashes before the characters.
+Eg:
+.PP
+\f[C]hledger register -p \[aq]last year\[aq] \[dq]accounts receivable (receivable|payable)\[dq] amt:\[rs]>100\f[R].
+.SS More escaping
+.PP
+Characters significant both to the shell and in regular expressions may
+need one extra level of escaping.
+These include parentheses, the pipe symbol and the dollar sign.
+Eg, to match the dollar symbol, bash users should do:
+.PP
+\f[C]hledger balance cur:\[aq]\[rs]$\[aq]\f[R]
+.PP
+or:
+.PP
+\f[C]hledger balance cur:\[rs]\[rs]$\f[R]
+.SS Even more escaping
+.PP
+When hledger runs an addon executable (eg you type \f[C]hledger ui\f[R],
+hledger runs \f[C]hledger-ui\f[R]), it de-escapes command-line options
+and arguments once, so you might need to \f[I]triple\f[R]-escape.
+Eg in bash, running the ui command and matching the dollar sign,
+it\[aq]s:
+.PP
+\f[C]hledger ui cur:\[aq]\[rs]\[rs]$\[aq]\f[R]
+.PP
+or:
+.PP
+\f[C]hledger ui cur:\[rs]\[rs]\[rs]\[rs]$\f[R]
+.PP
+If you asked why \f[I]four\f[R] slashes above, this may help:
+.PP
+.TS
+tab(@);
+l l.
+T{
+unescaped:
+T}@T{
+\f[C]$\f[R]
+T}
+T{
+escaped:
+T}@T{
+\f[C]\[rs]$\f[R]
+T}
+T{
+double-escaped:
+T}@T{
+\f[C]\[rs]\[rs]$\f[R]
+T}
+T{
+triple-escaped:
+T}@T{
+\f[C]\[rs]\[rs]\[rs]\[rs]$\f[R]
+T}
+.TE
+.PP
+(The number of backslashes in fish shell is left as an exercise for the
+reader.)
+.PP
+You can always avoid the extra escaping for addons by running the addon
+directly:
+.PP
+\f[C]hledger-ui cur:\[rs]\[rs]$\f[R]
+.SS Less escaping
+.PP
+Inside an argument file, or in the search field of hledger-ui or
+hledger-web, or at a GHCI prompt, you need one less level of escaping
+than at the command line.
+And backslashes may work better than quotes.
+Eg:
+.PP
+\f[C]ghci> :main balance cur:\[rs]$\f[R]
+.SS Unicode characters
+.PP
+hledger is expected to handle non-ascii characters correctly:
+.IP \[bu] 2
+they should be parsed correctly in input files and on the command line,
+by all hledger tools (add, iadd, hledger-web\[aq]s search/add/edit
+forms, etc.)
+.IP \[bu] 2
+they should be displayed correctly by all hledger tools, and on-screen
+alignment should be preserved.
+.PP
+This requires a well-configured environment.
+Here are some tips:
+.IP \[bu] 2
+A system locale must be configured, and it must be one that can decode
+the characters being used.
+In bash, you can set a locale like this:
+\f[C]export LANG=en_US.UTF-8\f[R].
+There are some more details in Troubleshooting.
+This step is essential - without it, hledger will quit on encountering a
+non-ascii character (as with all GHC-compiled programs).
+.IP \[bu] 2
+your terminal software (eg Terminal.app, iTerm, CMD.exe, xterm..) must
+support unicode
+.IP \[bu] 2
+the terminal must be using a font which includes the required unicode
+glyphs
+.IP \[bu] 2
+the terminal should be configured to display wide characters as double
+width (for report alignment)
+.IP \[bu] 2
+on Windows, for best results you should run hledger in the same kind of
+environment in which it was built.
+Eg hledger built in the standard CMD.EXE environment (like the binaries
+on our download page) might show display problems when run in a cygwin
+or msys terminal, and vice versa.
+(See eg #961).
+.SS Input files
+.PP
+hledger reads transactions from a data file (and the add command writes
+to it).
+By default this file is \f[C]$HOME/.hledger.journal\f[R] (or on Windows,
+something like \f[C]C:/Users/USER/.hledger.journal\f[R]).
+You can override this with the \f[C]$LEDGER_FILE\f[R] environment
+variable:
+.IP
+.nf
+\f[C]
+$ setenv LEDGER_FILE \[ti]/finance/2016.journal
+$ hledger stats
+\f[R]
+.fi
+.PP
+or with the \f[C]-f/--file\f[R] option:
+.IP
+.nf
+\f[C]
+$ hledger -f /some/file stats
+\f[R]
+.fi
+.PP
+The file name \f[C]-\f[R] (hyphen) means standard input:
+.IP
+.nf
+\f[C]
+$ cat some.journal | hledger -f-
+\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:
+.PP
+.TS
+tab(@);
+lw(7.6n) lw(31.2n) lw(31.2n).
+T{
+Reader:
+T}@T{
+Reads:
+T}@T{
+Used for file extensions:
+T}
+_
+T{
+\f[C]journal\f[R]
+T}@T{
+hledger\[aq]s journal format, also some Ledger journals
+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)
+T}@T{
+\f[C].timeclock\f[R]
+T}
+T{
+\f[C]timedot\f[R]
+T}@T{
+timedot files (approximate time logging)
+T}@T{
+\f[C].timedot\f[R]
+T}
+T{
+\f[C]csv\f[R]
+T}@T{
+comma-separated values (data interchange)
+T}@T{
+\f[C].csv\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:
+.IP
+.nf
+\f[C]
+$ hledger -f csv:/some/csv-file.dat stats
+$ echo \[aq]i 2009/13/1 08:00:00\[aq] | hledger print -ftimeclock:-
+\f[R]
+.fi
+.PP
+You can also 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].
+.SS Output destination
+.PP
+hledger commands send their output to the terminal by default.
+You can of course redirect this, eg into a file, using standard shell
+syntax:
+.IP
+.nf
+\f[C]
+$ hledger print > foo.txt
+\f[R]
+.fi
+.PP
+Some commands (print, register, stats, the balance commands) also
+provide the \f[C]-o/--output-file\f[R] option, which does the same thing
+without needing the shell.
+Eg:
+.IP
+.nf
+\f[C]
+$ hledger print -o foo.txt
+$ hledger print -o -        # write to stdout (the default)
+\f[R]
+.fi
+.SS Output format
+.PP
+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]).
+This is controlled by the \f[C]-O/--output-format\f[R] option:
+.IP
+.nf
+\f[C]
+$ hledger print -O csv
+\f[R]
+.fi
+.PP
+or, by a file extension specified with \f[C]-o/--output-file\f[R]:
+.IP
+.nf
+\f[C]
+$ hledger balancesheet -o foo.html   # write HTML to foo.html
+\f[R]
+.fi
+.PP
+The \f[C]-O\f[R] option can be used to override the file extension if
+needed:
+.IP
+.nf
+\f[C]
+$ hledger balancesheet -o foo.txt -O html   # write HTML to foo.txt
+\f[R]
+.fi
+.PP
+Some notes about JSON output:
+.IP \[bu] 2
+This feature is marked experimental, and not yet much used; you should
+expect our JSON to evolve.
+Real-world feedback is welcome.
+.IP \[bu] 2
+Our JSON is rather large and verbose, as it is quite a faithful
+representation of hledger\[aq]s internal data types.
+To understand the JSON, read the Haskell type definitions, which are
+mostly in
+https://github.com/simonmichael/hledger/blob/master/hledger-lib/Hledger/Data/Types.hs.
+.IP \[bu] 2
+The JSON output from hledger commands is essentially the same as the
+JSON served by hledger-web\[aq]s JSON API, but pretty printed, using
+line breaks and indentation.
+Our pretty printer has the ability to elide data in certain cases -
+rendering non-strings as if they were strings, or displaying
+\[dq]FOO..\[dq] instead of FOO\[aq]s full details.
+This should never happen in hledger\[aq]s JSON output; if you see
+otherwise, please report as a bug.
+.IP \[bu] 2
+hledger represents quantities as Decimal values storing up to 255
+significant digits, eg for repeating decimals.
+Such numbers can arise in practice (from automatically-calculated
+transaction prices), and would break most JSON consumers.
+So in JSON, we show quantities as simple Numbers with at most 10 decimal
+places.
+We don\[aq]t limit the number of integer digits, but that part is under
+your control.
+We hope this approach will not cause problems in practice; if you find
+otherwise, please let us know.
+(Cf #1195)
+.SS Regular expressions
+.PP
+hledger uses regular expressions in a number of places:
+.IP \[bu] 2
+query terms, on the command line and in the hledger-web search form:
+\f[C]REGEX\f[R], \f[C]desc:REGEX\f[R], \f[C]cur:REGEX\f[R],
+\f[C]tag:...=REGEX\f[R]
+.IP \[bu] 2
+CSV rules conditional blocks: \f[C]if REGEX ...\f[R]
+.IP \[bu] 2
+account alias directives and options:
+\f[C]alias /REGEX/ = REPLACEMENT\f[R],
+\f[C]--alias /REGEX/=REPLACEMENT\f[R]
+.PP
+hledger\[aq]s regular expressions come from the regex-tdfa library.
+In general they:
+.IP \[bu] 2
+are case insensitive
+.IP \[bu] 2
+are infix matching (do not need to match the entire thing being matched)
+.IP \[bu] 2
+are POSIX extended regular expressions
+.IP \[bu] 2
+also support GNU word boundaries (\[rs]<, \[rs]>, \[rs]b, \[rs]B)
+.IP \[bu] 2
+and parenthesised capturing groups and numeric backreferences in
+replacement strings
+.IP \[bu] 2
+do not support mode modifiers like (?s)
+.PP
+Some things to note:
+.IP \[bu] 2
+In the \f[C]alias\f[R] directive and \f[C]--alias\f[R] option, regular
+expressions must be enclosed in forward slashes (\f[C]/REGEX/\f[R]).
+Elsewhere in hledger, these are not required.
+.IP \[bu] 2
+In queries, to match a regular expression metacharacter like \f[C]$\f[R]
+as a literal character, prepend a backslash.
+Eg to search for amounts with the dollar sign in hledger-web, write
+\f[C]cur:\[rs]$\f[R].
+.IP \[bu] 2
+On the command line, some metacharacters like \f[C]$\f[R] have a special
+meaning to the shell and so must be escaped at least once more.
+See Special characters.
+.SS Smart dates
+.PP
+hledger\[aq]s user interfaces accept a flexible \[dq]smart date\[dq]
+syntax (unlike dates in the journal file).
+Smart dates allow some english words, can be relative to today\[aq]s
+date, and can have less-significant date parts omitted (defaulting to
+1).
+.PP
+Examples:
+.PP
+.TS
+tab(@);
+lw(24.2n) lw(45.8n).
+T{
+\f[C]2004/10/1\f[R], \f[C]2004-01-01\f[R], \f[C]2004.9.1\f[R]
+T}@T{
+exact date, several separators allowed.
+Year is 4+ digits, month is 1-12, day is 1-31
+T}
+T{
+\f[C]2004\f[R]
+T}@T{
+start of year
+T}
+T{
+\f[C]2004/10\f[R]
+T}@T{
+start of month
+T}
+T{
+\f[C]10/1\f[R]
+T}@T{
+month and day in current year
+T}
+T{
+\f[C]21\f[R]
+T}@T{
+day in current month
+T}
+T{
+\f[C]october, oct\f[R]
+T}@T{
+start of month in current year
+T}
+T{
+\f[C]yesterday, today, tomorrow\f[R]
+T}@T{
+-1, 0, 1 days from today
+T}
+T{
+\f[C]last/this/next day/week/month/quarter/year\f[R]
+T}@T{
+-1, 0, 1 periods from the current period
+T}
+T{
+\f[C]20181201\f[R]
+T}@T{
+8 digit YYYYMMDD with valid year month and day
+T}
+T{
+\f[C]201812\f[R]
+T}@T{
+6 digit YYYYMM with valid year and month
+T}
+.TE
+.PP
+Counterexamples - malformed digit sequences might give surprising
+results:
+.PP
+.TS
+tab(@);
+lw(11.4n) lw(58.6n).
+T{
+\f[C]201813\f[R]
+T}@T{
+6 digits with an invalid month is parsed as start of 6-digit year
+T}
+T{
+\f[C]20181301\f[R]
+T}@T{
+8 digits with an invalid month is parsed as start of 8-digit year
+T}
+T{
+\f[C]20181232\f[R]
+T}@T{
+8 digits with an invalid day gives an error
+T}
+T{
+\f[C]201801012\f[R]
+T}@T{
+9+ digits beginning with a valid YYYYMMDD gives an error
+T}
+.TE
+.SS Report start & end date
+.PP
+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 the journal.
+.PP
+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 \f[C]-b/--begin\f[R],
+\f[C]-e/--end\f[R], \f[C]-p/--period\f[R] or a \f[C]date:\f[R] query
+(described below).
+All of these accept the smart date syntax.
+.PP
+Some notes:
+.IP \[bu] 2
+As in Ledger, end dates are exclusive, so you need to write the date
+\f[I]after\f[R] the last day you want to include.
+.IP \[bu] 2
+As noted in reporting options: among start/end dates specified with
+\f[I]options\f[R], the last (i.e.
+right-most) option takes precedence.
+.IP \[bu] 2
+The effective report start and end dates are the intersection of the
+start/end dates from options and that from \f[C]date:\f[R] queries.
+That is, \f[C]date:2019-01 date:2019 -p\[aq]2000 to 2030\[aq]\f[R]
+yields January 2019, the smallest common time span.
+.PP
+Examples:
+.PP
+.TS
+tab(@);
+lw(11.9n) lw(58.1n).
+T{
+\f[C]-b 2016/3/17\f[R]
+T}@T{
+begin on St.\ Patrick\[cq]s day 2016
+T}
+T{
+\f[C]-e 12/1\f[R]
+T}@T{
+end at the start of december 1st of the current year (11/30 will be the
+last date included)
+T}
+T{
+\f[C]-b thismonth\f[R]
+T}@T{
+all transactions on or after the 1st of the current month
+T}
+T{
+\f[C]-p thismonth\f[R]
+T}@T{
+all transactions in the current month
+T}
+T{
+\f[C]date:2016/3/17-\f[R]
+T}@T{
+the above written as queries instead
+T}
+T{
+\f[C]date:-12/1\f[R]
+T}@T{
+T}
+T{
+\f[C]date:thismonth-\f[R]
+T}@T{
+T}
+T{
+\f[C]date:thismonth\f[R]
+T}@T{
+T}
+.TE
+.SS Report intervals
+.PP
+A report interval can be specified so that commands like register,
+balance and activity will divide their reports into multiple subperiods.
+The basic intervals can be selected with one of \f[C]-D/--daily\f[R],
+\f[C]-W/--weekly\f[R], \f[C]-M/--monthly\f[R], \f[C]-Q/--quarterly\f[R],
+or \f[C]-Y/--yearly\f[R].
+More complex intervals may be specified with a period expression.
+Report intervals can not be specified with a query.
+.SS Period expressions
+.PP
+The \f[C]-p/--period\f[R] option accepts period expressions, a shorthand
+way of expressing a start date, end date, and/or report interval all at
+once.
+.PP
+Here\[aq]s a basic period expression specifying the first quarter of
+2009.
+Note, hledger always treats start dates as inclusive and end dates as
+exclusive:
+.PP
+\f[C]-p \[dq]from 2009/1/1 to 2009/4/1\[dq]\f[R]
+.PP
+Keywords like \[dq]from\[dq] and \[dq]to\[dq] are optional, and so are
+the spaces, as long as you don\[aq]t run two dates together.
+\[dq]to\[dq] can also be written as \[dq]-\[dq].
+These are equivalent to the above:
+.PP
+.TS
+tab(@);
+l.
+T{
+\f[C]-p \[dq]2009/1/1 2009/4/1\[dq]\f[R]
+T}
+T{
+\f[C]-p2009/1/1to2009/4/1\f[R]
+T}
+T{
+\f[C]-p2009/1/1-2009/4/1\f[R]
+T}
+.TE
+.PP
+Dates are smart dates, so if the current year is 2009, the above can
+also be written as:
+.PP
+.TS
+tab(@);
+l.
+T{
+\f[C]-p \[dq]1/1 4/1\[dq]\f[R]
+T}
+T{
+\f[C]-p \[dq]january-apr\[dq]\f[R]
+T}
+T{
+\f[C]-p \[dq]this year to 4/1\[dq]\f[R]
+T}
+.TE
+.PP
+If you specify only one date, the missing start or end date will be the
+earliest or latest transaction in your journal:
+.PP
+.TS
+tab(@);
+l l.
+T{
+\f[C]-p \[dq]from 2009/1/1\[dq]\f[R]
+T}@T{
+everything after january 1, 2009
+T}
+T{
+\f[C]-p \[dq]from 2009/1\[dq]\f[R]
+T}@T{
+the same
+T}
+T{
+\f[C]-p \[dq]from 2009\[dq]\f[R]
+T}@T{
+the same
+T}
+T{
+\f[C]-p \[dq]to 2009\[dq]\f[R]
+T}@T{
+everything before january 1, 2009
+T}
+.TE
+.PP
+A single date with no \[dq]from\[dq] or \[dq]to\[dq] defines both the
+start and end date like so:
+.PP
+.TS
+tab(@);
+l l.
+T{
+\f[C]-p \[dq]2009\[dq]\f[R]
+T}@T{
+the year 2009; equivalent to \[lq]2009/1/1 to 2010/1/1\[rq]
+T}
+T{
+\f[C]-p \[dq]2009/1\[dq]\f[R]
+T}@T{
+the month of jan; equivalent to \[lq]2009/1/1 to 2009/2/1\[rq]
+T}
+T{
+\f[C]-p \[dq]2009/1/1\[dq]\f[R]
+T}@T{
+just that day; equivalent to \[lq]2009/1/1 to 2009/1/2\[rq]
+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],
+\f[C]monthly\f[R], \f[C]quarterly\f[R], or \f[C]yearly\f[R], which have
+the same effect as the
+\f[C]-D\f[R],\f[C]-W\f[R],\f[C]-M\f[R],\f[C]-Q\f[R], or \f[C]-Y\f[R]
+flags.
+Between report interval and start/end dates (if any), the word
+\f[C]in\f[R] is optional.
+Examples:
+.PP
+.TS
+tab(@);
+l.
+T{
+\f[C]-p \[dq]weekly from 2009/1/1 to 2009/4/1\[dq]\f[R]
+T}
+T{
+\f[C]-p \[dq]monthly in 2008\[dq]\f[R]
+T}
+T{
+\f[C]-p \[dq]quarterly\[dq]\f[R]
+T}
+.TE
+.PP
+Note that \f[C]weekly\f[R], \f[C]monthly\f[R], \f[C]quarterly\f[R] and
+\f[C]yearly\f[R] intervals will always start on the first day on week,
+month, quarter or year accordingly, and will end on the last day of same
+period, even if associated period expression specifies different
+explicit start and end date.
+.PP
+For example:
+.PP
+.TS
+tab(@);
+lw(25.5n) lw(44.5n).
+T{
+\f[C]-p \[dq]weekly from 2009/1/1 to 2009/4/1\[dq]\f[R]
+T}@T{
+starts on 2008/12/29, closest preceding Monday
+T}
+T{
+\f[C]-p \[dq]monthly in 2008/11/25\[dq]\f[R]
+T}@T{
+starts on 2018/11/01
+T}
+T{
+\f[C]-p \[dq]quarterly from 2009-05-05 to 2009-06-01\[dq]\f[R]
+T}@T{
+starts on 2009/04/01, ends on 2009/06/30, which are first and last days
+of Q2 2009
+T}
+T{
+\f[C]-p \[dq]yearly from 2009-12-29\[dq]\f[R]
+T}@T{
+starts on 2009/01/01, first day of 2009
+T}
+.TE
+.PP
+The following more complex report intervals are also supported:
+\f[C]biweekly\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
+All of these will start on the first day of the requested period and end
+on the last one, as described above.
+.PP
+Examples:
+.PP
+.TS
+tab(@);
+lw(25.5n) lw(44.5n).
+T{
+\f[C]-p \[dq]bimonthly from 2008\[dq]\f[R]
+T}@T{
+periods will have boundaries on 2008/01/01, 2008/03/01, ...
+T}
+T{
+\f[C]-p \[dq]every 2 weeks\[dq]\f[R]
+T}@T{
+starts on closest preceding Monday
+T}
+T{
+\f[C]-p \[dq]every 5 month from 2009/03\[dq]\f[R]
+T}@T{
+periods will have boundaries on 2009/03/01, 2009/08/01, ...
+T}
+.TE
+.PP
+If you want intervals that start on arbitrary day of your choosing and
+span a week, month or year, you need to use any of the following:
+.PP
+\f[C]every Nth day of week\f[R], \f[C]every <weekday>\f[R],
+\f[C]every Nth day [of month]\f[R],
+\f[C]every Nth weekday [of month]\f[R], \f[C]every MM/DD [of year]\f[R],
+\f[C]every Nth MMM [of year]\f[R], \f[C]every MMM Nth [of year]\f[R].
+.PP
+Examples:
+.PP
+.TS
+tab(@);
+lw(23.9n) lw(46.1n).
+T{
+\f[C]-p \[dq]every 2nd day of week\[dq]\f[R]
+T}@T{
+periods will go from Tue to Tue
+T}
+T{
+\f[C]-p \[dq]every Tue\[dq]\f[R]
+T}@T{
+same
+T}
+T{
+\f[C]-p \[dq]every 15th day\[dq]\f[R]
+T}@T{
+period boundaries will be on 15th of each month
+T}
+T{
+\f[C]-p \[dq]every 2nd Monday\[dq]\f[R]
+T}@T{
+period boundaries will be on second Monday of each month
+T}
+T{
+\f[C]-p \[dq]every 11/05\[dq]\f[R]
+T}@T{
+yearly periods with boundaries on 5th of Nov
+T}
+T{
+\f[C]-p \[dq]every 5th Nov\[dq]\f[R]
+T}@T{
+same
+T}
+T{
+\f[C]-p \[dq]every Nov 5th\[dq]\f[R]
+T}@T{
+same
+T}
+.TE
+.PP
+Show historical balances at end of 15th each month (N is exclusive end
+date):
+.PP
+\f[C]hledger balance -H -p \[dq]every 16th day\[dq]\f[R]
+.PP
+Group postings from start of wednesday to end of next tuesday (N is
+start date and exclusive end date):
+.PP
+\f[C]hledger register checking -p \[dq]every 3rd day of week\[dq]\f[R]
+.SS Depth limiting
+.PP
+With the \f[C]--depth N\f[R] option (short form: \f[C]-N\f[R]), commands
+like account, balance and register will show only the uppermost accounts
+in the account tree, down to level N.
+Use this when you want a summary with less detail.
+This flag has the same effect as a \f[C]depth:\f[R] query argument (so
+\f[C]-2\f[R], \f[C]--depth=2\f[R] or \f[C]depth:2\f[R] are basically
+equivalent).
+.SS Pivoting
+.PP
+Normally hledger sums amounts, and organizes them in a hierarchy, based
+on account name.
+The \f[C]--pivot FIELD\f[R] option causes it to sum and organize
+hierarchy based on the value of some other field instead.
+FIELD can be: \f[C]code\f[R], \f[C]description\f[R], \f[C]payee\f[R],
+\f[C]note\f[R], or the full name (case insensitive) of any tag.
+As with account names, values containing \f[C]colon:separated:parts\f[R]
+will be displayed hierarchically in reports.
+.PP
+\f[C]--pivot\f[R] is a general option affecting all reports; you can
+think of hledger transforming the journal before any other processing,
+replacing every posting\[aq]s account name with the value of the
+specified field on that posting, inheriting it from the transaction or
+using a blank value if it\[aq]s not present.
+.PP
+An example:
+.IP
+.nf
+\f[C]
+2016/02/16 Member Fee Payment
+    assets:bank account                    2 EUR
+    income:member fees                    -2 EUR  ; member: John Doe
+\f[R]
+.fi
+.PP
+Normal balance report showing account names:
+.IP
+.nf
+\f[C]
+$ hledger balance
+               2 EUR  assets:bank account
+              -2 EUR  income:member fees
+--------------------
+                   0
+\f[R]
+.fi
+.PP
+Pivoted balance report, using member: tag values instead:
+.IP
+.nf
+\f[C]
+$ hledger balance --pivot member
+               2 EUR
+              -2 EUR  John Doe
+--------------------
+                   0
+\f[R]
+.fi
+.PP
+One way to show only amounts with a member: value (using a query,
+described below):
+.IP
+.nf
+\f[C]
+$ hledger balance --pivot member tag:member=.
+              -2 EUR  John Doe
+--------------------
+              -2 EUR
+\f[R]
+.fi
+.PP
+Another way (the acct: query matches against the pivoted \[dq]account
+name\[dq]):
+.IP
+.nf
+\f[C]
+$ hledger balance --pivot member acct:.
+              -2 EUR  John Doe
+--------------------
+              -2 EUR
+\f[R]
+.fi
+.SS Valuation
+.SS -B: Cost
+.PP
+The \f[C]-B/--cost\f[R] flag converts amounts to their cost (or selling
+price) at transaction time, if they have a transaction price specified.
+This flag is equivalent to \f[C]--value=cost\f[R], described below.
+.SS -V: Market value
+.PP
+The \f[C]-V/--market\f[R] flag converts reported amounts to their market
+value in a default valuation commodity, using the market prices in
+effect on a default valuation date.
+For single period reports, the valuation date is today (equivalent to
+\f[C]--value=now\f[R]); for multiperiod reports, it is the last day of
+each subperiod (equivalent to \f[C]--value=end\f[R]).
+.PP
+The default valuation commodity is the one referenced in the latest
+applicable market price dated on or before the valuation date.
+If most of your P declarations lead to a single home currency, this will
+usually be what you want.
+(To specify the commodity, see -X below.)
+.PP
+Note that in hledger, market prices are always declared explicitly with
+P directives; we do not infer them from transaction prices as Ledger
+does.
+.PP
+Here\[aq]s a quick example of -V:
+.IP
+.nf
+\f[C]
+; one euro is worth this many dollars from nov 1
+P 2016/11/01 \[Eu] $1.10
+
+; purchase some euros on nov 3
+2016/11/3
+    assets:euros        \[Eu]100
+    assets:checking
+
+; the euro is worth fewer dollars by dec 21
+P 2016/12/21 \[Eu] $1.03
+\f[R]
+.fi
+.PP
+How many euros do I have ?
+.IP
+.nf
+\f[C]
+$ hledger -f t.j bal -N euros
+                \[Eu]100  assets:euros
+\f[R]
+.fi
+.PP
+What are they worth at end of nov 3 ?
+.IP
+.nf
+\f[C]
+$ hledger -f t.j bal -N euros -V -e 2016/11/4
+             $110.00  assets:euros
+\f[R]
+.fi
+.PP
+What are they worth after 2016/12/21 ?
+(no report end date specified, defaults to today)
+.IP
+.nf
+\f[C]
+$ hledger -f t.j bal -N euros -V
+             $103.00  assets:euros
+\f[R]
+.fi
+.SS -X: Market value in specified commodity
+.PP
+The \f[C]-X/--exchange\f[R] option is like \f[C]-V\f[R], except it
+specifies the target commodity you would like to convert to.
+It is equivalent to \f[C]--value=now,COMM\f[R] or
+\f[C]--value=end,COMM\f[R].
+.SS --value: Flexible valuation
+.PP
+\f[I](experimental, added 201905)\f[R]
+.PP
+\f[C]-B\f[R], \f[C]-V\f[R] and \f[C]-X\f[R] are special cases of the
+more general \f[C]--value\f[R] option:
+.IP
+.nf
+\f[C]
+ --value=TYPE[,COMM]  TYPE is cost, then, end, now or YYYY-MM-DD.
+                      COMM is an optional commodity symbol.
+                      Shows amounts converted to:
+                      - cost commodity using transaction prices (then optionally to COMM using market prices at period end(s))
+                      - default valuation commodity (or COMM) using market prices at posting dates
+                      - default valuation commodity (or COMM) using market prices at period end(s)
+                      - default valuation commodity (or COMM) using current market prices
+                      - default valuation commodity (or COMM) using market prices at some date
+\f[R]
+.fi
+.PP
+The TYPE part basically selects either \[dq]cost\[dq], or \[dq]market
+value\[dq] plus a valuation date:
+.TP
+\f[B]\f[CB]--value=cost\f[B]\f[R]
+Convert amounts to cost, using the prices recorded in transactions.
+.TP
+\f[B]\f[CB]--value=then\f[B]\f[R]
+Convert amounts to their value in a default valuation commodity, using
+market prices on each posting\[aq]s date.
+This is currently supported only by the print and register commands.
+.TP
+\f[B]\f[CB]--value=end\f[B]\f[R]
+Convert amounts to their value in a default valuation commodity, using
+market prices on the last day of the report period (or if unspecified,
+the journal\[aq]s end date); or in multiperiod reports, market prices on
+the last day of each subperiod.
+.TP
+\f[B]\f[CB]--value=now\f[B]\f[R]
+Convert amounts to their value in default valuation commodity using
+current market prices (as of when report is generated).
+.TP
+\f[B]\f[CB]--value=YYYY-MM-DD\f[B]\f[R]
+Convert amounts to their value in default valuation commodity using
+market prices on this date.
+.PP
+The default valuation commodity is the commodity mentioned in the most
+recent applicable market price declaration.
+When all your price declarations lead to a single home currency, this
+will usually do what you want.
+.PP
+To select a different valuation commodity, add the optional
+\f[C],COMM\f[R] part: a comma, then the target commodity\[aq]s symbol.
+Eg: \f[B]\f[CB]--value=now,EUR\f[B]\f[R].
+hledger will do its best to convert amounts to this commodity, using:
+.IP \[bu] 2
+declared prices (from source commodity to valuation commodity)
+.IP \[bu] 2
+reverse prices (declared prices from valuation to source commodity,
+inverted)
+.IP \[bu] 2
+indirect prices (prices calculated from the shortest chain of declared
+or reverse prices from source to valuation commodity)
+.PP
+in that order.
+.PP
+Here are some examples showing the effect of \f[C]--value\f[R] as seen
+with \f[C]print\f[R]:
+.IP
+.nf
+\f[C]
+P 2000-01-01 A  1 B
+P 2000-02-01 A  2 B
+P 2000-03-01 A  3 B
+P 2000-04-01 A  4 B
+
+2000-01-01
+  (a)      1 A \[at] 5 B
+
+2000-02-01
+  (a)      1 A \[at] 6 B
+
+2000-03-01
+  (a)      1 A \[at] 7 B
+\f[R]
+.fi
+.PP
+Show the cost of each posting:
+.IP
+.nf
+\f[C]
+$ hledger -f- print --value=cost
+2000-01-01
+    (a)             5 B
+
+2000-02-01
+    (a)             6 B
+
+2000-03-01
+    (a)             7 B
+\f[R]
+.fi
+.PP
+Show the value as of the last day of the report period (2000-02-29):
+.IP
+.nf
+\f[C]
+$ hledger -f- print --value=end date:2000/01-2000/03
+2000-01-01
+    (a)             2 B
+
+2000-02-01
+    (a)             2 B
+\f[R]
+.fi
+.PP
+With no report period specified, that shows the value as of the last day
+of the journal (2000-03-01):
+.IP
+.nf
+\f[C]
+$ hledger -f- print --value=end
+2000-01-01
+    (a)             3 B
+
+2000-02-01
+    (a)             3 B
+
+2000-03-01
+    (a)             3 B
+\f[R]
+.fi
+.PP
+Show the current value (the 2000-04-01 price is still in effect today):
+.IP
+.nf
+\f[C]
+$ hledger -f- print --value=now
+2000-01-01
+    (a)             4 B
+
+2000-02-01
+    (a)             4 B
+
+2000-03-01
+    (a)             4 B
+\f[R]
+.fi
+.PP
+Show the value on 2000/01/15:
+.IP
+.nf
+\f[C]
+$ hledger -f- print --value=2000-01-15
+2000-01-01
+    (a)             1 B
+
+2000-02-01
+    (a)             1 B
+
+2000-03-01
+    (a)             1 B
+\f[R]
+.fi
+.PP
+You may need to explicitly set a commodity\[aq]s display style, when
+reverse prices are used.
+Eg this output might be surprising:
+.IP
+.nf
+\f[C]
+P 2000-01-01 A 2B
+
+2000-01-01
+  a  1B
+  b
+\f[R]
+.fi
+.IP
+.nf
+\f[C]
+$ hledger print -x -X A
+2000-01-01
+    a               0
+    b               0
+\f[R]
+.fi
+.PP
+Explanation: because there\[aq]s no amount or commodity directive
+specifying a display style for A, 0.5A gets the default style, which
+shows no decimal digits.
+Because the displayed amount looks like zero, the commodity symbol and
+minus sign are not displayed either.
+Adding a commodity directive sets a more useful display style for A:
+.IP
+.nf
+\f[C]
+P 2000-01-01 A 2B
+commodity 0.00A
+
+2000-01-01
+  a  1B
+  b
+\f[R]
+.fi
+.IP
+.nf
+\f[C]
+$ hledger print -X A
+2000-01-01
+    a           0.50A
+    b          -0.50A
+\f[R]
+.fi
+.SS Effect of --value on reports
+.PP
+Here is a reference for how \f[C]--value\f[R] currently affects each
+part of hledger\[aq]s reports.
+It\[aq]s work in progress, but may be useful for troubleshooting or
+reporting bugs.
+See also the definitions and notes below.
+If you find problems, please report them, ideally with a reproducible
+example.
+Related: #329, #1083.
+.PP
+.TS
+tab(@);
+lw(11.7n) lw(11.2n) lw(11.9n) lw(13.1n) lw(12.4n) lw(9.8n).
+T{
+Report type
+T}@T{
+\f[C]-B\f[R], \f[C]--value=cost\f[R]
+T}@T{
+\f[C]-V\f[R], \f[C]-X\f[R]
+T}@T{
+\f[C]--value=then\f[R]
+T}@T{
+\f[C]--value=end\f[R]
+T}@T{
+\f[C]--value=DATE\f[R], \f[C]--value=now\f[R]
+T}
+_
+T{
+\f[B]print\f[R]
+T}@T{
+T}@T{
+T}@T{
+T}@T{
+T}@T{
+T}
+T{
+posting amounts
+T}@T{
+cost
+T}@T{
+value at report end or today
+T}@T{
+value at posting date
+T}@T{
+value at report or journal end
+T}@T{
+value at DATE/today
+T}
+T{
+balance assertions / assignments
+T}@T{
+unchanged
+T}@T{
+unchanged
+T}@T{
+unchanged
+T}@T{
+unchanged
+T}@T{
+unchanged
+T}
+T{
+T}@T{
+T}@T{
+T}@T{
+T}@T{
+T}@T{
+T}
+T{
+\f[B]register\f[R]
+T}@T{
+T}@T{
+T}@T{
+T}@T{
+T}@T{
+T}
+T{
+starting balance (with -H)
+T}@T{
+cost
+T}@T{
+value at day before report or journal start
+T}@T{
+not supported
+T}@T{
+value at day before report or journal start
+T}@T{
+value at DATE/today
+T}
+T{
+posting amounts (no report interval)
+T}@T{
+cost
+T}@T{
+value at report end or today
+T}@T{
+value at posting date
+T}@T{
+value at report or journal end
+T}@T{
+value at DATE/today
+T}
+T{
+summary posting amounts (with report interval)
+T}@T{
+summarised cost
+T}@T{
+value at period ends
+T}@T{
+sum of postings in interval, valued at interval start
+T}@T{
+value at period ends
+T}@T{
+value at DATE/today
+T}
+T{
+running total/average
+T}@T{
+sum/average of displayed values
+T}@T{
+sum/average of displayed values
+T}@T{
+sum/average of displayed values
+T}@T{
+sum/average of displayed values
+T}@T{
+sum/average of displayed values
+T}
+T{
+T}@T{
+T}@T{
+T}@T{
+T}@T{
+T}@T{
+T}
+T{
+\f[B]balance (bs, bse, cf, is..)\f[R]
+T}@T{
+T}@T{
+T}@T{
+T}@T{
+T}@T{
+T}
+T{
+balances (no report interval)
+T}@T{
+sums of costs
+T}@T{
+value at report end or today of sums of postings
+T}@T{
+not supported
+T}@T{
+value at report or journal end of sums of postings
+T}@T{
+value at DATE/today of sums of postings
+T}
+T{
+balances (with report interval)
+T}@T{
+sums of costs
+T}@T{
+value at period ends of sums of postings
+T}@T{
+not supported
+T}@T{
+value at period ends of sums of postings
+T}@T{
+value at DATE/today of sums of postings
+T}
+T{
+starting balances (with report interval and -H)
+T}@T{
+sums of costs of postings before report start
+T}@T{
+sums of postings before report start
+T}@T{
+not supported
+T}@T{
+sums of postings before report start
+T}@T{
+sums of postings before report start
+T}
+T{
+budget amounts with --budget
+T}@T{
+like balances
+T}@T{
+like balances
+T}@T{
+not supported
+T}@T{
+like balances
+T}@T{
+like balances
+T}
+T{
+grand total (no report interval)
+T}@T{
+sum of displayed values
+T}@T{
+sum of displayed values
+T}@T{
+not supported
+T}@T{
+sum of displayed values
+T}@T{
+sum of displayed values
+T}
+T{
+row totals/averages (with report interval)
+T}@T{
+sums/averages of displayed values
+T}@T{
+sums/averages of displayed values
+T}@T{
+not supported
+T}@T{
+sums/averages of displayed values
+T}@T{
+sums/averages of displayed values
+T}
+T{
+column totals
+T}@T{
+sums of displayed values
+T}@T{
+sums of displayed values
+T}@T{
+not supported
+T}@T{
+sums of displayed values
+T}@T{
+sums of displayed values
+T}
+T{
+grand total/average
+T}@T{
+sum/average of column totals
+T}@T{
+sum/average of column totals
+T}@T{
+not supported
+T}@T{
+sum/average of column totals
+T}@T{
+sum/average of column totals
+T}
+T{
+T}@T{
+T}@T{
+T}@T{
+T}@T{
+T}@T{
+T}
+.TE
+.PP
+\f[B]Additional notes\f[R]
+.TP
+\f[I]cost\f[R]
+calculated using price(s) recorded in the transaction(s).
+.TP
+\f[I]value\f[R]
+market value using available market price declarations, or the unchanged
+amount if no conversion rate can be found.
+.TP
+\f[I]report start\f[R]
+the first day of the report period specified with -b or -p or date:,
+otherwise today.
+.TP
+\f[I]report or journal start\f[R]
+the first day of the report period specified with -b or -p or date:,
+otherwise the earliest transaction date in the journal, otherwise today.
+.TP
+\f[I]report end\f[R]
+the last day of the report period specified with -e or -p or date:,
+otherwise today.
+.TP
+\f[I]report or journal end\f[R]
+the last day of the report period specified with -e or -p or date:,
+otherwise the latest transaction date in the journal, otherwise today.
+.TP
+\f[I]report interval\f[R]
+a flag (-D/-W/-M/-Q/-Y) or period expression that activates the
+report\[aq]s multi-period mode (whether showing one or many subperiods).
+.SS Combining -B, -V, -X, --value
+.PP
+The rightmost of these flags wins.
+.SH COMMANDS
+.PP
+hledger provides a number of subcommands; \f[C]hledger\f[R] with no
+arguments shows a list.
+.PP
+If you install additional \f[C]hledger-*\f[R] packages, or if you put
+programs or scripts named \f[C]hledger-NAME\f[R] in your PATH, these
+will also be listed as subcommands.
+.PP
+Run a subcommand by writing its name as first argument (eg
+\f[C]hledger incomestatement\f[R]).
+You can also write one of the standard short aliases displayed in
+parentheses in the command list (\f[C]hledger b\f[R]), or any any
+unambiguous prefix of a command name (\f[C]hledger inc\f[R]).
+.PP
+Here are all the builtin commands in alphabetical order.
+See also \f[C]hledger\f[R] for a more organised command list, and
+\f[C]hledger CMD -h\f[R] for detailed command help.
+.SS accounts
+.PP
+accounts, a
+.PD 0
+.P
+.PD
+Show account names.
+.PP
+This command lists account names, either declared with account
+directives (--declared), posted to (--used), or both (the default).
+With query arguments, only matched account names and account names
+referenced by matched postings are shown.
+It shows a flat list by default.
+With \f[C]--tree\f[R], it uses indentation to show the account
+hierarchy.
+In flat mode you can add \f[C]--drop N\f[R] to omit the first few
+account name components.
+Account names can be depth-clipped with \f[C]depth:N\f[R] or
+\f[C]--depth N\f[R] or \f[C]-N\f[R].
+.PP
+Examples:
+.IP
+.nf
+\f[C]
+$ hledger accounts
+assets:bank:checking
+assets:bank:saving
+assets:cash
+expenses:food
+expenses:supplies
+income:gifts
+income:salary
+liabilities:debts
+\f[R]
+.fi
+.SS activity
+.PP
+activity
+.PD 0
+.P
+.PD
+Show an ascii barchart of posting counts per interval.
+.PP
+The activity command displays an ascii histogram showing transaction
+counts by day, week, month or other reporting interval (by day is the
+default).
+With query arguments, it counts only matched transactions.
+.PP
+Examples:
+.IP
+.nf
+\f[C]
+$ hledger activity --quarterly
+2008-01-01 **
+2008-04-01 *******
+2008-07-01 
+2008-10-01 **
+\f[R]
+.fi
+.SS add
+.PP
+add
+.PD 0
+.P
+.PD
+Prompt for transactions and add them to the journal.
+.PP
+Many hledger users edit their journals directly with a text editor, or
+generate them from CSV.
+For more interactive data entry, there is the \f[C]add\f[R] command,
+which prompts interactively on the console for new transactions, and
+appends them to the journal file (if there are multiple
+\f[C]-f FILE\f[R] options, the first file is used.) Existing
+transactions are not changed.
+This is the only hledger command that writes to the journal file.
+.PP
+To use it, just run \f[C]hledger add\f[R] and follow the prompts.
+You can add as many transactions as you like; when you are finished,
+enter \f[C].\f[R] or press control-d or control-c to exit.
+.PP
+Features:
+.IP \[bu] 2
+add tries to provide useful defaults, using the most similar (by
+description) recent transaction (filtered by the query, if any) as a
+template.
+.IP \[bu] 2
+You can also set the initial defaults with command line arguments.
+.IP \[bu] 2
+Readline-style edit keys can be used during data entry.
+.IP \[bu] 2
+The tab key will auto-complete whenever possible - accounts,
+descriptions, dates (\f[C]yesterday\f[R], \f[C]today\f[R],
+\f[C]tomorrow\f[R]).
+If the input area is empty, it will insert the default value.
+.IP \[bu] 2
+If the journal defines a default commodity, it will be added to any bare
+numbers entered.
+.IP \[bu] 2
+A parenthesised transaction code may be entered following a date.
+.IP \[bu] 2
+Comments and tags may be entered following a description or amount.
+.IP \[bu] 2
+If you make a mistake, enter \f[C]<\f[R] at any prompt to go one step
+backward.
+.IP \[bu] 2
+Input prompts are displayed in a different colour when the terminal
+supports it.
+.PP
+Example (see the tutorial for a detailed explanation):
+.IP
+.nf
+\f[C]
+$ hledger add
+Adding transactions to journal file /src/hledger/examples/sample.journal
+Any command line arguments will be used as defaults.
+Use tab key to complete, readline keys to edit, enter to accept defaults.
+An optional (CODE) may follow transaction dates.
+An optional ; COMMENT may follow descriptions or amounts.
+If you make a mistake, enter < at any prompt to go one step backward.
+To end a transaction, enter . when prompted.
+To quit, enter . at a date prompt or press control-d or control-c.
+Date [2015/05/22]: 
+Description: supermarket
+Account 1: expenses:food
+Amount  1: $10
+Account 2: assets:checking
+Amount  2 [$-10.0]: 
+Account 3 (or . or enter to finish this transaction): .
+2015/05/22 supermarket
+    expenses:food             $10
+    assets:checking        $-10.0
+
+Save this transaction to the journal ? [y]: 
+Saved.
+Starting the next transaction (. or ctrl-D/ctrl-C to quit)
+Date [2015/05/22]: <CTRL-D> $
+\f[R]
+.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).
+.SS balance
+.PP
+balance, bal, b
+.PD 0
+.P
+.PD
+Show accounts and their balances.
+.PP
+The balance command is hledger\[aq]s most versatile command.
+Note, despite the name, it is not always used for showing real-world
+account balances; the more accounting-aware balancesheet and
+incomestatement may be more convenient for that.
+.PP
+By default, it displays all accounts, and each account\[aq]s change in
+balance during the entire period of the journal.
+Balance changes are calculated by adding up the postings in each
+account.
+You can limit the postings matched, by a query, to see fewer accounts,
+changes over a different time period, changes from only cleared
+transactions, etc.
+.PP
+If you include an account\[aq]s complete history of postings in the
+report, the balance change is equivalent to the account\[aq]s current
+ending balance.
+For a real-world account, typically you won\[aq]t have all transactions
+in the journal; instead you\[aq]ll have all transactions after a certain
+date, and an \[dq]opening balances\[dq] transaction setting the correct
+starting balance on that date.
+Then the balance command will show real-world account balances.
+In some cases the -H/--historical flag is used to ensure this (more
+below).
+.PP
+The balance command can produce several styles of report:
+.SS Classic balance report
+.PP
+This is the original balance report, as found in Ledger.
+It usually looks like this:
+.IP
+.nf
+\f[C]
+$ hledger balance
+                 $-1  assets
+                  $1    bank:saving
+                 $-2    cash
+                  $2  expenses
+                  $1    food
+                  $1    supplies
+                 $-2  income
+                 $-1    gifts
+                 $-1    salary
+                  $1  liabilities:debts
+--------------------
+                   0
+\f[R]
+.fi
+.PP
+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 \f[C]-S/--sort-amount\f[R], by their balance amount.
+.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
+compact output.
+(Eg above, the \[dq]liabilities\[dq] account.) Use \f[C]--no-elide\f[R]
+to prevent this.
+.PP
+Account balances are \[dq]inclusive\[dq] - they include the balances of
+any subaccounts.
+.PP
+Accounts which have zero balance (and no non-zero subaccounts) are
+omitted.
+Use \f[C]-E/--empty\f[R] to show them.
+.PP
+A final total is displayed by default; use \f[C]-N/--no-total\f[R] to
+suppress it, eg:
+.IP
+.nf
+\f[C]
+$ hledger balance -p 2008/6 expenses --no-total
+                  $2  expenses
+                  $1    food
+                  $1    supplies
+\f[R]
+.fi
+.SS Customising the classic balance report
+.PP
+You can customise the layout of classic balance reports with
+\f[C]--format FMT\f[R]:
+.IP
+.nf
+\f[C]
+$ hledger balance --format \[dq]%20(account) %12(total)\[dq]
+              assets          $-1
+         bank:saving           $1
+                cash          $-2
+            expenses           $2
+                food           $1
+            supplies           $1
+              income          $-2
+               gifts          $-1
+              salary          $-1
+   liabilities:debts           $1
+---------------------------------
+                                0
+\f[R]
+.fi
+.PP
+The FMT format string (plus a newline) specifies the formatting applied
+to each account/balance pair.
+It may contain any suitable text, with data fields interpolated like so:
+.PP
+\f[C]%[MIN][.MAX](FIELDNAME)\f[R]
+.IP \[bu] 2
+MIN pads with spaces to at least this width (optional)
+.IP \[bu] 2
+MAX truncates at this width (optional)
+.IP \[bu] 2
+FIELDNAME must be enclosed in parentheses, and can be one of:
+.RS 2
+.IP \[bu] 2
+\f[C]depth_spacer\f[R] - a number of spaces equal to the account\[aq]s
+depth, or if MIN is specified, MIN * depth spaces.
+.IP \[bu] 2
+\f[C]account\f[R] - the account\[aq]s name
+.IP \[bu] 2
+\f[C]total\f[R] - the account\[aq]s balance/posted total, right
+justified
+.RE
+.PP
+Also, FMT can begin with an optional prefix to control how
+multi-commodity amounts are rendered:
+.IP \[bu] 2
+\f[C]%_\f[R] - render on multiple lines, bottom-aligned (the default)
+.IP \[bu] 2
+\f[C]%\[ha]\f[R] - render on multiple lines, top-aligned
+.IP \[bu] 2
+\f[C]%,\f[R] - render on one line, comma-separated
+.PP
+There are some quirks.
+Eg in one-line mode, \f[C]%(depth_spacer)\f[R] has no effect, instead
+\f[C]%(account)\f[R] has indentation built in.
+Experimentation may be needed to get pleasing results.
+.PP
+Some example formats:
+.IP \[bu] 2
+\f[C]%(total)\f[R] - the account\[aq]s total
+.IP \[bu] 2
+\f[C]%-20.20(account)\f[R] - the account\[aq]s name, left justified,
+padded to 20 characters and clipped at 20 characters
+.IP \[bu] 2
+\f[C]%,%-50(account)  %25(total)\f[R] - account name padded to 50
+characters, total padded to 20 characters, with multiple commodities
+rendered on one line
+.IP \[bu] 2
+\f[C]%20(total)  %2(depth_spacer)%-(account)\f[R] - the default format
+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
+.SS Flat mode
+.PP
+To see a flat list instead of the default hierarchical display, use
+\f[C]--flat\f[R].
+In this mode, accounts (unless depth-clipped) show their full names and
+\[dq]exclusive\[dq] balance, excluding any subaccount balances.
+In this mode, you can also use \f[C]--drop N\f[R] to omit the first few
+account name components.
+.IP
+.nf
+\f[C]
+$ hledger balance -p 2008/6 expenses -N --flat --drop 1
+                  $1  food
+                  $1  supplies
+\f[R]
+.fi
+.SS Depth limited balance reports
+.PP
+With \f[C]--depth N\f[R] or \f[C]depth:N\f[R] or just \f[C]-N\f[R],
+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.
+.IP
+.nf
+\f[C]
+$ hledger balance -N -1
+                 $-1  assets
+                  $2  expenses
+                 $-2  income
+                  $1  liabilities
+\f[R]
+.fi
+.PP
+Flat-mode balance reports, which normally show exclusive balances, show
+inclusive balances at the depth limit.
+.SS Percentages
+.PP
+With \f[C]-%\f[R] or \f[C]--percent\f[R], balance reports show each
+account\[aq]s value expressed as a percentage of the column\[aq]s total.
+This is useful to get an overview of the relative sizes of account
+balances.
+For example to obtain an overview of expenses:
+.IP
+.nf
+\f[C]
+$ hledger balance expenses -%
+             100.0 %  expenses
+              50.0 %    food
+              50.0 %    supplies
+--------------------
+             100.0 %
+\f[R]
+.fi
+.PP
+Note that \f[C]--tree\f[R] does not have an effect on \f[C]-%\f[R].
+The percentages are always relative to the total sum of each column,
+they are never relative to the parent account.
+.PP
+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
+\f[C]hledger balance -B\f[R]) all percentage values will be zero.
+.PP
+This flag does not work if the report contains any mixed commodity
+accounts.
+If there are mixed commodity accounts in the report be sure to use
+\f[C]-V\f[R] or \f[C]-B\f[R] to coerce the report into using a single
+commodity.
+.SS Multicolumn balance report
+.PP
+Multicolumn or tabular balance reports are a very useful hledger
+feature, and usually the preferred style.
+They share many of the above features, but they show the report as a
+table, with columns representing time periods.
+This mode is activated by providing a reporting interval.
+.PP
+There are three types of multicolumn balance report, showing different
+information:
+.IP "1." 3
+By default: each column shows the sum of postings in that period, ie the
+account\[aq]s change of balance in that period.
+This is useful eg for a monthly income statement:
+.RS 4
+.IP
+.nf
+\f[C]
+$ hledger balance --quarterly income expenses -E
+Balance changes in 2008:
+
+                   ||  2008q1  2008q2  2008q3  2008q4 
+===================++=================================
+ expenses:food     ||       0      $1       0       0 
+ expenses:supplies ||       0      $1       0       0 
+ income:gifts      ||       0     $-1       0       0 
+ income:salary     ||     $-1       0       0       0 
+-------------------++---------------------------------
+                   ||     $-1      $1       0       0 
+\f[R]
+.fi
+.RE
+.IP "2." 3
+With \f[C]--cumulative\f[R]: each column shows the ending balance for
+that period, accumulating the changes across periods, starting from 0 at
+the report start date:
+.RS 4
+.IP
+.nf
+\f[C]
+$ hledger balance --quarterly income expenses -E --cumulative
+Ending balances (cumulative) in 2008:
+
+                   ||  2008/03/31  2008/06/30  2008/09/30  2008/12/31 
+===================++=================================================
+ expenses:food     ||           0          $1          $1          $1 
+ expenses:supplies ||           0          $1          $1          $1 
+ income:gifts      ||           0         $-1         $-1         $-1 
+ income:salary     ||         $-1         $-1         $-1         $-1 
+-------------------++-------------------------------------------------
+                   ||         $-1           0           0           0 
+\f[R]
+.fi
+.RE
+.IP "3." 3
+With \f[C]--historical/-H\f[R]: 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 useful eg for a multi-period balance sheet, and when you are
+showing only the data after a certain start date:
+.RS 4
+.IP
+.nf
+\f[C]
+$ hledger balance \[ha]assets \[ha]liabilities --quarterly --historical --begin 2008/4/1
+Ending balances (historical) in 2008/04/01-2008/12/31:
+
+                      ||  2008/06/30  2008/09/30  2008/12/31 
+======================++=====================================
+ assets:bank:checking ||          $1          $1           0 
+ assets:bank:saving   ||          $1          $1          $1 
+ assets:cash          ||         $-2         $-2         $-2 
+ liabilities:debts    ||           0           0          $1 
+----------------------++-------------------------------------
+                      ||           0           0           0 
+\f[R]
+.fi
+.RE
+.PP
+Note that \f[C]--cumulative\f[R] or \f[C]--historical/-H\f[R] disable
+\f[C]--row-total/-T\f[R], since summing end balances generally does not
+make sense.
+.PP
+Multicolumn balance reports display accounts in flat mode by default; to
+see the hierarchy, use \f[C]--tree\f[R].
+.PP
+With a reporting interval (like \f[C]--quarterly\f[R] 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 periods will be \[dq]full\[dq] and
+comparable to the others.
+.PP
+The \f[C]-E/--empty\f[R] flag does two things in multicolumn balance
+reports: first, the report will show all columns within the specified
+report period (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).
+.PP
+The \f[C]-T/--row-total\f[R] flag adds an additional column showing the
+total for each row.
+.PP
+The \f[C]-A/--average\f[R] flag adds a column showing the average value
+in each row.
+.PP
+Here\[aq]s an example of all three:
+.IP
+.nf
+\f[C]
+$ hledger balance -Q income expenses --tree -ETA
+Balance changes in 2008:
+
+            ||  2008q1  2008q2  2008q3  2008q4    Total  Average 
+============++===================================================
+ expenses   ||       0      $2       0       0       $2       $1 
+   food     ||       0      $1       0       0       $1        0 
+   supplies ||       0      $1       0       0       $1        0 
+ income     ||     $-1     $-1       0       0      $-2      $-1 
+   gifts    ||       0     $-1       0       0      $-1        0 
+   salary   ||     $-1       0       0       0      $-1        0 
+------------++---------------------------------------------------
+            ||     $-1      $1       0       0        0        0 
+
+(Average is rounded to the dollar here since all journal amounts are)
+\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.
+.SS Budget report
+.PP
+With \f[C]--budget\f[R], 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 income, expenses,
+time usage, etc.
+--budget is most often combined with a report interval.
+.PP
+For example, you can take average monthly expenses in the common expense
+categories to construct a minimal monthly budget:
+.IP
+.nf
+\f[C]
+;; Budget
+\[ti] monthly
+  income  $2000
+  expenses:food    $400
+  expenses:bus     $50
+  expenses:movies  $30
+  assets:bank:checking
+
+;; Two months worth of expenses
+2017-11-01
+  income  $1950
+  expenses:food    $396
+  expenses:bus     $49
+  expenses:movies  $30
+  expenses:supplies  $20
+  assets:bank:checking
+
+2017-12-01
+  income  $2100
+  expenses:food    $412
+  expenses:bus     $53
+  expenses:gifts   $100
+  assets:bank:checking
+\f[R]
+.fi
+.PP
+You can now see a monthly budget report:
+.IP
+.nf
+\f[C]
+$ hledger balance -M --budget
+Budget performance in 2017/11/01-2017/12/31:
+
+                      ||                      Nov                       Dec 
+======================++====================================================
+ assets               || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
+ assets:bank          || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
+ assets:bank:checking || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
+ expenses             ||   $495 [ 103% of   $480]    $565 [ 118% of   $480] 
+ expenses:bus         ||    $49 [  98% of    $50]     $53 [ 106% of    $50] 
+ expenses:food        ||   $396 [  99% of   $400]    $412 [ 103% of   $400] 
+ expenses:movies      ||    $30 [ 100% of    $30]       0 [   0% of    $30] 
+ income               ||  $1950 [  98% of  $2000]   $2100 [ 105% of  $2000] 
+----------------------++----------------------------------------------------
+                      ||      0 [              0]       0 [              0] 
+\f[R]
+.fi
+.PP
+Note this is different from a normal balance report in several ways:
+.IP \[bu] 2
+Only accounts with budget goals during the report period are shown, by
+default.
+.IP \[bu] 2
+In each column, in square brackets after the actual amount, budgeted
+amounts are shown, along with the percentage of budget used.
+.IP \[bu] 2
+All parent accounts are always shown, even in flat mode.
+Eg assets, assets:bank, and expenses above.
+.IP \[bu] 2
+Amounts always include all subaccounts, budgeted or unbudgeted, even in
+flat mode.
+.PP
+This means that the numbers displayed will not always add up! Eg above,
+the \f[C]expenses\f[R] actual amount includes the gifts and supplies
+transactions, but the \f[C]expenses:gifts\f[R] and
+\f[C]expenses:supplies\f[R] accounts are not shown, as they have no
+budget amounts declared.
+.PP
+This can be confusing.
+When you need to make things clearer, use the \f[C]-E/--empty\f[R] flag,
+which will reveal all accounts including unbudgeted ones, giving the
+full picture.
+Eg:
+.IP
+.nf
+\f[C]
+$ hledger balance -M --budget --empty
+Budget performance in 2017/11/01-2017/12/31:
+
+                      ||                      Nov                       Dec 
+======================++====================================================
+ assets               || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
+ assets:bank          || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
+ assets:bank:checking || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
+ expenses             ||   $495 [ 103% of   $480]    $565 [ 118% of   $480] 
+ expenses:bus         ||    $49 [  98% of    $50]     $53 [ 106% of    $50] 
+ expenses:food        ||   $396 [  99% of   $400]    $412 [ 103% of   $400] 
+ expenses:gifts       ||      0                      $100                   
+ expenses:movies      ||    $30 [ 100% of    $30]       0 [   0% of    $30] 
+ expenses:supplies    ||    $20                         0                   
+ income               ||  $1950 [  98% of  $2000]   $2100 [ 105% of  $2000] 
+----------------------++----------------------------------------------------
+                      ||      0 [              0]       0 [              0] 
+\f[R]
+.fi
+.PP
+You can roll over unspent budgets to next period with
+\f[C]--cumulative\f[R]:
+.IP
+.nf
+\f[C]
+$ hledger balance -M --budget --cumulative
+Budget performance in 2017/11/01-2017/12/31:
+
+                      ||                      Nov                       Dec 
+======================++====================================================
+ assets               || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960] 
+ assets:bank          || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960] 
+ assets:bank:checking || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960] 
+ expenses             ||   $495 [ 103% of   $480]   $1060 [ 110% of   $960] 
+ expenses:bus         ||    $49 [  98% of    $50]    $102 [ 102% of   $100] 
+ expenses:food        ||   $396 [  99% of   $400]    $808 [ 101% of   $800] 
+ expenses:movies      ||    $30 [ 100% of    $30]     $30 [  50% of    $60] 
+ income               ||  $1950 [  98% of  $2000]   $4050 [ 101% of  $4000] 
+----------------------++----------------------------------------------------
+                      ||      0 [              0]       0 [              0] 
+\f[R]
+.fi
+.PP
+For more examples, see Budgeting and Forecasting.
+.SS Nested budgets
+.PP
+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 budget(s) of the child account(s) would be added to the budget of
+their parent, much like account balances behave.
+.PP
+In the most simple case this means that once you add a budget to any
+account, all its parents would have budget as well.
+.PP
+To illustrate this, consider the following budget:
+.IP
+.nf
+\f[C]
+\[ti] monthly from 2019/01
+    expenses:personal             $1,000.00
+    expenses:personal:electronics    $100.00
+    liabilities
+\f[R]
+.fi
+.PP
+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 \f[C]expenses:personal\f[R] and
+\f[C]expenses\f[R] is $1100.
+.PP
+Transactions in \f[C]expenses:personal:electronics\f[R] will be counted
+both towards its $100 budget and $1100 of \f[C]expenses:personal\f[R] ,
+and transactions in any other subaccount of \f[C]expenses:personal\f[R]
+would be counted towards only towards the budget of
+\f[C]expenses:personal\f[R].
+.PP
+For example, let\[aq]s consider these transactions:
+.IP
+.nf
+\f[C]
+\[ti] monthly from 2019/01
+    expenses:personal             $1,000.00
+    expenses:personal:electronics    $100.00
+    liabilities
+
+2019/01/01 Google home hub
+    expenses:personal:electronics          $90.00
+    liabilities                           $-90.00
+
+2019/01/02 Phone screen protector
+    expenses:personal:electronics:upgrades          $10.00
+    liabilities
+
+2019/01/02 Weekly train ticket
+    expenses:personal:train tickets       $153.00
+    liabilities
+
+2019/01/03 Flowers
+    expenses:personal          $30.00
+    liabilities
+\f[R]
+.fi
+.PP
+As you can see, we have transactions in
+\f[C]expenses:personal:electronics:upgrades\f[R] and
+\f[C]expenses:personal:train tickets\f[R], and since both of these
+accounts are without explicitly defined budget, these transactions would
+be counted towards budgets of \f[C]expenses:personal:electronics\f[R]
+and \f[C]expenses:personal\f[R] accordingly:
+.IP
+.nf
+\f[C]
+$ hledger balance --budget -M
+Budget performance in 2019/01:
+
+                               ||                           Jan 
+===============================++===============================
+ expenses                      ||  $283.00 [  26% of  $1100.00] 
+ expenses:personal             ||  $283.00 [  26% of  $1100.00] 
+ expenses:personal:electronics ||  $100.00 [ 100% of   $100.00] 
+ liabilities                   || $-283.00 [  26% of $-1100.00] 
+-------------------------------++-------------------------------
+                               ||        0 [                 0] 
+\f[R]
+.fi
+.PP
+And with \f[C]--empty\f[R], we can get a better picture of budget
+allocation and consumption:
+.IP
+.nf
+\f[C]
+$ hledger balance --budget -M --empty
+Budget performance in 2019/01:
+
+                                        ||                           Jan 
+========================================++===============================
+ expenses                               ||  $283.00 [  26% of  $1100.00] 
+ expenses:personal                      ||  $283.00 [  26% of  $1100.00] 
+ expenses:personal:electronics          ||  $100.00 [ 100% of   $100.00] 
+ expenses:personal:electronics:upgrades ||   $10.00                      
+ expenses:personal:train tickets        ||  $153.00                      
+ liabilities                            || $-283.00 [  26% of $-1100.00] 
+----------------------------------------++-------------------------------
+                                        ||        0 [                 0] 
+\f[R]
+.fi
+.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],
+(multicolumn non-budget reports only) \f[C]html\f[R], and (experimental)
+\f[C]json\f[R].
+.SS balancesheet
+.PP
+balancesheet, bs
+.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).
+.PP
+Note this report shows all account balances with normal positive sign
+(like conventional financial statements, unlike balance/print/register)
+(experimental).
+.PP
+Example:
+.IP
+.nf
+\f[C]
+$ hledger balancesheet
+Balance Sheet
+
+Assets:
+                 $-1  assets
+                  $1    bank:saving
+                 $-2    cash
+--------------------
+                 $-1
+
+Liabilities:
+                  $1  liabilities:debts
+--------------------
+                  $1
+
+Total:
+--------------------
+                   0
+\f[R]
+.fi
+.PP
+With a reporting interval, multiple columns will be shown, one for each
+report period.
+As with multicolumn balance reports, you can alter the report mode with
+\f[C]--change\f[R]/\f[C]--cumulative\f[R]/\f[C]--historical\f[R].
+Normally balancesheet shows historical ending balances, which is what
+you need for a balance sheet; note this means it ignores report begin
+dates (and \f[C]-T/--row-total\f[R], since summing end balances
+generally does not make sense).
+Instead of absolute values percentages can be displayed with
+\f[C]-%\f[R].
+.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],
+\f[C]html\f[R], and (experimental) \f[C]json\f[R].
+.SS balancesheetequity
+.PP
+balancesheetequity, bse
+.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).
+.PP
+Example:
+.IP
+.nf
+\f[C]
+$ hledger balancesheetequity
+Balance Sheet With Equity
+
+Assets:
+                 $-2  assets
+                  $1    bank:saving
+                 $-3    cash
+--------------------
+                 $-2
+
+Liabilities:
+                  $1  liabilities:debts
+--------------------
+                  $1
+
+Equity:
+          $1  equity:owner
+--------------------
+          $1
+
+Total:
+--------------------
+                   0
+\f[R]
+.fi
+.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],
+\f[C]html\f[R], and (experimental) \f[C]json\f[R].
+.SS cashflow
+.PP
+cashflow, cf
+.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).
+.PP
+Example:
+.IP
+.nf
+\f[C]
+$ hledger cashflow
+Cashflow Statement
+
+Cash flows:
+                 $-1  assets
+                  $1    bank:saving
+                 $-2    cash
+--------------------
+                 $-1
+
+Total:
+--------------------
+                 $-1
+\f[R]
+.fi
+.PP
+With a reporting interval, multiple columns will be shown, one for each
+report period.
+Normally cashflow shows changes in assets per period, though as with
+multicolumn balance reports you can alter the report mode with
+\f[C]--change\f[R]/\f[C]--cumulative\f[R]/\f[C]--historical\f[R].
+Instead of absolute values percentages can be displayed with
+\f[C]-%\f[R].
+.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],
+\f[C]html\f[R], and (experimental) \f[C]json\f[R].
+.SS check-dates
+.PP
+check-dates
+.PD 0
+.P
+.PD
+Check that transactions are sorted by increasing date.
+With --date2, checks secondary dates instead.
+With --strict, dates must also be unique.
+With a query, only matched transactions\[aq] dates are checked.
+Reads the default journal file, or another specified with -f.
+.SS check-dupes
+.PP
+check-dupes
+.PD 0
+.P
+.PD
+Reports account names having the same leaf but different prefixes.
+In other words, two or more leaves that are categorized differently.
+Reads the default journal file, or another specified as an argument.
+.PP
+An example: http://stefanorodighiero.net/software/hledger-dupes.html
+.SS close
+.PP
+close, equity
+.PD 0
+.P
+.PD
+Prints a \[dq]closing balances\[dq] transaction and an \[dq]opening
+balances\[dq] transaction that bring account balances to and from zero,
+respectively.
+These can be added to your journal file(s), eg to bring asset/liability
+balances forward into a new journal file, or to close out
+revenues/expenses to retained earnings at the end of a period.
+.PP
+You can print just one of these transactions by using the
+\f[C]--close\f[R] or \f[C]--open\f[R] flag.
+You can customise their descriptions with the \f[C]--close-desc\f[R] and
+\f[C]--open-desc\f[R] options.
+.PP
+One amountless posting to \[dq]equity:opening/closing balances\[dq] is
+added to balance the transactions, by default.
+You can customise this account name with \f[C]--close-acct\f[R] and
+\f[C]--open-acct\f[R]; if you specify only one of these, it will be used
+for both.
+.PP
+With \f[C]--x/--explicit\f[R], the equity posting\[aq]s amount will be
+shown.
+And if it involves multiple commodities, a posting for each commodity
+will be shown, as with the print command.
+.PP
+With \f[C]--interleaved\f[R], the equity postings are shown next to the
+postings they balance, which makes troubleshooting easier.
+.PP
+By default, transaction prices in the journal are ignored when
+generating the closing/opening transactions.
+With \f[C]--show-costs\f[R], this cost information is preserved
+(\f[C]balance -B\f[R] reports will be unchanged after the transition).
+Separate postings are generated for each cost in each commodity.
+Note this can generate very large journal entries, if you have many
+foreign currency or investment transactions.
+.SS close usage
+.PP
+If you split your journal files by time (eg yearly), you will typically
+run this command at the end of the year, and save the closing
+transaction as last entry of the old file, and the opening transaction
+as the first entry of the new file.
+This makes the files self contained, so that correct balances are
+reported no matter which of them are loaded.
+Ie, if you load just one file, the balances are initialised correctly;
+or if you load several files, the redundant closing/opening transactions
+cancel each other out.
+(They will show up in print or register reports; you can exclude them
+with a query like
+\f[C]not:desc:\[aq](opening|closing) balances\[aq]\f[R].)
+.PP
+If you\[aq]re running a business, you might also use this command to
+\[dq]close the books\[dq] at the end of an accounting period,
+transferring income statement account balances to retained earnings.
+(You may want to change the equity account name to something like
+\[dq]equity:retained earnings\[dq].)
+.PP
+By default, the closing transaction is dated yesterday, the balances are
+calculated as of end of yesterday, and the opening transaction is dated
+today.
+To close on some other date, use:
+\f[C]hledger close -e OPENINGDATE\f[R].
+Eg, to close/open on the 2018/2019 boundary, use \f[C]-e 2019\f[R].
+You can also use -p or \f[C]date:PERIOD\f[R] (any starting date is
+ignored).
+.PP
+Both transactions will include balance assertions for the
+closed/reopened accounts.
+You probably shouldn\[aq]t use status or realness filters (like -C or -R
+or \f[C]status:\f[R]) with this command, or the generated balance
+assertions will depend on these flags.
+Likewise, if you run this command with --auto, the balance assertions
+will probably always require --auto.
+.PP
+Examples:
+.PP
+Carrying asset/liability balances into a new file for 2019:
+.IP
+.nf
+\f[C]
+$ hledger close -f 2018.journal -e 2019 assets liabilities --open
+    # (copy/paste the output to the start of your 2019 journal file)
+$ hledger close -f 2018.journal -e 2019 assets liabilities --close
+    # (copy/paste the output to the end of your 2018 journal file)
+\f[R]
+.fi
+.PP
+Now:
+.IP
+.nf
+\f[C]
+$ hledger bs -f 2019.journal                   # one file - balances are correct
+$ hledger bs -f 2018.journal -f 2019.journal   # two files - balances still correct
+$ hledger bs -f 2018.journal not:desc:closing  # to see year-end balances, must exclude closing txn
+\f[R]
+.fi
+.PP
+Transactions spanning the closing date can complicate matters, breaking
+balance assertions:
+.IP
+.nf
+\f[C]
+2018/12/30 a purchase made in 2018, clearing the following year
+    expenses:food          5
+    assets:bank:checking  -5  ; [2019/1/2]
+\f[R]
+.fi
+.PP
+Here\[aq]s one way to resolve that:
+.IP
+.nf
+\f[C]
+; in 2018.journal:
+2018/12/30 a purchase made in 2018, clearing the following year
+    expenses:food          5
+    liabilities:pending
+
+; in 2019.journal:
+2019/1/2 clearance of last year\[aq]s pending transactions
+    liabilities:pending    5 = 0
+    assets:checking
+\f[R]
+.fi
+.SS commodities
+.PP
+commodities
+.PD 0
+.P
+.PD
+List all commodity/currency symbols used or declared in the journal.
+.SS descriptions
+.PP
+descriptions Show descriptions.
+.PP
+This command lists all descriptions that appear in transactions.
+.PP
+Examples:
+.IP
+.nf
+\f[C]
+$ hledger descriptions
+Store Name
+Gas Station | Petrol
+Person A
+\f[R]
+.fi
+.SS diff
+.PP
+diff
+.PD 0
+.P
+.PD
+Compares a particular account\[aq]s transactions in two input files.
+It shows any transactions to this account which are in one file but not
+in the other.
+.PP
+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.) Since
+postings not transactions are compared, this also works when multiple
+bank transactions have been combined into a single journal entry.
+.PP
+This is useful eg if you have downloaded an account\[aq]s transactions
+from 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.
+.PP
+Examples:
+.IP
+.nf
+\f[C]
+$ hledger diff -f $LEDGER_FILE -f bank.csv assets:bank:giro 
+These transactions are in the first file only:
+
+2014/01/01 Opening Balances
+    assets:bank:giro              EUR ...
+    ...
+    equity:opening balances       EUR -...
+
+These transactions are in the second file only:
+\f[R]
+.fi
+.SS files
+.PP
+files
+.PD 0
+.P
+.PD
+List all files included in the journal.
+With a REGEX argument, only file names matching the regular expression
+(case sensitive) are shown.
+.SS help
+.PP
+help
+.PD 0
+.P
+.PD
+Show any of the hledger manuals.
+.PP
+The \f[C]help\f[R] 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.
+.PP
+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 \f[C]--info\f[R],
+\f[C]--man\f[R], \f[C]--pager\f[R], \f[C]--cat\f[R] flags.
+.PP
+Examples:
+.IP
+.nf
+\f[C]
+$ hledger help
+Please choose a manual by typing \[dq]hledger help MANUAL\[dq] (a substring is ok).
+Manuals: hledger hledger-ui hledger-web journal csv timeclock timedot
+\f[R]
+.fi
+.IP
+.nf
+\f[C]
+$ hledger help h --man
+
+hledger(1)                    hledger User Manuals                    hledger(1)
+
+NAME
+       hledger - a command-line accounting tool
+
+SYNOPSIS
+       hledger [-f FILE] COMMAND [OPTIONS] [ARGS]
+       hledger [-f FILE] ADDONCMD -- [OPTIONS] [ARGS]
+       hledger
+
+DESCRIPTION
+       hledger  is  a  cross-platform  program  for tracking money, time, or any
+\&...
+\f[R]
+.fi
+.SS import
+.PP
+import
+.PD 0
+.P
+.PD
+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 transactions that would be added.
+Or with --catchup, just mark all of the FILEs\[aq] transactions as
+imported, without actually importing any.
+.PP
+The input files are specified as arguments - no need to write -f before
+each one.
+So eg to add new transactions from all CSV files to the main journal,
+it\[aq]s just: \f[C]hledger import *.csv\f[R]
+.PP
+New transactions are detected in the same way as print --new: by
+assuming transactions are always added to the input files in increasing
+date order, and by saving \f[C].latest.FILE\f[R] state files.
+.PP
+The --dry-run output is in journal format, so you can filter it, eg to
+see only uncategorised transactions:
+.IP
+.nf
+\f[C]
+$ hledger import --dry ... | hledger -f- print unknown --ignore-assertions
+\f[R]
+.fi
+.SS Importing balance assignments
+.PP
+Entries added by import will have their posting amounts made explicit
+(like \f[C]hledger print -x\f[R]).
+This means that any balance assignments in imported files must be
+evaluated; but, imported files don\[aq]t get to see the main file\[aq]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 amounts.
+To avoid this problem, use print instead of import:
+.IP
+.nf
+\f[C]
+$ hledger print IMPORTFILE [--new] >> $LEDGER_FILE
+\f[R]
+.fi
+.PP
+(If you think import should leave amounts implicit like print does,
+please test it and send a pull request.)
+.SS incomestatement
+.PP
+incomestatement, is
+.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.)
+.IP
+.nf
+\f[C]
+$ hledger incomestatement
+Income Statement
+
+Revenues:
+                 $-2  income
+                 $-1    gifts
+                 $-1    salary
+--------------------
+                 $-2
+
+Expenses:
+                  $2  expenses
+                  $1    food
+                  $1    supplies
+--------------------
+                  $2
+
+Total:
+--------------------
+                   0
+\f[R]
+.fi
+.PP
+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
+\f[C]--change\f[R]/\f[C]--cumulative\f[R]/\f[C]--historical\f[R].
+Instead of absolute values percentages can be displayed with
+\f[C]-%\f[R].
+.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],
+\f[C]html\f[R], and (experimental) \f[C]json\f[R].
+.SS notes
+.PP
+notes Show notes.
+.PP
+This command lists all notes that appear in transactions.
+.PP
+Examples:
+.IP
+.nf
+\f[C]
+$ hledger notes
+Petrol
+Snacks
+\f[R]
+.fi
+.SS payees
+.PP
+payees Show payee names.
+.PP
+This command lists all payee names that appear in transactions.
+.PP
+Examples:
+.IP
+.nf
+\f[C]
+$ hledger payees
+Store Name
+Gas Station
+Person A
+\f[R]
+.fi
+.SS prices
+.PP
+prices
+.PD 0
+.P
+.PD
+Print market price directives from the journal.
+With --costs, also print synthetic market prices based on transaction
+prices.
+With --inverted-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.
+.SS print
+.PP
+print, txns, p
+.PD 0
+.P
+.PD
+Show transaction journal entries, sorted by date.
+.PP
+The print command displays full journal entries (transactions) from the
+journal file in date order, tidily formatted.
+With --date2, transactions are sorted by secondary date instead.
+.PP
+print\[aq]s output is always a valid hledger journal.
+.PD 0
+.P
+.PD
+It preserves all transaction information, but it does not preserve
+directives or inter-transaction comments
+.IP
+.nf
+\f[C]
+$ hledger print
+2008/01/01 income
+    assets:bank:checking            $1
+    income:salary                  $-1
+
+2008/06/01 gift
+    assets:bank:checking            $1
+    income:gifts                   $-1
+
+2008/06/02 save
+    assets:bank:saving              $1
+    assets:bank:checking           $-1
+
+2008/06/03 * eat & shop
+    expenses:food                $1
+    expenses:supplies            $1
+    assets:cash                 $-2
+
+2008/12/31 * pay off
+    liabilities:debts               $1
+    assets:bank:checking           $-1
+\f[R]
+.fi
+.PP
+Normally, the journal entry\[aq]s explicit or implicit amount style is
+preserved.
+For example, when an amount is omitted in the journal, it will not
+appear in the output.
+Similarly, when a transaction price is implied but not written, it will
+not appear in the output.
+You can use the \f[C]-x\f[R]/\f[C]--explicit\f[R] flag to make all
+amounts and transaction prices explicit, which can be useful for
+troubleshooting or for making your journal more readable and robust
+against data entry errors.
+\f[C]-x\f[R] is also implied by using any of
+\f[C]-B\f[R],\f[C]-V\f[R],\f[C]-X\f[R],\f[C]--value\f[R].
+.PP
+Note, \f[C]-x\f[R]/\f[C]--explicit\f[R] 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.
+.PP
+With \f[C]-B\f[R]/\f[C]--cost\f[R], amounts with transaction prices are
+converted to cost using that price.
+This can be used for troubleshooting.
+.PP
+With \f[C]-m\f[R]/\f[C]--match\f[R] and a STR argument, print will show
+at most one transaction: 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.
+.PP
+With \f[C]--new\f[R], for each FILE being read, hledger reads (and
+writes) a special state file (\f[C].latest.FILE\f[R] 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 ignoring already-seen entries in import data, such as
+downloaded CSV files.
+Eg:
+.IP
+.nf
+\f[C]
+$ hledger -f bank1.csv print --new
+(shows transactions added since last print --new on this file)
+\f[R]
+.fi
+.PP
+This assumes that transactions added to FILE always have same or
+increasing dates, and that transactions on the same day do not get
+reordered.
+See also the import command.
+.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].
+.PP
+Here\[aq]s an example of print\[aq]s CSV output:
+.IP
+.nf
+\f[C]
+$ hledger print -Ocsv
+\[dq]txnidx\[dq],\[dq]date\[dq],\[dq]date2\[dq],\[dq]status\[dq],\[dq]code\[dq],\[dq]description\[dq],\[dq]comment\[dq],\[dq]account\[dq],\[dq]amount\[dq],\[dq]commodity\[dq],\[dq]credit\[dq],\[dq]debit\[dq],\[dq]posting-status\[dq],\[dq]posting-comment\[dq]
+\[dq]1\[dq],\[dq]2008/01/01\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]income\[dq],\[dq]\[dq],\[dq]assets:bank:checking\[dq],\[dq]1\[dq],\[dq]$\[dq],\[dq]\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq]
+\[dq]1\[dq],\[dq]2008/01/01\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]income\[dq],\[dq]\[dq],\[dq]income:salary\[dq],\[dq]-1\[dq],\[dq]$\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq]
+\[dq]2\[dq],\[dq]2008/06/01\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]gift\[dq],\[dq]\[dq],\[dq]assets:bank:checking\[dq],\[dq]1\[dq],\[dq]$\[dq],\[dq]\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq]
+\[dq]2\[dq],\[dq]2008/06/01\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]gift\[dq],\[dq]\[dq],\[dq]income:gifts\[dq],\[dq]-1\[dq],\[dq]$\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq]
+\[dq]3\[dq],\[dq]2008/06/02\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]save\[dq],\[dq]\[dq],\[dq]assets:bank:saving\[dq],\[dq]1\[dq],\[dq]$\[dq],\[dq]\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq]
+\[dq]3\[dq],\[dq]2008/06/02\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]save\[dq],\[dq]\[dq],\[dq]assets:bank:checking\[dq],\[dq]-1\[dq],\[dq]$\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq]
+\[dq]4\[dq],\[dq]2008/06/03\[dq],\[dq]\[dq],\[dq]*\[dq],\[dq]\[dq],\[dq]eat & shop\[dq],\[dq]\[dq],\[dq]expenses:food\[dq],\[dq]1\[dq],\[dq]$\[dq],\[dq]\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq]
+\[dq]4\[dq],\[dq]2008/06/03\[dq],\[dq]\[dq],\[dq]*\[dq],\[dq]\[dq],\[dq]eat & shop\[dq],\[dq]\[dq],\[dq]expenses:supplies\[dq],\[dq]1\[dq],\[dq]$\[dq],\[dq]\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq]
+\[dq]4\[dq],\[dq]2008/06/03\[dq],\[dq]\[dq],\[dq]*\[dq],\[dq]\[dq],\[dq]eat & shop\[dq],\[dq]\[dq],\[dq]assets:cash\[dq],\[dq]-2\[dq],\[dq]$\[dq],\[dq]2\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq]
+\[dq]5\[dq],\[dq]2008/12/31\[dq],\[dq]\[dq],\[dq]*\[dq],\[dq]\[dq],\[dq]pay off\[dq],\[dq]\[dq],\[dq]liabilities:debts\[dq],\[dq]1\[dq],\[dq]$\[dq],\[dq]\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq]
+\[dq]5\[dq],\[dq]2008/12/31\[dq],\[dq]\[dq],\[dq]*\[dq],\[dq]\[dq],\[dq]pay off\[dq],\[dq]\[dq],\[dq]assets:bank:checking\[dq],\[dq]-1\[dq],\[dq]$\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq]
+\f[R]
+.fi
+.IP \[bu] 2
+There is one CSV record per posting, with the parent transaction\[aq]s
+fields repeated.
+.IP \[bu] 2
+The \[dq]txnidx\[dq] (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 order, etc.)
+.IP \[bu] 2
+The amount is separated into \[dq]commodity\[dq] (the symbol) and
+\[dq]amount\[dq] (numeric quantity) fields.
+.IP \[bu] 2
+The numeric amount is repeated in either the \[dq]credit\[dq] or
+\[dq]debit\[dq] column, for convenience.
+(Those names are not accurate in the accounting sense; it just puts
+negative amounts under credit and zero or greater amounts under debit.)
+.SS print-unique
+.PP
+print-unique
+.PD 0
+.P
+.PD
+Print transactions which do not reuse an already-seen description.
+.PP
+Example:
+.IP
+.nf
+\f[C]
+$ cat unique.journal
+1/1 test
+ (acct:one)  1
+2/2 test
+ (acct:two)  2
+$ LEDGER_FILE=unique.journal hledger print-unique
+(-f option not supported)
+2015/01/01 test
+    (acct:one)             1
+\f[R]
+.fi
+.SS register
+.PP
+register, reg, r
+.PD 0
+.P
+.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:
+.IP
+.nf
+\f[C]
+$ hledger register checking
+2008/01/01 income               assets:bank:checking            $1           $1
+2008/06/01 gift                 assets:bank:checking            $1           $2
+2008/06/02 save                 assets:bank:checking           $-1           $1
+2008/12/31 pay off              assets:bank:checking           $-1            0
+\f[R]
+.fi
+.PP
+With --date2, it shows and sorts by secondary date instead.
+.PP
+The \f[C]--historical\f[R]/\f[C]-H\f[R] flag adds the balance from any
+undisplayed prior postings to the running total.
+This is useful when you want to see only recent activity, with a
+historically accurate running balance:
+.IP
+.nf
+\f[C]
+$ hledger register checking -b 2008/6 --historical
+2008/06/01 gift                 assets:bank:checking            $1           $2
+2008/06/02 save                 assets:bank:checking           $-1           $1
+2008/12/31 pay off              assets:bank:checking           $-1            0
+\f[R]
+.fi
+.PP
+The \f[C]--depth\f[R] option limits the amount of sub-account detail
+displayed.
+.PP
+The \f[C]--average\f[R]/\f[C]-A\f[R] flag shows the running average
+posting amount instead of the running total (so, the final number
+displayed is the average for the whole report period).
+This flag implies \f[C]--empty\f[R] (see below).
+It is affected by \f[C]--historical\f[R].
+It works best when showing just one account and one commodity.
+.PP
+The \f[C]--related\f[R]/\f[C]-r\f[R] flag shows the \f[I]other\f[R]
+postings in the transactions of the postings which would normally be
+shown.
+.PP
+The \f[C]--invert\f[R] flag negates all amounts.
+For example, it can be used on an income account where amounts are
+normally displayed as negative numbers.
+It\[aq]s also useful to show postings on the checking account together
+with the related account:
+.IP
+.nf
+\f[C]
+$ hledger register --related --invert assets:checking
+\f[R]
+.fi
+.PP
+With a reporting interval, register shows summary postings, one per
+interval, aggregating the postings to each account:
+.IP
+.nf
+\f[C]
+$ hledger register --monthly income
+2008/01                 income:salary                          $-1          $-1
+2008/06                 income:gifts                           $-1          $-2
+\f[R]
+.fi
+.PP
+Periods with no activity, and summary postings with a zero amount, are
+not shown by default; use the \f[C]--empty\f[R]/\f[C]-E\f[R] flag to see
+them:
+.IP
+.nf
+\f[C]
+$ hledger register --monthly income -E
+2008/01                 income:salary                          $-1          $-1
+2008/02                                                          0          $-1
+2008/03                                                          0          $-1
+2008/04                                                          0          $-1
+2008/05                                                          0          $-1
+2008/06                 income:gifts                           $-1          $-2
+2008/07                                                          0          $-2
+2008/08                                                          0          $-2
+2008/09                                                          0          $-2
+2008/10                                                          0          $-2
+2008/11                                                          0          $-2
+2008/12                                                          0          $-2
+\f[R]
+.fi
+.PP
+Often, you\[aq]ll want to see just one line per interval.
+The \f[C]--depth\f[R] option helps with this, causing subaccounts to be
+aggregated:
+.IP
+.nf
+\f[C]
+$ hledger register --monthly assets --depth 1h
+2008/01                 assets                                  $1           $1
+2008/06                 assets                                 $-1            0
+2008/12                 assets                                 $-1          $-1
+\f[R]
+.fi
+.PP
+Note when using report intervals, if you specify start/end dates these
+will be adjusted outward if necessary to contain a whole number of
+intervals.
+This ensures that the first and last intervals are full length and
+comparable to the others in the report.
+.SS Custom register output
+.PP
+register uses the full terminal width by default, except on windows.
+You can override this by setting the \f[C]COLUMNS\f[R] environment
+variable (not a bash shell variable) or by using the
+\f[C]--width\f[R]/\f[C]-w\f[R] option.
+.PP
+The description and account columns normally share the space equally
+(about half of (width - 40) each).
+You can adjust this by adding a description width as part of
+--width\[aq]s argument, comma-separated: \f[C]--width W,D\f[R] .
+Here\[aq]s a diagram (won\[aq]t display correctly in --help):
+.IP
+.nf
+\f[C]
+<--------------------------------- width (W) ---------------------------------->
+date (10)  description (D)       account (W-41-D)     amount (12)   balance (12)
+DDDDDDDDDD dddddddddddddddddddd  aaaaaaaaaaaaaaaaaaa  AAAAAAAAAAAA  AAAAAAAAAAAA
+\f[R]
+.fi
+.PP
+and some examples:
+.IP
+.nf
+\f[C]
+$ hledger reg                     # use terminal width (or 80 on windows)
+$ hledger reg -w 100              # use width 100
+$ COLUMNS=100 hledger reg         # set with one-time environment variable
+$ export COLUMNS=100; hledger reg # set till session end (or window resize)
+$ hledger reg -w 100,40           # set overall width 100, description width 40
+$ hledger reg -w $COLUMNS,40      # use terminal width, & description width 40
+\f[R]
+.fi
+.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].
+.SS register-match
+.PP
+register-match
+.PD 0
+.P
+.PD
+Print the one posting whose transaction description is closest to DESC,
+in the style of the register command.
+If there are multiple equally good matches, it shows the most recent.
+Query options (options, not arguments) can be used to restrict the
+search space.
+Helps ledger-autosync detect already-seen transactions when importing.
+.SS rewrite
+.PP
+rewrite
+.PD 0
+.P
+.PD
+Print all transactions, rewriting the postings of matched transactions.
+For now the only rewrite available is adding new postings, like print
+--auto.
+.PP
+This is a start at a generic rewriter of transaction entries.
+It reads the default journal and prints the transactions, like print,
+but adds one or more specified postings to any transactions matching
+QUERY.
+The posting amounts can be fixed, or a multiplier of the existing
+transaction\[aq]s first posting amount.
+.PP
+Examples:
+.IP
+.nf
+\f[C]
+$ hledger-rewrite.hs \[ha]income --add-posting \[aq](liabilities:tax)  *.33  ; income tax\[aq] --add-posting \[aq](reserve:gifts)  $100\[aq]
+$ hledger-rewrite.hs expenses:gifts --add-posting \[aq](reserve:gifts)  *-1\[dq]\[aq]
+$ hledger-rewrite.hs -f rewrites.hledger
+\f[R]
+.fi
+.PP
+rewrites.hledger may consist of entries like:
+.IP
+.nf
+\f[C]
+= \[ha]income amt:<0 date:2017
+  (liabilities:tax)  *0.33  ; tax on income
+  (reserve:grocery)  *0.25  ; reserve 25% for grocery
+  (reserve:)  *0.25  ; reserve 25% for grocery
+\f[R]
+.fi
+.PP
+Note the single quotes to protect the dollar sign from bash, and the two
+spaces between account and amount.
+.PP
+More:
+.IP
+.nf
+\f[C]
+$ hledger rewrite -- [QUERY]        --add-posting \[dq]ACCT  AMTEXPR\[dq] ...
+$ hledger rewrite -- \[ha]income        --add-posting \[aq](liabilities:tax)  *.33\[aq]
+$ hledger rewrite -- expenses:gifts --add-posting \[aq](budget:gifts)  *-1\[dq]\[aq]
+$ hledger rewrite -- \[ha]income        --add-posting \[aq](budget:foreign currency)  *0.25 JPY; diversify\[aq]
+\f[R]
+.fi
+.PP
+Argument for \f[C]--add-posting\f[R] option is a usual posting of
+transaction with an exception for amount specification.
+More precisely, you can use \f[C]\[aq]*\[aq]\f[R] (star symbol) before
+the amount to indicate that that this is a factor for an amount of
+original matched posting.
+If the amount includes a commodity name, the new posting amount will be
+in the new commodity; otherwise, it will be in the matched posting
+amount\[aq]s commodity.
+.SS Re-write rules in a file
+.PP
+During the run this tool will execute so called \[dq]Automated
+Transactions\[dq] found in any journal it process.
+I.e instead of specifying this operations in command line you can put
+them in a journal file.
+.IP
+.nf
+\f[C]
+$ rewrite-rules.journal
+\f[R]
+.fi
+.PP
+Make contents look like this:
+.IP
+.nf
+\f[C]
+= \[ha]income
+    (liabilities:tax)  *.33
+
+= expenses:gifts
+    budget:gifts  *-1
+    assets:budget  *1
+\f[R]
+.fi
+.PP
+Note that \f[C]\[aq]=\[aq]\f[R] (equality symbol) that is used instead
+of date in transactions you usually write.
+It indicates the query by which you want to match the posting to add new
+ones.
+.IP
+.nf
+\f[C]
+$ hledger rewrite -- -f input.journal -f rewrite-rules.journal > rewritten-tidy-output.journal
+\f[R]
+.fi
+.PP
+This is something similar to the commands pipeline:
+.IP
+.nf
+\f[C]
+$ hledger rewrite -- -f input.journal \[aq]\[ha]income\[aq] --add-posting \[aq](liabilities:tax)  *.33\[aq] \[rs]
+  | hledger rewrite -- -f - expenses:gifts      --add-posting \[aq]budget:gifts  *-1\[aq]       \[rs]
+                                                --add-posting \[aq]assets:budget  *1\[aq]       \[rs]
+  > rewritten-tidy-output.journal
+\f[R]
+.fi
+.PP
+It is important to understand that relative order of such entries in
+journal is important.
+You can re-use result of previously added postings.
+.SS Diff output format
+.PP
+To use this tool for batch modification of your journal files you may
+find useful output in form of unified diff.
+.IP
+.nf
+\f[C]
+$ hledger rewrite -- --diff -f examples/sample.journal \[aq]\[ha]income\[aq] --add-posting \[aq](liabilities:tax)  *.33\[aq]
+\f[R]
+.fi
+.PP
+Output might look like:
+.IP
+.nf
+\f[C]
+--- /tmp/examples/sample.journal
++++ /tmp/examples/sample.journal
+\[at]\[at] -18,3 +18,4 \[at]\[at]
+ 2008/01/01 income
+-    assets:bank:checking  $1
++    assets:bank:checking            $1
+     income:salary
++    (liabilities:tax)                0
+\[at]\[at] -22,3 +23,4 \[at]\[at]
+ 2008/06/01 gift
+-    assets:bank:checking  $1
++    assets:bank:checking            $1
+     income:gifts
++    (liabilities:tax)                0
+\f[R]
+.fi
+.PP
+If you\[aq]ll pass this through \f[C]patch\f[R] tool you\[aq]ll get
+transactions containing the posting that matches your query be updated.
+Note that multiple files might be update according to list of input
+files specified via \f[C]--file\f[R] options and \f[C]include\f[R]
+directives inside of these files.
+.PP
+Be careful.
+Whole transaction being re-formatted in a style of output from
+\f[C]hledger print\f[R].
+.PP
+See also:
+.PP
+https://github.com/simonmichael/hledger/issues/99
+.SS rewrite vs. print --auto
+.PP
+This command predates print --auto, and currently does much the same
+thing, but with these differences:
+.IP \[bu] 2
+with multiple files, rewrite lets rules in any file affect all other
+files.
+print --auto uses standard directive scoping; rules affect only child
+files.
+.IP \[bu] 2
+rewrite\[aq]s query limits which transactions can be rewritten; all are
+printed.
+print --auto\[aq]s query limits which transactions are printed.
+.IP \[bu] 2
+rewrite applies rules specified on command line or in the journal.
+print --auto applies rules specified in the journal.
+.SS roi
+.PP
+roi
+.PD 0
+.P
+.PD
+Shows the time-weighted (TWR) and money-weighted (IRR) rate of return on
+your investments.
+.PP
+This command assumes that you have account(s) that hold nothing but your
+investments and whenever you record current appraisal/valuation of these
+investments you offset unrealized profit and loss into account(s) that,
+again, hold nothing but unrealized profit and loss.
+.PP
+Any transactions affecting balance of investment account(s) and not
+originating from unrealized profit and loss account(s) are assumed to be
+your investments or withdrawals.
+.PP
+At a minimum, you need to supply a query (which could be just an account
+name) to select your investments with \f[C]--inv\f[R], and another query
+to identify your profit and loss transactions with \f[C]--pnl\f[R].
+.PP
+It will compute and display the internalized rate of return (IRR) and
+time-weighted rate of return (TWR) for your investments for the time
+period requested.
+Both rates of return are annualized before display, regardless of the
+length of reporting interval.
+.SS stats
+.PP
+stats
+.PD 0
+.P
+.PD
+Show some journal statistics.
+.PP
+The stats command displays summary information for the whole journal, or
+a matched part of it.
+With a reporting interval, it shows a report for each report period.
+.PP
+Example:
+.IP
+.nf
+\f[C]
+$ hledger stats
+Main journal file        : /src/hledger/examples/sample.journal
+Included journal files   : 
+Transactions span        : 2008-01-01 to 2009-01-01 (366 days)
+Last transaction         : 2008-12-31 (2333 days ago)
+Transactions             : 5 (0.0 per day)
+Transactions last 30 days: 0 (0.0 per day)
+Transactions last 7 days : 0 (0.0 per day)
+Payees/descriptions      : 5
+Accounts                 : 8 (depth 3)
+Commodities              : 1 ($)
+Market prices            : 12 ($)
+\f[R]
+.fi
+.PP
+This command also supports output destination and output format
+selection.
+.SS tags
+.PP
+tags
+.PD 0
+.P
+.PD
+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\[aq] unique values are listed instead.
+.SS test
+.PP
+test
+.PD 0
+.P
+.PD
+Run built-in unit tests.
+.PP
+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.
+.PP
+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!
+.PP
+This command also accepts tasty test runner options, written after a --
+(double hyphen).
+Eg to run only the tests in Hledger.Data.Amount, with ANSI colour codes
+disabled:
+.IP
+.nf
+\f[C]
+$ hledger test -- -pData.Amount --color=never
+\f[R]
+.fi
+.PP
+For help on these, see https://github.com/feuerbach/tasty#options
+(\f[C]-- --help\f[R] currently doesn\[aq]t show them).
+.SS Add-on Commands
+.PP
+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
+\f[C]hledger-\f[R] and ends with a recognised file extension (currently:
+no extension, \f[C]bat\f[R],\f[C]com\f[R],\f[C]exe\f[R],
+\f[C]hs\f[R],\f[C]lhs\f[R],\f[C]pl\f[R],\f[C]py\f[R],\f[C]rb\f[R],\f[C]rkt\f[R],\f[C]sh\f[R]).
+.PP
+Add-ons can be invoked like any hledger command, but there are a few
+things to be aware of.
+Eg if the \f[C]hledger-web\f[R] add-on is installed,
+.IP \[bu] 2
+\f[C]hledger -h web\f[R] shows hledger\[aq]s help, while
+\f[C]hledger web -h\f[R] shows hledger-web\[aq]s help.
+.IP \[bu] 2
+Flags specific to the add-on must have a preceding \f[C]--\f[R] to hide
+them from hledger.
+So \f[C]hledger web --serve --port 9000\f[R] will be rejected; you must
+use \f[C]hledger web -- --serve --port 9000\f[R].
+.IP \[bu] 2
+You can always run add-ons directly if preferred:
+\f[C]hledger-web --serve --port 9000\f[R].
+.PP
+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.
+.PP
+Two important add-ons are the hledger-ui and hledger-web user
+interfaces.
+These are maintained and released along with hledger:
+.SS ui
+.PP
+hledger-ui provides an efficient terminal interface.
+.SS web
+.PP
+hledger-web provides a simple web interface.
+.PP
+Third party add-ons, maintained separately from hledger, include:
+.SS iadd
+.PP
+hledger-iadd is a more interactive, terminal UI replacement for the add
+command.
+.SS interest
+.PP
+hledger-interest generates interest transactions for an account
+according to various schemes.
+.PP
+A few more experimental or old add-ons can be found in hledger\[aq]s
+bin/ directory.
+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
+\f[C]C:/Users/USER/.hledger.journal\f[R]).
+.PP
+A typical value is \f[C]\[ti]/DIR/YYYY.journal\f[R], where DIR is a
+version-controlled finance directory and YYYY is the current year.
+Or \f[C]\[ti]/DIR/current.journal\f[R], where current.journal is a
+symbolic link to YYYY.journal.
+.PP
+On Mac computers, you can set this and other environment variables in a
+more thorough way that also affects applications started from the GUI
+(say, an Emacs dock icon).
+Eg on MacOS Catalina I have a \f[C]\[ti]/.MacOSX/environment.plist\f[R]
+file containing
+.IP
+.nf
+\f[C]
+{
+  \[dq]LEDGER_FILE\[dq] : \[dq]\[ti]/finance/current.journal\[dq]
+}
+\f[R]
+.fi
+.PP
+To see the effect you may need to \f[C]killall Dock\f[R], or reboot.
 .SH FILES
 .PP
 Reads data from one or more files in hledger journal, timeclock,
diff --git a/embeddedfiles/hledger.info b/embeddedfiles/hledger.info
--- a/embeddedfiles/hledger.info
+++ b/embeddedfiles/hledger.info
@@ -1,3369 +1,3920 @@
 This is hledger.info, produced by makeinfo version 6.7 from stdin.
 
 
-File: hledger.info,  Node: Top,  Next: EXAMPLES,  Up: (dir)
-
-hledger(1) hledger 1.16.2
-*************************
-
-This is hledger's command-line interface (there are also terminal and
-web interfaces).  Its basic function is to read a plain text file
-describing financial transactions (in accounting terms, a general
-journal) and print useful reports on standard output, or export them as
-CSV. hledger can also read some other file formats such as CSV files,
-translating them to journal format.  Additionally, hledger lists other
-hledger-* executables found in the user's $PATH and can invoke them as
-subcommands.
-
-   hledger reads data from one or more files in hledger journal,
-timeclock, timedot, or CSV format specified with '-f', or
-'$LEDGER_FILE', or '$HOME/.hledger.journal' (on windows, perhaps
-'C:/Users/USER/.hledger.journal').  If using '$LEDGER_FILE', note this
-must be a real environment variable, not a shell variable.  You can
-specify standard input with '-f-'.
-
-   Transactions are dated movements of money between two (or more) named
-accounts, and are recorded with journal entries like this:
-
-2015/10/16 bought food
- expenses:food          $10
- assets:cash
-
-   For more about this format, see hledger_journal(5).
-
-   Most users use a text editor to edit the journal, usually with an
-editor mode such as ledger-mode for added convenience.  hledger's
-interactive add command is another way to record new transactions.
-hledger never changes existing transactions.
-
-   To get started, you can either save some entries like the above in
-'~/.hledger.journal', or run 'hledger add' and follow the prompts.  Then
-try some commands like 'hledger print' or 'hledger balance'.  Run
-'hledger' with no arguments for a list of commands.
-
-* Menu:
-
-* EXAMPLES::
-* OPTIONS::
-* QUERIES::
-* COMMANDS::
-* ADD-ON COMMANDS::
-
-
-File: hledger.info,  Node: EXAMPLES,  Next: OPTIONS,  Prev: Top,  Up: Top
-
-1 EXAMPLES
-**********
-
-Two simple transactions in hledger journal format:
-
-2015/9/30 gift received
-  assets:cash   $20
-  income:gifts
-
-2015/10/16 farmers market
-  expenses:food    $10
-  assets:cash
-
-   Some basic reports:
-
-$ hledger print
-2015/09/30 gift received
-    assets:cash            $20
-    income:gifts          $-20
-
-2015/10/16 farmers market
-    expenses:food           $10
-    assets:cash            $-10
-
-$ hledger accounts --tree
-assets
-  cash
-expenses
-  food
-income
-  gifts
-
-$ hledger balance
-                 $10  assets:cash
-                 $10  expenses:food
-                $-20  income:gifts
---------------------
-                   0
-
-$ hledger register cash
-2015/09/30 gift received   assets:cash               $20           $20
-2015/10/16 farmers market  assets:cash              $-10           $10
-
-   More commands:
-
-$ hledger                                 # show available commands
-$ hledger add                             # add more transactions to the journal file
-$ hledger balance                         # all accounts with aggregated balances
-$ hledger balance --help                  # show detailed help for balance command
-$ hledger balance --depth 1               # only top-level accounts
-$ hledger register                        # show account postings, with running total
-$ hledger reg income                      # show postings to/from income accounts
-$ hledger reg 'assets:some bank:checking' # show postings to/from this checking account
-$ hledger print desc:shop                 # show transactions with shop in the description
-$ hledger activity -W                     # show transaction counts per week as a bar chart
-
-
-File: hledger.info,  Node: OPTIONS,  Next: QUERIES,  Prev: EXAMPLES,  Up: Top
-
-2 OPTIONS
-*********
-
-* Menu:
-
-* General options::
-* Command options::
-* Command arguments::
-* Argument files::
-* Special characters in arguments and queries::
-* Command line tips::
-* Unicode characters::
-* Input files::
-* Smart dates::
-* Report start & end date::
-* Report intervals::
-* Period expressions::
-* Depth limiting::
-* Pivoting::
-* Valuation::
-* Output destination::
-* Output format::
-* Regular expressions::
-
-
-File: hledger.info,  Node: General options,  Next: Command options,  Up: OPTIONS
-
-2.1 General options
-===================
-
-To see general usage help, including general options which are supported
-by most hledger commands, run 'hledger -h'.
-
-   General help options:
-
-'-h --help'
-
-     show general usage (or after COMMAND, command usage)
-'--version'
-
-     show version
-'--debug[=N]'
-
-     show debug output (levels 1-9, default: 1)
-
-   General input options:
-
-'-f FILE --file=FILE'
-
-     use a different input file.  For stdin, use - (default:
-     '$LEDGER_FILE' or '$HOME/.hledger.journal')
-'--rules-file=RULESFILE'
-
-     Conversion rules file to use when reading CSV (default: FILE.rules)
-'--separator=CHAR'
-
-     Field separator to expect when reading CSV (default: ',')
-'--alias=OLD=NEW'
-
-     rename accounts named OLD to NEW
-'--anon'
-
-     anonymize accounts and payees
-'--pivot FIELDNAME'
-
-     use some other field or tag for the account name
-'-I --ignore-assertions'
-
-     ignore any failing balance assertions
-
-   General reporting options:
-
-'-b --begin=DATE'
-
-     include postings/txns on or after this date
-'-e --end=DATE'
-
-     include postings/txns before this date
-'-D --daily'
-
-     multiperiod/multicolumn report by day
-'-W --weekly'
-
-     multiperiod/multicolumn report by week
-'-M --monthly'
-
-     multiperiod/multicolumn report by month
-'-Q --quarterly'
-
-     multiperiod/multicolumn report by quarter
-'-Y --yearly'
-
-     multiperiod/multicolumn report by year
-'-p --period=PERIODEXP'
-
-     set start date, end date, and/or reporting interval all at once
-     using period expressions syntax
-'--date2'
-
-     match the secondary date instead (see command help for other
-     effects)
-'-U --unmarked'
-
-     include only unmarked postings/txns (can combine with -P or -C)
-'-P --pending'
-
-     include only pending postings/txns
-'-C --cleared'
-
-     include only cleared postings/txns
-'-R --real'
-
-     include only non-virtual postings
-'-NUM --depth=NUM'
-
-     hide/aggregate accounts or postings more than NUM levels deep
-'-E --empty'
-
-     show items with zero amount, normally hidden (and vice-versa in
-     hledger-ui/hledger-web)
-'-B --cost'
-
-     convert amounts to their cost at transaction time (using the
-     transaction price, if any)
-'-V --value'
-
-     convert amounts to their market value on the report end date (using
-     the most recent applicable market price, if any)
-'--auto'
-
-     apply automated posting rules to modify transactions.
-'--forecast'
-
-     apply periodic transaction rules to generate future transactions,
-     to 6 months from now or report end date.
-
-   When a reporting option appears more than once in the command line,
-the last one takes precedence.
-
-   Some reporting options can also be written as query arguments.
-
-
-File: hledger.info,  Node: Command options,  Next: Command arguments,  Prev: General options,  Up: OPTIONS
-
-2.2 Command options
-===================
-
-To see options for a particular command, including command-specific
-options, run: 'hledger COMMAND -h'.
-
-   Command-specific options must be written after the command name, eg:
-'hledger print -x'.
-
-   Additionally, if the command is an addon, you may need to put its
-options after a double-hyphen, eg: 'hledger ui -- --watch'.  Or, you can
-run the addon executable directly: 'hledger-ui --watch'.
-
-
-File: hledger.info,  Node: Command arguments,  Next: Argument files,  Prev: Command options,  Up: OPTIONS
-
-2.3 Command arguments
-=====================
-
-Most hledger commands accept arguments after the command name, which are
-often a query, filtering the data in some way.
-
-
-File: hledger.info,  Node: Argument files,  Next: Special characters in arguments and queries,  Prev: Command arguments,  Up: OPTIONS
-
-2.4 Argument files
-==================
-
-You can save a set of command line options/arguments in a file, one per
-line, and then reuse them by writing '@FILENAME' in a command line.  To
-prevent this expansion of '@'-arguments, precede them with a '--'
-argument.  For more, see Save frequently used options.
-
-
-File: hledger.info,  Node: Special characters in arguments and queries,  Next: Command line tips,  Prev: Argument files,  Up: OPTIONS
-
-2.5 Special characters in arguments and queries
-===============================================
-
-In shell command lines, option and argument values which contain
-"problematic" characters, ie spaces, and also characters significant to
-your shell such as '<', '>', '(', ')', '|' and '$', should be escaped by
-enclosing them in quotes or by writing backslashes before the
-characters.  Eg:
-
-   'hledger register -p 'last year' "accounts receivable
-(receivable|payable)" amt:\>100'.
-
-* Menu:
-
-* More escaping::
-* Even more escaping::
-* Less escaping::
-
-
-File: hledger.info,  Node: More escaping,  Next: Even more escaping,  Up: Special characters in arguments and queries
-
-2.5.1 More escaping
--------------------
-
-Characters significant both to the shell and in regular expressions may
-need one extra level of escaping.  These include parentheses, the pipe
-symbol and the dollar sign.  Eg, to match the dollar symbol, bash users
-should do:
-
-   'hledger balance cur:'\$''
-
-   or:
-
-   'hledger balance cur:\\$'
-
-
-File: hledger.info,  Node: Even more escaping,  Next: Less escaping,  Prev: More escaping,  Up: Special characters in arguments and queries
-
-2.5.2 Even more escaping
-------------------------
-
-When hledger runs an addon executable (eg you type 'hledger ui', hledger
-runs 'hledger-ui'), it de-escapes command-line options and arguments
-once, so you might need to _triple_-escape.  Eg in bash, running the ui
-command and matching the dollar sign, it's:
-
-   'hledger ui cur:'\\$''
-
-   or:
-
-   'hledger ui cur:\\\\$'
-
-   If you asked why _four_ slashes above, this may help:
-
-unescaped:        '$'
-escaped:          '\$'
-double-escaped:   '\\$'
-triple-escaped:   '\\\\$'
-
-   (The number of backslashes in fish shell is left as an exercise for
-the reader.)
-
-   You can always avoid the extra escaping for addons by running the
-addon directly:
-
-   'hledger-ui cur:\\$'
-
-
-File: hledger.info,  Node: Less escaping,  Prev: Even more escaping,  Up: Special characters in arguments and queries
-
-2.5.3 Less escaping
--------------------
-
-Inside an argument file, or in the search field of hledger-ui or
-hledger-web, or at a GHCI prompt, you need one less level of escaping
-than at the command line.  And backslashes may work better than quotes.
-Eg:
-
-   'ghci> :main balance cur:\$'
-
-
-File: hledger.info,  Node: Command line tips,  Next: Unicode characters,  Prev: Special characters in arguments and queries,  Up: OPTIONS
-
-2.6 Command line tips
-=====================
-
-If in doubt, keep things simple:
-
-   * write options after the command ('hledger CMD -OPTIONS ARGS')
-   * run add-on executables directly ('hledger-ui -OPTIONS ARGS')
-   * enclose problematic args in single quotes
-   * if needed, also add a backslash to escape regexp metacharacters
-
-   To find out exactly how a command line is being parsed, add
-'--debug=2' to troubleshoot.
-
-
-File: hledger.info,  Node: Unicode characters,  Next: Input files,  Prev: Command line tips,  Up: OPTIONS
-
-2.7 Unicode characters
-======================
-
-hledger is expected to handle non-ascii characters correctly:
-
-   * they should be parsed correctly in input files and on the command
-     line, by all hledger tools (add, iadd, hledger-web's
-     search/add/edit forms, etc.)
-
-   * they should be displayed correctly by all hledger tools, and
-     on-screen alignment should be preserved.
-
-   This requires a well-configured environment.  Here are some tips:
-
-   * A system locale must be configured, and it must be one that can
-     decode the characters being used.  In bash, you can set a locale
-     like this: 'export LANG=en_US.UTF-8'.  There are some more details
-     in Troubleshooting.  This step is essential - without it, hledger
-     will quit on encountering a non-ascii character (as with all
-     GHC-compiled programs).
-
-   * your terminal software (eg Terminal.app, iTerm, CMD.exe, xterm..)
-     must support unicode
-
-   * the terminal must be using a font which includes the required
-     unicode glyphs
-
-   * the terminal should be configured to display wide characters as
-     double width (for report alignment)
-
-   * on Windows, for best results you should run hledger in the same
-     kind of environment in which it was built.  Eg hledger built in the
-     standard CMD.EXE environment (like the binaries on our download
-     page) might show display problems when run in a cygwin or msys
-     terminal, and vice versa.  (See eg #961).
-
-
-File: hledger.info,  Node: Input files,  Next: Smart dates,  Prev: Unicode characters,  Up: OPTIONS
-
-2.8 Input files
-===============
-
-hledger reads transactions from a data file (and the add command writes
-to it).  By default this file is '$HOME/.hledger.journal' (or on
-Windows, something like 'C:/Users/USER/.hledger.journal').  You can
-override this with the '$LEDGER_FILE' environment variable:
-
-$ setenv LEDGER_FILE ~/finance/2016.journal
-$ hledger stats
-
-   or with the '-f/--file' option:
-
-$ hledger -f /some/file stats
-
-   The file name '-' (hyphen) means standard input:
-
-$ 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:
-
-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)
-
-   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 -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:
-
-   * 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'.
-
-
-File: hledger.info,  Node: Smart dates,  Next: Report start & end date,  Prev: Input files,  Up: OPTIONS
-
-2.9 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
-omitted (defaulting to 1).
-
-   Examples:
-
-'2004/10/1', '2004-01-01', '2004.9.1'   exact date, several separators allowed.  Year is 4+ digits, month is 1-12, day is 1-31
-'2004'                                  start of year
-'2004/10'                               start of month
-'10/1'                                  month and day in current year
-'21'                                    day in current month
-'october, oct'                          start of month in current year
-'yesterday, today, tomorrow'            -1, 0, 1 days from today
-'last/this/next                         -1, 0, 1 periods from the current period
-day/week/month/quarter/year'
-'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
-results:
-
-'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 8-digit year
-'20181232'    8 digits with an invalid day gives an error
-'201801012'   9+ digits beginning with a valid YYYYMMDD gives an error
-
-
-File: hledger.info,  Node: Report start & end date,  Next: Report intervals,  Prev: Smart dates,  Up: OPTIONS
-
-2.10 Report start & end date
-============================
-
-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
-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',
-'-e/--end', '-p/--period' or a 'date:' query (described below).  All of
-these accept the smart date syntax.
-
-   Some notes:
-
-   * As in Ledger, end dates are exclusive, so you need to write the
-     date _after_ the last day you want to include.
-   * As noted in reporting options: among start/end dates specified with
-     _options_, the last (i.e.  right-most) option takes precedence.
-   * 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 (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
-'date:-12/1'
-'date:thismonth-'
-'date:thismonth'
-
-
-File: hledger.info,  Node: Report intervals,  Next: Period expressions,  Prev: Report start & end date,  Up: OPTIONS
-
-2.11 Report intervals
-=====================
-
-A report interval can be specified so that commands like register,
-balance 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
-complex intervals may be specified with a period expression.  Report
-intervals can not be specified with a query.
-
-
-File: hledger.info,  Node: Period expressions,  Next: Depth limiting,  Prev: Report intervals,  Up: OPTIONS
-
-2.12 Period expressions
-=======================
-
-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 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
-"-".  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
-also be written as:
-
-'-p "1/1 4/1"'
-'-p "january-apr"'
-'-p "this year to 4/1"'
-
-   If you specify only one date, the missing start or end date will be
-the earliest or latest transaction in your journal:
-
-'-p "from 2009/1/1"'   everything after january 1, 2009
-'-p "from 2009/1"'     the same
-'-p "from 2009"'       the same
-'-p "to 2009"'         everything before january 1, 2009
-
-   A single date with no "from" or "to" defines both the start and end
-date like so:
-
-'-p "2009"'       the year 2009; equivalent to "2009/1/1 to 2010/1/1"
-'-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"
-
-   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
-'-D','-W','-M','-Q', or '-Y' flags.  Between report interval and
-start/end dates (if any), the word 'in' is optional.  Examples:
-
-'-p "weekly from 2009/1/1 to 2009/4/1"'
-'-p "monthly in 2008"'
-'-p "quarterly"'
-
-   Note that 'weekly', 'monthly', 'quarterly' and 'yearly' intervals
-will always start on the first day on week, month, quarter or year
-accordingly, and will end on the last day of same period, even if
-associated period expression specifies different explicit start and end
-date.
-
-   For example:
-
-'-p "weekly from 2009/1/1 to 2009/4/1"' - starts on 2008/12/29, closest preceding Monday
-'-p "monthly in 2008/11/25"' - starts on 2018/11/01
-'-p "quarterly from 2009-05-05 to 2009-06-01"' - starts on 2009/04/01, ends on 2009/06/30, which are first and last days of Q2 2009
-'-p "yearly from 2009-12-29"' - starts on 2009/01/01, first day of 2009
-
-   The following more complex report intervals are also supported:
-'biweekly', '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
-end on the last one, as described above.
-
-   Examples:
-
-'-p "bimonthly from 2008"' - periods will have boundaries on 2008/01/01, 2008/03/01, ...
-'-p "every 2 weeks"' - starts on closest preceding Monday
-'-p "every 5 month from 2009/03"' - periods will have boundaries on 2009/03/01, 2009/08/01, ...
-
-   If you want intervals that start on arbitrary day of your choosing
-and span a week, month or year, you need to use any of the following:
-
-   'every Nth day of week', 'every <weekday>', 'every Nth day [of
-month]', 'every Nth weekday [of month]', 'every MM/DD [of year]', 'every
-Nth MMM [of year]', 'every MMM Nth [of year]'.
-
-   Examples:
-
-'-p "every 2nd day of week"' - periods will go from Tue to Tue
-'-p "every Tue"' - same
-'-p "every 15th day"' - period boundaries will be on 15th of each month
-'-p "every 2nd Monday"' - period boundaries will be on second Monday of each month
-'-p "every 11/05"' - yearly periods with boundaries on 5th of Nov
-'-p "every 5th Nov"' - same
-'-p "every Nov 5th"' - same
-
-   Show historical balances at end of 15th each month (N is exclusive
-end date):
-
-   'hledger balance -H -p "every 16th day"'
-
-   Group postings from start of wednesday to end of next tuesday (N is
-start date and exclusive end date):
-
-   'hledger register checking -p "every 3rd day of week"'
-
-
-File: hledger.info,  Node: Depth limiting,  Next: Pivoting,  Prev: Period expressions,  Up: OPTIONS
-
-2.13 Depth limiting
-===================
-
-With the '--depth N' option (short form: '-N'), commands like account,
-balance and register will show only the uppermost accounts in the
-account tree, down to level N. Use this when you want a summary with
-less detail.  This flag has the same effect as a 'depth:' query argument
-(so '-2', '--depth=2' or 'depth:2' are basically equivalent).
-
-
-File: hledger.info,  Node: Pivoting,  Next: Valuation,  Prev: Depth limiting,  Up: OPTIONS
-
-2.14 Pivoting
-=============
-
-Normally hledger sums amounts, and organizes them in a hierarchy, based
-on account name.  The '--pivot FIELD' option causes it to sum and
-organize hierarchy based on the value of some other field instead.
-FIELD can be: 'code', 'description', 'payee', 'note', or the full name
-(case insensitive) of any tag.  As with account names, values containing
-'colon:separated:parts' will be displayed hierarchically in reports.
-
-   '--pivot' is a general option affecting all reports; you can think of
-hledger transforming the journal before any other processing, replacing
-every posting's account name with the value of the specified field on
-that posting, inheriting it from the transaction or using a blank value
-if it's not present.
-
-   An example:
-
-2016/02/16 Member Fee Payment
-    assets:bank account                    2 EUR
-    income:member fees                    -2 EUR  ; member: John Doe
-
-   Normal balance report showing account names:
-
-$ hledger balance
-               2 EUR  assets:bank account
-              -2 EUR  income:member fees
---------------------
-                   0
-
-   Pivoted balance report, using member: tag values instead:
-
-$ hledger balance --pivot member
-               2 EUR
-              -2 EUR  John Doe
---------------------
-                   0
-
-   One way to show only amounts with a member: value (using a query,
-described below):
-
-$ hledger balance --pivot member tag:member=.
-              -2 EUR  John Doe
---------------------
-              -2 EUR
-
-   Another way (the acct: query matches against the pivoted "account
-name"):
-
-$ hledger balance --pivot member acct:.
-              -2 EUR  John Doe
---------------------
-              -2 EUR
-
-
-File: hledger.info,  Node: Valuation,  Next: Output destination,  Prev: Pivoting,  Up: OPTIONS
-
-2.15 Valuation
-==============
-
-* Menu:
-
-* -B Cost::
-* -V Market value::
-* -X Market value in specified commodity::
-* --value Flexible valuation::
-* Effect of --value on reports::
-* Combining -B -V -X --value::
-
-
-File: hledger.info,  Node: -B Cost,  Next: -V Market value,  Up: Valuation
-
-2.15.1 -B: Cost
----------------
-
-The '-B/--cost' flag converts amounts to their cost (or selling price)
-at transaction time, if they have a transaction price specified.  This
-flag is equivalent to '--value=cost', described below.
-
-
-File: hledger.info,  Node: -V Market value,  Next: -X Market value in specified commodity,  Prev: -B Cost,  Up: Valuation
-
-2.15.2 -V: Market value
------------------------
-
-The '-V/--market' flag converts reported amounts to their market value
-in a default valuation commodity, using the market prices in effect on a
-default valuation date.  For single period reports, the valuation date
-is today (equivalent to '--value=now'); for multiperiod reports, it is
-the last day of each subperiod (equivalent to '--value=end').
-
-   The default valuation commodity is the one referenced in the latest
-applicable market price dated on or before the valuation date.  If most
-of your P declarations lead to a single home currency, this will usually
-be what you want.  (To specify the commodity, see -X below.)
-
-   Note that in hledger, market prices are always declared explicitly
-with P directives; we do not infer them from transaction prices as
-Ledger does.
-
-   Here's a quick example of -V:
-
-; one euro is worth this many dollars from nov 1
-P 2016/11/01 € $1.10
-
-; purchase some euros on nov 3
-2016/11/3
-    assets:euros        €100
-    assets:checking
-
-; the euro is worth fewer dollars by dec 21
-P 2016/12/21 € $1.03
-
-   How many euros do I have ?
-
-$ hledger -f t.j bal -N euros
-                €100  assets:euros
-
-   What are they worth at end of nov 3 ?
-
-$ hledger -f t.j bal -N euros -V -e 2016/11/4
-             $110.00  assets:euros
-
-   What are they worth after 2016/12/21 ?  (no report end date
-specified, defaults to today)
-
-$ hledger -f t.j bal -N euros -V
-             $103.00  assets:euros
-
-
-File: hledger.info,  Node: -X Market value in specified commodity,  Next: --value Flexible valuation,  Prev: -V Market value,  Up: Valuation
-
-2.15.3 -X: Market value in specified commodity
-----------------------------------------------
-
-The '-X/--exchange' option is like '-V', except it specifies the target
-commodity you would like to convert to.  It is equivalent to
-'--value=now,COMM' or '--value=end,COMM'.
-
-
-File: hledger.info,  Node: --value Flexible valuation,  Next: Effect of --value on reports,  Prev: -X Market value in specified commodity,  Up: Valuation
-
-2.15.4 -value: Flexible valuation
----------------------------------
-
-_(experimental, added 201905)_
-
-   '-B', '-V' and '-X' are special cases of the more general '--value'
-option:
-
- --value=TYPE[,COMM]  TYPE is cost, end, now or YYYY-MM-DD.
-                      COMM is an optional commodity symbol.
-                      Shows amounts converted to:
-                      - cost commodity using transaction prices (then optionally to COMM using market prices at period end(s))
-                      - default valuation commodity (or COMM) using market prices at period end(s)
-                      - default valuation commodity (or COMM) using current market prices
-                      - default valuation commodity (or COMM) using market prices at some date
-
-   The TYPE part basically selects either "cost", or "market value" plus
-a valuation date:
-
-'--value=cost'
-
-     Convert amounts to cost, using the prices recorded in transactions.
-'--value=end'
-
-     Convert amounts to their value in a default valuation commodity,
-     using market prices on the last day of the report period (or if
-     unspecified, the journal's end date); or in multiperiod reports,
-     market prices on the last day of each subperiod.
-'--value=now'
-
-     Convert amounts to their value in default valuation commodity using
-     current market prices (as of when report is generated).
-'--value=YYYY-MM-DD'
-
-     Convert amounts to their value in default valuation commodity using
-     market prices on this date.
-
-   The default valuation commodity is the commodity mentioned in the
-most recent applicable market price declaration.  When all your price
-declarations lead to a single home currency, this will usually do what
-you want.
-
-   To select a different valuation commodity, add the optional ',COMM'
-part: a comma, then the target commodity's symbol.  Eg:
-*'--value=now,EUR'*.  hledger will do its best to convert amounts to
-this commodity, using:
-
-   * declared prices (from source commodity to valuation commodity)
-   * reverse prices (declared prices from valuation to source commodity,
-     inverted)
-   * indirect prices (prices calculated from the shortest chain of
-     declared or reverse prices from source to valuation commodity)
-
-   in that order.
-
-   Here are some examples showing the effect of '--value' as seen with
-'print':
-
-P 2000-01-01 A  1 B
-P 2000-02-01 A  2 B
-P 2000-03-01 A  3 B
-P 2000-04-01 A  4 B
-
-2000-01-01
-  (a)      1 A @ 5 B
-
-2000-02-01
-  (a)      1 A @ 6 B
-
-2000-03-01
-  (a)      1 A @ 7 B
-
-   Show the cost of each posting:
-
-$ hledger -f- print --value=cost
-2000/01/01
-    (a)             5 B
-
-2000/02/01
-    (a)             6 B
-
-2000/03/01
-    (a)             7 B
-
-   Show the value as of the last day of the report period (2000-02-29):
-
-$ hledger -f- print --value=end date:2000/01-2000/03
-2000-01-01
-    (a)             2 B
-
-2000-02-01
-    (a)             2 B
-
-   With no report period specified, that shows the value as of the last
-day of the journal (2000-03-01):
-
-$ hledger -f- print --value=end
-2000/01/01
-    (a)             3 B
-
-2000/02/01
-    (a)             3 B
-
-2000/03/01
-    (a)             3 B
-
-   Show the current value (the 2000-04-01 price is still in effect
-today):
-
-$ hledger -f- print --value=now
-2000-01-01
-    (a)             4 B
-
-2000-02-01
-    (a)             4 B
-
-2000-03-01
-    (a)             4 B
-
-   Show the value on 2000/01/15:
-
-$ hledger -f- print --value=2000-01-15
-2000/01/01
-    (a)             1 B
-
-2000/02/01
-    (a)             1 B
-
-2000/03/01
-    (a)             1 B
-
-   You may need to explicitly set a commodity's display style, when
-reverse prices are used.  Eg this output might be surprising:
-
-P 2000-01-01 A 2B
-
-2000-01-01
-  a  1B
-  b
-
-$ hledger print -x -X A
-2000/01/01
-    a               0
-    b               0
-
-   Explanation: because there's no amount or commodity directive
-specifying a display style for A, 0.5A gets the default style, which
-shows no decimal digits.  Because the displayed amount looks like zero,
-the commodity symbol and minus sign are not displayed either.  Adding a
-commodity directive sets a more useful display style for A:
-
-P 2000-01-01 A 2B
-commodity 0.00A
-
-2000-01-01
-  a  1B
-  b
-
-$ hledger print -X A
-2000/01/01
-    a           0.50A
-    b          -0.50A
-
-
-File: hledger.info,  Node: Effect of --value on reports,  Next: Combining -B -V -X --value,  Prev: --value Flexible valuation,  Up: Valuation
-
-2.15.5 Effect of -value on reports
-----------------------------------
-
-Here is a reference for how '--value' currently affects each part of
-hledger's reports.  It's work in progress, but may be useful for
-troubleshooting or reporting bugs.  See also the definitions and notes
-below.  If you find problems, please report them, ideally with a
-reproducible example.  Related: #329, #1083.
-
-Report type     '-B',          '-V', '-X'      '--value=end'    '--value=DATE',
-                '--value=cost'                                  '--value=now'
------------------------------------------------------------------------------
-*print*
-posting         cost           value at        value at         value at
-amounts                        report end or   report or        DATE/today
-                               today           journal end
-balance         unchanged      unchanged       unchanged        unchanged
-assertions /
-assignments
-*register*
-starting        cost           value at day    value at day     value at
-balance (with                  before report   before report    DATE/today
--H)                            or journal      or journal
-                               start           start
-posting         cost           value at        value at         value at
-amounts (no                    report end or   report or        DATE/today
-report                         today           journal end
-interval)
-summary         summarised     value at        value at         value at
-posting         cost           period ends     period ends      DATE/today
-amounts (with
-report
-interval)
-running         sum/average    sum/average     sum/average of   sum/average
-total/average   of displayed   of displayed    displayed        of
-                values         values          values           displayed
-                                                                values
-*balance (bs,
-bse, cf,
-is..)*
-balances (no    sums of        value at        value at         value at
-report          costs          report end or   report or        DATE/today
-interval)                      today of sums   journal end of   of sums of
-                               of postings     sums of          postings
-                                               postings
-balances        sums of        value at        value at         value at
-(with report    costs          period ends     period ends of   DATE/today
-interval)                      of sums of      sums of          of sums of
-                               postings        postings         postings
-starting        sums of        sums of         sums of          sums of
-balances        costs of       postings        postings         postings
-(with report    postings       before report   before report    before
-interval and    before         start           start            report
--H)             report start                                    start
-budget          like           like balances   like balances    like
-amounts with    balances                                        balances
--budget
-grand total     sum of         sum of          sum of           sum of
-(no report      displayed      displayed       displayed        displayed
-interval)       values         values          values           values
-row             sums/averages  sums/averages   sums/averages    sums/averages
-totals/averages of displayed   of displayed    of displayed     of
-(with report    values         values          values           displayed
-interval)                                                       values
-column totals   sums of        sums of         sums of          sums of
-                displayed      displayed       displayed        displayed
-                values         values          values           values
-grand           sum/average    sum/average     sum/average of   sum/average
-total/average   of column      of column       column totals    of column
-                totals         totals                           totals
-
-   *Additional notes*
-
-_cost_
-
-     calculated using price(s) recorded in the transaction(s).
-_value_
-
-     market value using available market price declarations, or the
-     unchanged amount if no conversion rate can be found.
-_report start_
-
-     the first day of the report period specified with -b or -p or
-     date:, otherwise today.
-_report or journal start_
-
-     the first day of the report period specified with -b or -p or
-     date:, otherwise the earliest transaction date in the journal,
-     otherwise today.
-_report end_
-
-     the last day of the report period specified with -e or -p or date:,
-     otherwise today.
-_report or journal end_
-
-     the last day of the report period specified with -e or -p or date:,
-     otherwise the latest transaction date in the journal, otherwise
-     today.
-_report interval_
-
-     a flag (-D/-W/-M/-Q/-Y) or period expression that activates the
-     report's multi-period mode (whether showing one or many
-     subperiods).
-
-
-File: hledger.info,  Node: Combining -B -V -X --value,  Prev: Effect of --value on reports,  Up: Valuation
-
-2.15.6 Combining -B, -V, -X, -value
------------------------------------
-
-The rightmost of these flags wins.
-
-
-File: hledger.info,  Node: Output destination,  Next: Output format,  Prev: Valuation,  Up: OPTIONS
-
-2.16 Output destination
-=======================
-
-Some commands (print, register, stats, the balance commands) can write
-their output to a destination other than the console.  This is
-controlled by the '-o/--output-file' option.
-
-$ hledger balance -o -     # write to stdout (the default)
-$ hledger balance -o FILE  # write to FILE
-
-
-File: hledger.info,  Node: Output format,  Next: Regular expressions,  Prev: Output destination,  Up: OPTIONS
-
-2.17 Output format
-==================
-
-Some commands can write their output in other formats.  Eg print and
-register can output CSV, and the balance commands can output CSV or
-HTML. This is controlled by the '-O/--output-format' option, or by
-specifying a '.csv' or '.html' file extension with '-o/--output-file'.
-
-$ hledger balance -O csv       # write CSV to stdout
-$ hledger balance -o FILE.csv  # write CSV to FILE.csv
-
-
-File: hledger.info,  Node: Regular expressions,  Prev: Output format,  Up: OPTIONS
-
-2.18 Regular expressions
-========================
-
-hledger uses regular expressions in a number of places:
-
-   * query terms, on the command line and in the hledger-web search
-     form: 'REGEX', 'desc:REGEX', 'cur:REGEX', 'tag:...=REGEX'
-   * CSV rules conditional blocks: 'if REGEX ...'
-   * account alias directives and options: 'alias /REGEX/ =
-     REPLACEMENT', '--alias /REGEX/=REPLACEMENT'
-
-   hledger's regular expressions come from the regex-tdfa library.  In
-general they:
-
-   * are case insensitive
-   * are infix matching (do not need to match the entire thing being
-     matched)
-   * are POSIX extended regular expressions
-   * also support GNU word boundaries (\<, \>, \b, \B)
-   * and parenthesised capturing groups and numeric backreferences in
-     replacement strings
-   * do not support mode modifiers like (?s)
-
-   Some things to note:
-
-   * In the 'alias' directive and '--alias' option, regular expressions
-     must be enclosed in forward slashes ('/REGEX/').  Elsewhere in
-     hledger, these are not required.
-
-   * 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:\$'.
-
-   * On the command line, some metacharacters like '$' have a special
-     meaning to the shell and so must be escaped at least once more.
-     See Special characters.
-
-
-File: hledger.info,  Node: QUERIES,  Next: COMMANDS,  Prev: OPTIONS,  Up: Top
-
-3 QUERIES
-*********
-
-One of hledger's strengths is being able to quickly report on precise
-subsets of your data.  Most commands accept an optional query
-expression, written as arguments after the command name, to filter the
-data by date, account name or other criteria.  The syntax is similar to
-a web search: one or more space-separated search terms, quotes to
-enclose whitespace, prefixes to match specific fields, a not: prefix to
-negate the match.
-
-   We do not yet support arbitrary boolean combinations of search terms;
-instead most commands show transactions/postings/accounts which match
-(or negatively match):
-
-   * any of the description terms AND
-   * any of the account terms AND
-   * any of the status terms AND
-   * all the other terms.
-
-   The print command instead shows transactions which:
-
-   * match any of the description terms AND
-   * have any postings matching any of the positive account terms AND
-   * have no postings matching any of the negative account terms AND
-   * match all the other terms.
-
-   The following kinds of search terms can be used.  Remember these can
-also be prefixed with *'not:'*, eg to exclude a particular subaccount.
-
-*'REGEX', 'acct:REGEX'*
-
-     match account names by this regular expression.  (With no prefix,
-     'acct:' is assumed.)  same as above
-
-*'amt:N, amt:<N, amt:<=N, amt:>N, amt:>=N'*
-
-     match postings with a single-commodity amount that is equal to,
-     less than, or greater than N. (Multi-commodity amounts are not
-     tested, and will always match.)  The comparison has two modes: if N
-     is preceded by a + or - sign (or is 0), the two signed numbers are
-     compared.  Otherwise, the absolute magnitudes are compared,
-     ignoring sign.
-*'code:REGEX'*
-
-     match by transaction code (eg check number)
-*'cur:REGEX'*
-
-     match postings or transactions including any amounts whose
-     currency/commodity symbol is fully matched by REGEX. (For a partial
-     match, use '.*REGEX.*').  Note, to match characters which are
-     regex-significant, like the dollar sign ('$'), you need to prepend
-     '\'.  And when using the command line you need to add one more
-     level of quoting to hide it from the shell, so eg do: 'hledger
-     print cur:'\$'' or 'hledger print cur:\\$'.
-*'desc:REGEX'*
-
-     match transaction descriptions.
-*'date:PERIODEXPR'*
-
-     match dates within the specified period.  PERIODEXPR is a period
-     expression (with no report interval).  Examples: 'date:2016',
-     'date:thismonth', 'date:2000/2/1-2/15', 'date:lastweek-'.  If the
-     '--date2' command line flag is present, this matches secondary
-     dates instead.
-*'date2:PERIODEXPR'*
-
-     match secondary dates within the specified period.
-*'depth:N'*
-
-     match (or display, depending on command) accounts at or above this
-     depth
-*'note:REGEX'*
-
-     match transaction notes (part of description right of '|', or whole
-     description when there's no '|')
-*'payee:REGEX'*
-
-     match transaction payee/payer names (part of description left of
-     '|', or whole description when there's no '|')
-*'real:, real:0'*
-
-     match real or virtual postings respectively
-*'status:, status:!, status:*'*
-
-     match unmarked, pending, or cleared transactions respectively
-*'tag:REGEX[=REGEX]'*
-
-     match by tag name, and optionally also by tag value.  Note a tag:
-     query is considered to match a transaction if it matches any of the
-     postings.  Also remember that postings inherit the tags of their
-     parent transaction.
-
-   The following special search term is used automatically in
-hledger-web, only:
-
-*'inacct:ACCTNAME'*
-
-     tells hledger-web to show the transaction register for this
-     account.  Can be filtered further with 'acct' etc.
-
-   Some of these can also be expressed as command-line options (eg
-'depth:2' is equivalent to '--depth 2').  Generally you can mix options
-and query arguments, and the resulting query will be their intersection
-(perhaps excluding the '-p/--period' option).
-
-
-File: hledger.info,  Node: COMMANDS,  Next: ADD-ON COMMANDS,  Prev: QUERIES,  Up: Top
-
-4 COMMANDS
-**********
-
-hledger provides a number of subcommands; 'hledger' with no arguments
-shows a list.
-
-   If you install additional 'hledger-*' packages, or if you put
-programs or scripts named 'hledger-NAME' in your PATH, these will also
-be listed as subcommands.
-
-   Run a subcommand by writing its name as first argument (eg 'hledger
-incomestatement').  You can also write one of the standard short aliases
-displayed in parentheses in the command list ('hledger b'), or any any
-unambiguous prefix of a command name ('hledger inc').
-
-   Here are all the builtin commands in alphabetical order.  See also
-'hledger' for a more organised command list, and 'hledger CMD -h' for
-detailed command help.
-
-* Menu:
-
-* accounts::
-* activity::
-* add::
-* balance::
-* balancesheet::
-* balancesheetequity::
-* cashflow::
-* check-dates::
-* check-dupes::
-* close::
-* commodities::
-* descriptions::
-* diff::
-* files::
-* help::
-* import::
-* incomestatement::
-* notes::
-* payees::
-* prices::
-* print::
-* print-unique::
-* register::
-* register-match::
-* rewrite::
-* roi::
-* stats::
-* tags::
-* test::
-
-
-File: hledger.info,  Node: accounts,  Next: activity,  Up: COMMANDS
-
-4.1 accounts
-============
-
-accounts, a
-Show account names.
-
-   This command lists account names, either declared with account
-directives (-declared), posted to (-used), or both (the default).  With
-query arguments, only matched account names and account names referenced
-by matched postings are shown.  It shows a flat list by default.  With
-'--tree', it uses indentation to show the account hierarchy.  In flat
-mode you can add '--drop N' to omit the first few account name
-components.  Account names can be depth-clipped with 'depth:N' or
-'--depth N' or '-N'.
-
-   Examples:
-
-$ hledger accounts
-assets:bank:checking
-assets:bank:saving
-assets:cash
-expenses:food
-expenses:supplies
-income:gifts
-income:salary
-liabilities:debts
-
-
-File: hledger.info,  Node: activity,  Next: add,  Prev: accounts,  Up: COMMANDS
-
-4.2 activity
-============
-
-activity
-Show an ascii barchart of posting counts per interval.
-
-   The activity command displays an ascii histogram showing transaction
-counts by day, week, month or other reporting interval (by day is the
-default).  With query arguments, it counts only matched transactions.
-
-   Examples:
-
-$ hledger activity --quarterly
-2008-01-01 **
-2008-04-01 *******
-2008-07-01 
-2008-10-01 **
-
-
-File: hledger.info,  Node: add,  Next: balance,  Prev: activity,  Up: COMMANDS
-
-4.3 add
-=======
-
-add
-Prompt for transactions and add them to the journal.
-
-   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
-transactions, 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.
-
-   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 control-d or control-c to exit.
-
-   Features:
-
-   * add tries to provide useful defaults, using the most similar (by
-     description) recent transaction (filtered by the query, if any) as
-     a template.
-   * You can also set the initial defaults with command line arguments.
-   * Readline-style edit keys can be used during data entry.
-   * The tab key will auto-complete whenever possible - accounts,
-     descriptions, dates ('yesterday', 'today', 'tomorrow').  If the
-     input area is empty, it will insert the default value.
-   * If the journal defines a default commodity, it will be added to any
-     bare numbers entered.
-   * A parenthesised transaction code may be entered following a date.
-   * Comments and tags may be entered following a description or amount.
-   * If you make a mistake, enter '<' at any prompt to restart the
-     transaction.
-   * Input prompts are displayed in a different colour when the terminal
-     supports it.
-
-   Example (see the tutorial for a detailed explanation):
-
-$ hledger add
-Adding transactions to journal file /src/hledger/examples/sample.journal
-Any command line arguments will be used as defaults.
-Use tab key to complete, readline keys to edit, enter to accept defaults.
-An optional (CODE) may follow transaction dates.
-An optional ; COMMENT may follow descriptions or amounts.
-If you make a mistake, enter < at any prompt to restart the transaction.
-To end a transaction, enter . when prompted.
-To quit, enter . at a date prompt or press control-d or control-c.
-Date [2015/05/22]: 
-Description: supermarket
-Account 1: expenses:food
-Amount  1: $10
-Account 2: assets:checking
-Amount  2 [$-10.0]: 
-Account 3 (or . or enter to finish this transaction): .
-2015/05/22 supermarket
-    expenses:food             $10
-    assets:checking        $-10.0
-
-Save this transaction to the journal ? [y]: 
-Saved.
-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 platform
-(cf #1056).
-
-
-File: hledger.info,  Node: balance,  Next: balancesheet,  Prev: add,  Up: COMMANDS
-
-4.4 balance
-===========
-
-balance, bal, b
-Show accounts and their balances.
-
-   The balance command is hledger's most versatile command.  Note,
-despite the name, it is not always used for showing real-world account
-balances; the more accounting-aware balancesheet and incomestatement may
-be more convenient for that.
-
-   By default, it displays all accounts, and each account's change in
-balance during the entire period of the journal.  Balance changes are
-calculated by adding up the postings in each account.  You can limit the
-postings matched, by a query, to see fewer accounts, changes over a
-different time period, changes from only cleared transactions, etc.
-
-   If you include an account's complete history of postings in the
-report, the balance change is equivalent to the account's current ending
-balance.  For a real-world account, typically you won't have all
-transactions in the journal; instead you'll have all transactions after
-a certain date, and an "opening balances" transaction setting the
-correct starting balance on that date.  Then the balance command will
-show real-world account balances.  In some cases the -H/-historical flag
-is used to ensure this (more below).
-
-   The balance command can produce several styles of report:
-
-* Menu:
-
-* Classic balance report::
-* Customising the classic balance report::
-* Colour support::
-* Flat mode::
-* Depth limited balance reports::
-* Percentages::
-* Multicolumn balance report::
-* Budget report::
-* Output format::
-
-
-File: hledger.info,  Node: Classic balance report,  Next: Customising the classic balance report,  Up: balance
-
-4.4.1 Classic balance report
-----------------------------
-
-This is the original balance report, as found in Ledger.  It usually
-looks like this:
-
-$ hledger balance
-                 $-1  assets
-                  $1    bank:saving
-                 $-2    cash
-                  $2  expenses
-                  $1    food
-                  $1    supplies
-                 $-2  income
-                 $-1    gifts
-                 $-1    salary
-                  $1  liabilities:debts
---------------------
-                   0
-
-   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.
-
-   "Boring" accounts, which contain a single interesting subaccount and
-no balance of their own, are elided into the following line for more
-compact output.  (Eg above, the "liabilities" account.)  Use
-'--no-elide' to prevent this.
-
-   Account balances are "inclusive" - they include the balances of any
-subaccounts.
-
-   Accounts which have zero balance (and no non-zero subaccounts) are
-omitted.  Use '-E/--empty' to show them.
-
-   A final total is displayed by default; use '-N/--no-total' to
-suppress it, eg:
-
-$ hledger balance -p 2008/6 expenses --no-total
-                  $2  expenses
-                  $1    food
-                  $1    supplies
-
-
-File: hledger.info,  Node: Customising the classic balance report,  Next: Colour support,  Prev: Classic balance report,  Up: balance
-
-4.4.2 Customising the classic balance report
---------------------------------------------
-
-You can customise the layout of classic balance reports with '--format
-FMT':
-
-$ hledger balance --format "%20(account) %12(total)"
-              assets          $-1
-         bank:saving           $1
-                cash          $-2
-            expenses           $2
-                food           $1
-            supplies           $1
-              income          $-2
-               gifts          $-1
-              salary          $-1
-   liabilities:debts           $1
----------------------------------
-                                0
-
-   The FMT format string (plus a newline) specifies the formatting
-applied to each account/balance pair.  It may contain any suitable text,
-with data fields interpolated like so:
-
-   '%[MIN][.MAX](FIELDNAME)'
-
-   * MIN pads with spaces to at least this width (optional)
-
-   * MAX truncates at this width (optional)
-
-   * FIELDNAME must be enclosed in parentheses, and can be one of:
-
-        * 'depth_spacer' - a number of spaces equal to the account's
-          depth, or if MIN is specified, MIN * depth spaces.
-        * 'account' - the account's name
-        * 'total' - the account's balance/posted total, right justified
-
-   Also, FMT can begin with an optional prefix to control how
-multi-commodity amounts are rendered:
-
-   * '%_' - render on multiple lines, bottom-aligned (the default)
-   * '%^' - render on multiple lines, top-aligned
-   * '%,' - render on one line, comma-separated
-
-   There are some quirks.  Eg in one-line mode, '%(depth_spacer)' has no
-effect, instead '%(account)' has indentation built in.  Experimentation
-may be needed to get pleasing results.
-
-   Some example formats:
-
-   * '%(total)' - the account's total
-   * '%-20.20(account)' - the account's name, left justified, padded to
-     20 characters and clipped at 20 characters
-   * '%,%-50(account) %25(total)' - account name padded to 50
-     characters, total padded to 20 characters, with multiple
-     commodities rendered on one line
-   * '%20(total) %2(depth_spacer)%-(account)' - the default format for
-     the single-column balance report
-
-
-File: hledger.info,  Node: Colour support,  Next: Flat mode,  Prev: Customising the classic balance report,  Up: balance
-
-4.4.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
-
-
-File: hledger.info,  Node: Flat mode,  Next: Depth limited balance reports,  Prev: Colour support,  Up: balance
-
-4.4.4 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
-this mode, you can also use '--drop N' to omit the first few account
-name components.
-
-$ hledger balance -p 2008/6 expenses -N --flat --drop 1
-                  $1  food
-                  $1  supplies
-
-
-File: hledger.info,  Node: Depth limited balance reports,  Next: Percentages,  Prev: Flat mode,  Up: balance
-
-4.4.5 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 a complex set of accounts and get an overview.
-
-$ hledger balance -N -1
-                 $-1  assets
-                  $2  expenses
-                 $-2  income
-                  $1  liabilities
-
-   Flat-mode balance reports, which normally show exclusive balances,
-show inclusive balances at the depth limit.
-
-
-File: hledger.info,  Node: Percentages,  Next: Multicolumn balance report,  Prev: Depth limited balance reports,  Up: balance
-
-4.4.6 Percentages
------------------
-
-With '-%' or '--percent', balance reports show each account's value
-expressed 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 -%
-             100.0 %  expenses
-              50.0 %    food
-              50.0 %    supplies
---------------------
-             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
-relative 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 (eg
-'hledger balance -B') all percentage values will be zero.
-
-   This flag does not work if the report contains any mixed commodity
-accounts.  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.
-
-
-File: hledger.info,  Node: Multicolumn balance report,  Next: Budget report,  Prev: Percentages,  Up: balance
-
-4.4.7 Multicolumn balance report
---------------------------------
-
-Multicolumn or tabular balance reports are a very useful hledger
-feature, and usually the preferred style.  They share many of the above
-features, but they show the report as a table, with columns representing
-time periods.  This mode is activated by providing a reporting interval.
-
-   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 for a monthly income statement:
-
-     $ hledger balance --quarterly income expenses -E
-     Balance changes in 2008:
-     
-                        ||  2008q1  2008q2  2008q3  2008q4 
-     ===================++=================================
-      expenses:food     ||       0      $1       0       0 
-      expenses:supplies ||       0      $1       0       0 
-      income:gifts      ||       0     $-1       0       0 
-      income:salary     ||     $-1       0       0       0 
-     -------------------++---------------------------------
-                        ||     $-1      $1       0       0 
-
-  2. With '--cumulative': each column shows the ending balance for that
-     period, accumulating the changes across periods, starting from 0 at
-     the report start date:
-
-     $ hledger balance --quarterly income expenses -E --cumulative
-     Ending balances (cumulative) in 2008:
-     
-                        ||  2008/03/31  2008/06/30  2008/09/30  2008/12/31 
-     ===================++=================================================
-      expenses:food     ||           0          $1          $1          $1 
-      expenses:supplies ||           0          $1          $1          $1 
-      income:gifts      ||           0         $-1         $-1         $-1 
-      income:salary     ||         $-1         $-1         $-1         $-1 
-     -------------------++-------------------------------------------------
-                        ||         $-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 useful eg for a multi-period balance sheet, and when you
-     are showing only the data after a certain start date:
-
-     $ hledger balance ^assets ^liabilities --quarterly --historical --begin 2008/4/1
-     Ending balances (historical) in 2008/04/01-2008/12/31:
-     
-                           ||  2008/06/30  2008/09/30  2008/12/31 
-     ======================++=====================================
-      assets:bank:checking ||          $1          $1           0 
-      assets:bank:saving   ||          $1          $1          $1 
-      assets:cash          ||         $-2         $-2         $-2 
-      liabilities:debts    ||           0           0          $1 
-     ----------------------++-------------------------------------
-                           ||           0           0           0 
-
-   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;
-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 the
-displayed report periods.  This is so that the first and last periods
-will be "full" and comparable to the others.
-
-   The '-E/--empty' flag does two things in multicolumn balance reports:
-first, the report will show all columns within the specified report
-period (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 row.
-
-   Here's an example of all three:
-
-$ hledger balance -Q income expenses --tree -ETA
-Balance changes in 2008:
-
-            ||  2008q1  2008q2  2008q3  2008q4    Total  Average 
-============++===================================================
- expenses   ||       0      $2       0       0       $2       $1 
-   food     ||       0      $1       0       0       $1        0 
-   supplies ||       0      $1       0       0       $1        0 
- income     ||     $-1     $-1       0       0      $-2      $-1 
-   gifts    ||       0     $-1       0       0      $-1        0 
-   salary   ||     $-1       0       0       0      $-1        0 
-------------++---------------------------------------------------
-            ||     $-1      $1       0       0        0        0 
-
-# Average is rounded to the dollar here since all journal amounts are
-
-   Limitations:
-
-   In multicolumn reports the '-V/--value' flag uses the market price on
-the report end date, for all columns (not the price on each column's end
-date).
-
-   Eliding of boring parent accounts in tree mode, as in the classic
-balance report, is not yet supported in multicolumn reports.
-
-
-File: hledger.info,  Node: Budget report,  Next: ,  Prev: Multicolumn balance report,  Up: balance
-
-4.4.8 Budget report
--------------------
-
-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
-income, expenses, time usage, etc.  -budget is most often combined with
-a report interval.
-
-   For example, you can take average monthly expenses in the common
-expense categories to construct a minimal monthly budget:
-
-;; Budget
-~ monthly
-  income  $2000
-  expenses:food    $400
-  expenses:bus     $50
-  expenses:movies  $30
-  assets:bank:checking
-
-;; Two months worth of expenses
-2017-11-01
-  income  $1950
-  expenses:food    $396
-  expenses:bus     $49
-  expenses:movies  $30
-  expenses:supplies  $20
-  assets:bank:checking
-
-2017-12-01
-  income  $2100
-  expenses:food    $412
-  expenses:bus     $53
-  expenses:gifts   $100
-  assets:bank:checking
-
-   You can now see a monthly budget report:
-
-$ hledger balance -M --budget
-Budget performance in 2017/11/01-2017/12/31:
-
-                      ||                      Nov                       Dec 
-======================++====================================================
- assets               || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
- assets:bank          || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
- assets:bank:checking || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
- expenses             ||   $495 [ 103% of   $480]    $565 [ 118% of   $480] 
- expenses:bus         ||    $49 [  98% of    $50]     $53 [ 106% of    $50] 
- expenses:food        ||   $396 [  99% of   $400]    $412 [ 103% of   $400] 
- expenses:movies      ||    $30 [ 100% of    $30]       0 [   0% of    $30] 
- income               ||  $1950 [  98% of  $2000]   $2100 [ 105% of  $2000] 
-----------------------++----------------------------------------------------
-                      ||      0 [              0]       0 [              0] 
-
-   Note this is different from a normal balance report in several ways:
-
-   * Only accounts with budget goals during the report period are shown,
-     by default.
-
-   * In each column, in square brackets after the actual amount,
-     budgeted amounts are shown, along with the percentage of budget
-     used.
-
-   * All parent accounts are always shown, even in flat mode.  Eg
-     assets, assets:bank, and expenses above.
-
-   * 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
-transactions, 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
-ones, giving the full picture.  Eg:
-
-$ hledger balance -M --budget --empty
-Budget performance in 2017/11/01-2017/12/31:
-
-                      ||                      Nov                       Dec 
-======================++====================================================
- assets               || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
- assets:bank          || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
- assets:bank:checking || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
- expenses             ||   $495 [ 103% of   $480]    $565 [ 118% of   $480] 
- expenses:bus         ||    $49 [  98% of    $50]     $53 [ 106% of    $50] 
- expenses:food        ||   $396 [  99% of   $400]    $412 [ 103% of   $400] 
- expenses:gifts       ||      0                      $100                   
- expenses:movies      ||    $30 [ 100% of    $30]       0 [   0% of    $30] 
- expenses:supplies    ||    $20                         0                   
- income               ||  $1950 [  98% of  $2000]   $2100 [ 105% of  $2000] 
-----------------------++----------------------------------------------------
-                      ||      0 [              0]       0 [              0] 
-
-   You can roll over unspent budgets to next period with '--cumulative':
-
-$ hledger balance -M --budget --cumulative
-Budget performance in 2017/11/01-2017/12/31:
-
-                      ||                      Nov                       Dec 
-======================++====================================================
- assets               || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960] 
- assets:bank          || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960] 
- assets:bank:checking || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960] 
- expenses             ||   $495 [ 103% of   $480]   $1060 [ 110% of   $960] 
- expenses:bus         ||    $49 [  98% of    $50]    $102 [ 102% of   $100] 
- expenses:food        ||   $396 [  99% of   $400]    $808 [ 101% of   $800] 
- expenses:movies      ||    $30 [ 100% of    $30]     $30 [  50% of    $60] 
- income               ||  $1950 [  98% of  $2000]   $4050 [ 101% of  $4000] 
-----------------------++----------------------------------------------------
-                      ||      0 [              0]       0 [              0] 
-
-   For more examples, see Budgeting and Forecasting.
-
-* Menu:
-
-* Nested budgets::
-
-
-File: hledger.info,  Node: Nested budgets,  Up: Budget report
-
-4.4.8.1 Nested budgets
-......................
-
-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
-budget(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
-account, all its parents would have budget as well.
-
-   To illustrate this, consider the following budget:
-
-~ monthly from 2019/01
-    expenses:personal             $1,000.00
-    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 implicity
-means that budget for both 'expenses:personal' and 'expenses' is $1100.
-
-   Transactions in 'expenses:personal:electronics' will be counted both
-towards its $100 budget and $1100 of 'expenses:personal' , and
-transactions 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:
-
-~ monthly from 2019/01
-    expenses:personal             $1,000.00
-    expenses:personal:electronics    $100.00
-    liabilities
-
-2019/01/01 Google home hub
-    expenses:personal:electronics          $90.00
-    liabilities                           $-90.00
-
-2019/01/02 Phone screen protector
-    expenses:personal:electronics:upgrades          $10.00
-    liabilities
-
-2019/01/02 Weekly train ticket
-    expenses:personal:train tickets       $153.00
-    liabilities
-
-2019/01/03 Flowers
-    expenses:personal          $30.00
-    liabilities
-
-   As you can see, we have transactions in
-'expenses:personal:electronics:upgrades' and 'expenses:personal:train
-tickets', and since both of these accounts are without explicitly
-defined budget, these transactions would be counted towards budgets of
-'expenses:personal:electronics' and 'expenses:personal' accordingly:
-
-$ hledger balance --budget -M
-Budget performance in 2019/01:
-
-                               ||                           Jan 
-===============================++===============================
- expenses                      ||  $283.00 [  26% of  $1100.00] 
- expenses:personal             ||  $283.00 [  26% of  $1100.00] 
- expenses:personal:electronics ||  $100.00 [ 100% of   $100.00] 
- liabilities                   || $-283.00 [  26% of $-1100.00] 
--------------------------------++-------------------------------
-                               ||        0 [                 0] 
-
-   And with '--empty', we can get a better picture of budget allocation
-and consumption:
-
-$ hledger balance --budget -M --empty
-Budget performance in 2019/01:
-
-                                        ||                           Jan 
-========================================++===============================
- expenses                               ||  $283.00 [  26% of  $1100.00] 
- expenses:personal                      ||  $283.00 [  26% of  $1100.00] 
- expenses:personal:electronics          ||  $100.00 [ 100% of   $100.00] 
- expenses:personal:electronics:upgrades ||   $10.00                      
- expenses:personal:train tickets        ||  $153.00                      
- liabilities                            || $-283.00 [  26% of $-1100.00] 
-----------------------------------------++-------------------------------
-                                        ||        0 [                 0] 
-
-4.4.9 Output format
--------------------
-
-The balance command supports output destination and output format
-selection.
-
-
-File: hledger.info,  Node: balancesheet,  Next: balancesheetequity,  Prev: balance,  Up: COMMANDS
-
-4.5 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).
-
-   Note this report shows all account balances with normal positive sign
-(like conventional financial statements, unlike balance/print/register)
-(experimental).
-
-   Example:
-
-$ hledger balancesheet
-Balance Sheet
-
-Assets:
-                 $-1  assets
-                  $1    bank:saving
-                 $-2    cash
---------------------
-                 $-1
-
-Liabilities:
-                  $1  liabilities:debts
---------------------
-                  $1
-
-Total:
---------------------
-                   0
-
-   With a reporting interval, multiple columns will be shown, one for
-each report period.  As with multicolumn balance reports, you can alter
-the report mode with '--change'/'--cumulative'/'--historical'.  Normally
-balancesheet shows historical ending balances, which is what you need
-for a balance sheet; note this means it ignores report begin dates (and
-'-T/--row-total', since summing end balances generally does not make
-sense).  Instead of absolute values percentages can be displayed with
-'-%'.
-
-   This command also supports output destination and output format
-selection.
-
-
-File: hledger.info,  Node: balancesheetequity,  Next: cashflow,  Prev: balancesheet,  Up: COMMANDS
-
-4.6 balancesheetequity
-======================
-
-balancesheetequity, bse
-Just like balancesheet, but also reports Equity (which it assumes is
-under a top-level 'equity' account).
-
-   Example:
-
-$ hledger balancesheetequity
-Balance Sheet With Equity
-
-Assets:
-                 $-2  assets
-                  $1    bank:saving
-                 $-3    cash
---------------------
-                 $-2
-
-Liabilities:
-                  $1  liabilities:debts
---------------------
-                  $1
-
-Equity:
-          $1  equity:owner
---------------------
-          $1
-
-Total:
---------------------
-                   0
-
-
-File: hledger.info,  Node: cashflow,  Next: check-dates,  Prev: balancesheetequity,  Up: COMMANDS
-
-4.7 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).
-
-   Example:
-
-$ hledger cashflow
-Cashflow Statement
-
-Cash flows:
-                 $-1  assets
-                  $1    bank:saving
-                 $-2    cash
---------------------
-                 $-1
-
-Total:
---------------------
-                 $-1
-
-   With a reporting interval, multiple columns will be shown, one for
-each report period.  Normally cashflow shows changes in assets per
-period, though as with multicolumn balance reports you can alter the
-report mode with '--change'/'--cumulative'/'--historical'.  Instead of
-absolute values percentages can be displayed with '-%'.
-
-   This command also supports output destination and output format
-selection.
-
-
-File: hledger.info,  Node: check-dates,  Next: check-dupes,  Prev: cashflow,  Up: COMMANDS
-
-4.8 check-dates
-===============
-
-check-dates
-Check that transactions are sorted by increasing date.  With -date2,
-checks secondary dates instead.  With -strict, dates must also be
-unique.  With a query, only matched transactions' dates are checked.
-Reads the default journal file, or another specified with -f.
-
-
-File: hledger.info,  Node: check-dupes,  Next: close,  Prev: check-dates,  Up: COMMANDS
-
-4.9 check-dupes
-===============
-
-check-dupes
-Reports account names having the same leaf but different prefixes.  In
-other words, two or more leaves that are categorized differently.  Reads
-the default journal file, or another specified as an argument.
-
-   An example: http://stefanorodighiero.net/software/hledger-dupes.html
-
-
-File: hledger.info,  Node: close,  Next: commodities,  Prev: check-dupes,  Up: COMMANDS
-
-4.10 close
-==========
-
-close, equity
-Prints a "closing balances" transaction and an "opening balances"
-transaction that bring account balances to and from zero, respectively.
-Useful for bringing asset/liability balances forward into a new journal
-file, or for closing out revenues/expenses to retained earnings at the
-end of a period.
-
-   The closing transaction transfers balances to "equity:closing
-balances", and the opening transaction transfers balances from
-"equity:opening balances", or you can customise these with the
-'--close-to' and '--open-from' options.  You can choose to print just
-one of the transactions by using the '--opening' or '--closing' flag.
-
-   If you split your journal files by time (eg yearly), you will
-typically run this command at the end of the year, and save the closing
-transaction as last entry of the old file, and the opening transaction
-as the first entry of the new file.  This makes the files self
-contained, so that correct balances are reported no matter which of them
-are loaded.  Ie, if you load just one file, the balances are initialised
-correctly; or if you load several files, the redundant closing/opening
-transactions cancel each other out.  (They will show up in print or
-register reports; you can exclude them with a query like
-'not:desc:'(opening|closing) balances''.)
-
-   If you're running a business, you might also use this command to
-"close the books" at the end of an accounting period, transferring
-income statement account balances to retained earnings.  (You may want
-to change the equity account name to something like "equity:retained
-earnings".)
-
-   By default, the closing transaction is dated yesterday, the balances
-are calculated as of end of yesterday, and the opening transaction is
-dated today.  To close on some other date, use: 'hledger close -e
-OPENINGDATE'.  Eg, to close/open on the 2018/2019 boundary, use '-e
-2019'.  You can also use -p or 'date:PERIOD' (any starting date is
-ignored).
-
-   Both transactions will include balance assertions for the
-closed/reopened accounts.  You probably shouldn't use status or realness
-filters (like -C or -R or 'status:') with this command, or the generated
-balance assertions will depend on these flags.  Likewise, if you run
-this command with -auto, the balance assertions will probably always
-require -auto.
-
-   When account balances have cost information (transaction prices), the
-closing/opening transactions will preserve it, so that eg balance -B
-reports will not be affected.
-
-   Examples:
-
-   Carrying asset/liability balances into a new file for 2019, all from
-command line:
-
-   _Warning: we use '>>' here to append; be careful not to type a single
-'>' which would wipe your journal!_
-
-$ hledger close -f 2018.journal -e 2019 assets liabilities --opening >>2019.journal
-$ hledger close -f 2018.journal -e 2019 assets liabilities --closing >>2018.journal
-
-   Now:
-
-$ hledger bs -f 2019.journal                   # one file - balances are correct
-$ hledger bs -f 2018.journal -f 2019.journal   # two files - balances still correct
-$ hledger bs -f 2018.journal not:desc:closing  # to see year-end balances, must exclude closing txn
-
-   Transactions spanning the closing date can complicate matters,
-breaking balance assertions:
-
-2018/12/30 a purchase made in 2018, clearing the following year
-    expenses:food          5
-    assets:bank:checking  -5  ; [2019/1/2]
-
-   Here's one way to resolve that:
-
-; in 2018.journal:
-2018/12/30 a purchase made in 2018, clearing the following year
-    expenses:food          5
-    liabilities:pending
-
-; in 2019.journal:
-2019/1/2 clearance of last year's pending transactions
-    liabilities:pending    5 = 0
-    assets:checking
-
-
-File: hledger.info,  Node: commodities,  Next: descriptions,  Prev: close,  Up: COMMANDS
-
-4.11 commodities
-================
-
-commodities
-List all commodity/currency symbols used or declared in the journal.
-
-
-File: hledger.info,  Node: descriptions,  Next: diff,  Prev: commodities,  Up: COMMANDS
-
-4.12 descriptions
-=================
-
-descriptions Show descriptions.
-
-   This command lists all descriptions that appear in transactions.
-
-   Examples:
-
-$ hledger descriptions
-Store Name
-Gas Station | Petrol
-Person A
-
-
-File: hledger.info,  Node: diff,  Next: files,  Prev: descriptions,  Up: COMMANDS
-
-4.13 diff
-=========
-
-diff
-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.)
-Since postings not transactions are compared, this also works when
-multiple 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 the account balance, you can compare the bank data with your
-journal to find out the cause.
-
-   Examples:
-
-$ hledger diff -f $LEDGER_FILE -f bank.csv assets:bank:giro 
-These transactions are in the first file only:
-
-2014/01/01 Opening Balances
-    assets:bank:giro              EUR ...
-    ...
-    equity:opening balances       EUR -...
-
-These transactions are in the second file only:
-
-
-File: hledger.info,  Node: files,  Next: help,  Prev: diff,  Up: COMMANDS
-
-4.14 files
-==========
-
-files
-List all files included in the journal.  With a REGEX argument, only
-file names matching the regular expression (case sensitive) are shown.
-
-
-File: hledger.info,  Node: help,  Next: import,  Prev: files,  Up: COMMANDS
-
-4.15 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 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 force a
-particular viewer with the '--info', '--man', '--pager', '--cat' flags.
-
-   Examples:
-
-$ hledger help
-Please choose a manual by typing "hledger help MANUAL" (a substring is ok).
-Manuals: hledger hledger-ui hledger-web journal csv timeclock timedot
-
-$ hledger help h --man
-
-hledger(1)                    hledger User Manuals                    hledger(1)
-
-NAME
-       hledger - a command-line accounting tool
-
-SYNOPSIS
-       hledger [-f FILE] COMMAND [OPTIONS] [ARGS]
-       hledger [-f FILE] ADDONCMD -- [OPTIONS] [ARGS]
-       hledger
-
-DESCRIPTION
-       hledger  is  a  cross-platform  program  for tracking money, time, or any
-...
-
-
-File: hledger.info,  Node: import,  Next: incomestatement,  Prev: help,  Up: COMMANDS
-
-4.16 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 transactions
-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 each one.  So eg to add new transactions from all CSV files to
-the main journal, it's just: 'hledger import *.csv'
-
-   New transactions are detected in the same way as print -new: by
-assuming 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
-see only uncategorised transactions:
-
-$ hledger import --dry ... | hledger -f- print unknown --ignore-assertions
-
-* Menu:
-
-* Importing balance assignments::
-
-
-File: hledger.info,  Node: Importing balance assignments,  Up: import
-
-4.16.1 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
-balance assignments (eg from an institution that provides only balances
-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,
-please test it and send a pull request.)
-
-
-File: hledger.info,  Node: incomestatement,  Next: notes,  Prev: import,  Up: COMMANDS
-
-4.17 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,
-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 simple income statement.  It currently
-assumes that you have top-level accounts named 'income' (or 'revenue')
-and 'expense' (plural forms also allowed.)
-
-$ hledger incomestatement
-Income Statement
-
-Revenues:
-                 $-2  income
-                 $-1    gifts
-                 $-1    salary
---------------------
-                 $-2
-
-Expenses:
-                  $2  expenses
-                  $1    food
-                  $1    supplies
---------------------
-                  $2
-
-Total:
---------------------
-                   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
-absolute values percentages can be displayed with '-%'.
-
-   This command also supports output destination and output format
-selection.
-
-
-File: hledger.info,  Node: notes,  Next: payees,  Prev: incomestatement,  Up: COMMANDS
-
-4.18 notes
-==========
-
-notes Show notes.
-
-   This command lists all notes that appear in transactions.
-
-   Examples:
-
-$ hledger notes
-Petrol
-Snacks
-
-
-File: hledger.info,  Node: payees,  Next: prices,  Prev: notes,  Up: COMMANDS
-
-4.19 payees
-===========
-
-payees Show payee names.
-
-   This command lists all payee names that appear in transactions.
-
-   Examples:
-
-$ hledger payees
-Store Name
-Gas Station
-Person A
-
-
-File: hledger.info,  Node: prices,  Next: print,  Prev: payees,  Up: COMMANDS
-
-4.20 prices
-===========
-
-prices
-Print market price directives from the journal.  With -costs, also print
-synthetic market prices based on transaction prices.  With
--inverted-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.
-
-
-File: hledger.info,  Node: print,  Next: print-unique,  Prev: prices,  Up: COMMANDS
-
-4.21 print
-==========
-
-print, txns, p
-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,
-transactions 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
-directives or inter-transaction comments
-
-$ hledger print
-2008/01/01 income
-    assets:bank:checking            $1
-    income:salary                  $-1
-
-2008/06/01 gift
-    assets:bank:checking            $1
-    income:gifts                   $-1
-
-2008/06/02 save
-    assets:bank:saving              $1
-    assets:bank:checking           $-1
-
-2008/06/03 * eat & shop
-    expenses:food                $1
-    expenses:supplies            $1
-    assets:cash                 $-2
-
-2008/12/31 * pay off
-    liabilities:debts               $1
-    assets:bank:checking           $-1
-
-   Normally, the journal entry's explicit or implicit amount style is
-preserved.  Ie when an amount is omitted in the journal, it will be
-omitted in the output.  You can use the '-x'/'--explicit' flag to make
-all amounts explicit, which can be useful for troubleshooting or for
-making your journal more readable and robust against data entry errors.
-Note, '-x' will cause postings with a multi-commodity amount (these can
-arise when a multi-commodity transaction has an implicit amount) will be
-split into multiple single-commodity postings, for valid journal output.
-
-   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
-transaction: 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
-special 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
-ignoring 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
-increasing dates, and that transactions on the same day do not get
-reordered.  See also the import command.
-
-   This command also supports output destination and output format
-selection.  Here's an example of print's CSV output:
-
-$ hledger print -Ocsv
-"txnidx","date","date2","status","code","description","comment","account","amount","commodity","credit","debit","posting-status","posting-comment"
-"1","2008/01/01","","","","income","","assets:bank:checking","1","$","","1","",""
-"1","2008/01/01","","","","income","","income:salary","-1","$","1","","",""
-"2","2008/06/01","","","","gift","","assets:bank:checking","1","$","","1","",""
-"2","2008/06/01","","","","gift","","income:gifts","-1","$","1","","",""
-"3","2008/06/02","","","","save","","assets:bank:saving","1","$","","1","",""
-"3","2008/06/02","","","","save","","assets:bank:checking","-1","$","1","","",""
-"4","2008/06/03","","*","","eat & shop","","expenses:food","1","$","","1","",""
-"4","2008/06/03","","*","","eat & shop","","expenses:supplies","1","$","","1","",""
-"4","2008/06/03","","*","","eat & shop","","assets:cash","-2","$","2","","",""
-"5","2008/12/31","","*","","pay off","","liabilities:debts","1","$","","1","",""
-"5","2008/12/31","","*","","pay off","","assets:bank:checking","-1","$","1","","",""
-
-   * There is one CSV record per posting, with the parent transaction's
-     fields repeated.
-   * 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 order, etc.)
-   * The amount is separated into "commodity" (the symbol) and "amount"
-     (numeric quantity) fields.
-   * The numeric amount is repeated in either the "credit" or "debit"
-     column, for convenience.  (Those names are not accurate in the
-     accounting sense; it just puts negative amounts under credit and
-     zero or greater amounts under debit.)
-
-
-File: hledger.info,  Node: print-unique,  Next: register,  Prev: print,  Up: COMMANDS
-
-4.22 print-unique
-=================
-
-print-unique
-Print transactions which do not reuse an already-seen description.
-
-   Example:
-
-$ cat unique.journal
-1/1 test
- (acct:one)  1
-2/2 test
- (acct:two)  2
-$ LEDGER_FILE=unique.journal hledger print-unique
-(-f option not supported)
-2015/01/01 test
-    (acct:one)             1
-
-
-File: hledger.info,  Node: register,  Next: register-match,  Prev: print-unique,  Up: COMMANDS
-
-4.23 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:
-
-$ hledger register checking
-2008/01/01 income               assets:bank:checking            $1           $1
-2008/06/01 gift                 assets:bank:checking            $1           $2
-2008/06/02 save                 assets:bank:checking           $-1           $1
-2008/12/31 pay off              assets:bank:checking           $-1            0
-
-   With -date2, it shows and sorts by secondary date instead.
-
-   The '--historical'/'-H' flag adds the balance from any undisplayed
-prior postings to the running total.  This is useful when you want to
-see only recent activity, with a historically accurate running balance:
-
-$ hledger register checking -b 2008/6 --historical
-2008/06/01 gift                 assets:bank:checking            $1           $2
-2008/06/02 save                 assets:bank:checking           $-1           $1
-2008/12/31 pay off              assets:bank:checking           $-1            0
-
-   The '--depth' option limits the amount of sub-account detail
-displayed.
-
-   The '--average'/'-A' flag shows the running average posting amount
-instead of the running total (so, the final number displayed is the
-average for the whole report period).  This flag implies '--empty' (see
-below).  It is affected by '--historical'.  It works best when showing
-just one account and one commodity.
-
-   The '--related'/'-r' flag shows the _other_ postings in the
-transactions of the postings which would normally be shown.
-
-   The '--invert' flag negates all amounts.  For example, it can be used
-on an income account where amounts are normally displayed as negative
-numbers.  It's also useful to show postings on the checking account
-together with the related account:
-
-$ hledger register --related --invert assets:checking
-
-   With a reporting interval, register shows summary postings, one per
-interval, aggregating the postings to each account:
-
-$ hledger register --monthly income
-2008/01                 income:salary                          $-1          $-1
-2008/06                 income:gifts                           $-1          $-2
-
-   Periods with no activity, and summary postings with a zero amount,
-are not shown by default; use the '--empty'/'-E' flag to see them:
-
-$ hledger register --monthly income -E
-2008/01                 income:salary                          $-1          $-1
-2008/02                                                          0          $-1
-2008/03                                                          0          $-1
-2008/04                                                          0          $-1
-2008/05                                                          0          $-1
-2008/06                 income:gifts                           $-1          $-2
-2008/07                                                          0          $-2
-2008/08                                                          0          $-2
-2008/09                                                          0          $-2
-2008/10                                                          0          $-2
-2008/11                                                          0          $-2
-2008/12                                                          0          $-2
-
-   Often, you'll want to see just one line per interval.  The '--depth'
-option helps with this, causing subaccounts to be aggregated:
-
-$ hledger register --monthly assets --depth 1h
-2008/01                 assets                                  $1           $1
-2008/06                 assets                                 $-1            0
-2008/12                 assets                                 $-1          $-1
-
-   Note when using report intervals, if you specify start/end dates
-these will be adjusted outward if necessary to contain a whole number of
-intervals.  This ensures that the first and last intervals are full
-length and comparable to the others in the report.
-
-* Menu:
-
-* Custom register output::
-
-
-File: hledger.info,  Node: Custom register output,  Up: register
-
-4.23.1 Custom register output
------------------------------
-
-register uses the full terminal width by default, except on windows.
-You can override this by setting the 'COLUMNS' environment variable (not
-a bash shell variable) or by using the '--width'/'-w' option.
-
-   The description and account columns normally share the space equally
-(about half of (width - 40) each).  You can adjust this by adding a
-description width as part of -width's argument, comma-separated:
-'--width W,D' .  Here's a diagram (won't display correctly in -help):
-
-<--------------------------------- width (W) ---------------------------------->
-date (10)  description (D)       account (W-41-D)     amount (12)   balance (12)
-DDDDDDDDDD dddddddddddddddddddd  aaaaaaaaaaaaaaaaaaa  AAAAAAAAAAAA  AAAAAAAAAAAA
-
-   and some examples:
-
-$ hledger reg                     # use terminal width (or 80 on windows)
-$ hledger reg -w 100              # use width 100
-$ COLUMNS=100 hledger reg         # set with one-time environment variable
-$ export COLUMNS=100; hledger reg # set till session end (or window resize)
-$ hledger reg -w 100,40           # set overall width 100, description width 40
-$ hledger reg -w $COLUMNS,40      # use terminal width, & description width 40
-
-   This command also supports output destination and output format
-selection.
-
-
-File: hledger.info,  Node: register-match,  Next: rewrite,  Prev: register,  Up: COMMANDS
-
-4.24 register-match
-===================
-
-register-match
-Print the one posting whose transaction description is closest to DESC,
-in the style of the register command.  If there are multiple equally
-good matches, it shows the most recent.  Query options (options, not
-arguments) can be used to restrict the search space.  Helps
-ledger-autosync detect already-seen transactions when importing.
-
-
-File: hledger.info,  Node: rewrite,  Next: roi,  Prev: register-match,  Up: COMMANDS
-
-4.25 rewrite
-============
-
-rewrite
-Print all transactions, rewriting the postings of matched transactions.
-For now the only rewrite available is adding new postings, like print
--auto.
-
-   This is a start at a generic rewriter of transaction entries.  It
-reads the default journal and prints the transactions, like print, but
-adds one or more specified postings to any transactions matching QUERY.
-The posting amounts can be fixed, or a multiplier of the existing
-transaction's first posting amount.
-
-   Examples:
-
-$ hledger-rewrite.hs ^income --add-posting '(liabilities:tax)  *.33  ; income tax' --add-posting '(reserve:gifts)  $100'
-$ hledger-rewrite.hs expenses:gifts --add-posting '(reserve:gifts)  *-1"'
-$ hledger-rewrite.hs -f rewrites.hledger
-
-   rewrites.hledger may consist of entries like:
-
-= ^income amt:<0 date:2017
-  (liabilities:tax)  *0.33  ; tax on income
-  (reserve:grocery)  *0.25  ; reserve 25% for grocery
-  (reserve:)  *0.25  ; reserve 25% for grocery
-
-   Note the single quotes to protect the dollar sign from bash, and the
-two spaces between account and amount.
-
-   More:
-
-$ hledger rewrite -- [QUERY]        --add-posting "ACCT  AMTEXPR" ...
-$ hledger rewrite -- ^income        --add-posting '(liabilities:tax)  *.33'
-$ hledger rewrite -- expenses:gifts --add-posting '(budget:gifts)  *-1"'
-$ hledger rewrite -- ^income        --add-posting '(budget:foreign currency)  *0.25 JPY; diversify'
-
-   Argument for '--add-posting' option is a usual posting of transaction
-with an exception for amount specification.  More precisely, you can use
-''*'' (star symbol) before the amount to indicate that that this is a
-factor for an amount of original matched posting.  If the amount
-includes a commodity name, the new posting amount will be in the new
-commodity; otherwise, it will be in the matched posting amount's
-commodity.
-
-* Menu:
-
-* Re-write rules in a file::
-
-
-File: hledger.info,  Node: Re-write rules in a file,  Up: rewrite
-
-4.25.1 Re-write rules in a file
--------------------------------
-
-During the run this tool will execute so called "Automated Transactions"
-found in any journal it process.  I.e instead of specifying this
-operations in command line you can put them in a journal file.
-
-$ rewrite-rules.journal
-
-   Make contents look like this:
-
-= ^income
-    (liabilities:tax)  *.33
-
-= expenses:gifts
-    budget:gifts  *-1
-    assets:budget  *1
-
-   Note that ''='' (equality symbol) that is used instead of date in
-transactions you usually write.  It indicates the query by which you
-want to match the posting to add new ones.
-
-$ hledger rewrite -- -f input.journal -f rewrite-rules.journal > rewritten-tidy-output.journal
-
-   This is something similar to the commands pipeline:
-
-$ hledger rewrite -- -f input.journal '^income' --add-posting '(liabilities:tax)  *.33' \
-  | hledger rewrite -- -f - expenses:gifts      --add-posting 'budget:gifts  *-1'       \
-                                                --add-posting 'assets:budget  *1'       \
-  > rewritten-tidy-output.journal
-
-   It is important to understand that relative order of such entries in
-journal is important.  You can re-use result of previously added
-postings.
-
-* Menu:
-
-* Diff output format::
-* rewrite vs print --auto::
-
-
-File: hledger.info,  Node: Diff output format,  Next: rewrite vs print --auto,  Up: Re-write rules in a file
-
-4.25.1.1 Diff output format
-...........................
-
-To use this tool for batch modification of your journal files you may
-find useful output in form of unified diff.
-
-$ hledger rewrite -- --diff -f examples/sample.journal '^income' --add-posting '(liabilities:tax)  *.33'
-
-   Output might look like:
-
---- /tmp/examples/sample.journal
-+++ /tmp/examples/sample.journal
-@@ -18,3 +18,4 @@
- 2008/01/01 income
--    assets:bank:checking  $1
-+    assets:bank:checking            $1
-     income:salary
-+    (liabilities:tax)                0
-@@ -22,3 +23,4 @@
- 2008/06/01 gift
--    assets:bank:checking  $1
-+    assets:bank:checking            $1
-     income:gifts
-+    (liabilities:tax)                0
-
-   If you'll pass this through 'patch' tool you'll get transactions
-containing the posting that matches your query be updated.  Note that
-multiple files might be update according to list of input files
-specified via '--file' options and 'include' directives inside of these
-files.
-
-   Be careful.  Whole transaction being re-formatted in a style of
-output from 'hledger print'.
-
-   See also:
-
-   https://github.com/simonmichael/hledger/issues/99
-
-
-File: hledger.info,  Node: rewrite vs print --auto,  Prev: Diff output format,  Up: Re-write rules in a file
-
-4.25.1.2 rewrite vs. print -auto
-................................
-
-This command predates print -auto, and currently does much the same
-thing, but with these differences:
-
-   * with multiple files, rewrite lets rules in any file affect all
-     other files.  print -auto uses standard directive scoping; rules
-     affect only child files.
-
-   * rewrite's query limits which transactions can be rewritten; all are
-     printed.  print -auto's query limits which transactions are
-     printed.
-
-   * rewrite applies rules specified on command line or in the journal.
-     print -auto applies rules specified in the journal.
-
-
-File: hledger.info,  Node: roi,  Next: stats,  Prev: rewrite,  Up: COMMANDS
-
-4.26 roi
-========
-
-roi
-Shows the time-weighted (TWR) and money-weighted (IRR) rate of return on
-your investments.
-
-   This command assumes that you have account(s) that hold nothing but
-your investments and whenever you record current appraisal/valuation of
-these investments you offset unrealized profit and loss into account(s)
-that, again, hold nothing but unrealized profit and loss.
-
-   Any transactions affecting balance of investment account(s) and not
-originating from unrealized profit and loss account(s) are assumed to be
-your investments or withdrawals.
-
-   At a minimum, you need to supply a query (which could be just an
-account name) to select your investments with '--inv', and another query
-to identify your profit and loss transactions with '--pnl'.
-
-   It will compute and display the internalized rate of return (IRR) and
-time-weighted rate of return (TWR) for your investments for the time
-period requested.  Both rates of return are annualized before display,
-regardless of the length of reporting interval.
-
-
-File: hledger.info,  Node: stats,  Next: tags,  Prev: roi,  Up: COMMANDS
-
-4.27 stats
-==========
-
-stats
-Show some journal statistics.
-
-   The stats command displays summary information for the whole journal,
-or a matched part of it.  With a reporting interval, it shows a report
-for each report period.
-
-   Example:
-
-$ hledger stats
-Main journal file        : /src/hledger/examples/sample.journal
-Included journal files   : 
-Transactions span        : 2008-01-01 to 2009-01-01 (366 days)
-Last transaction         : 2008-12-31 (2333 days ago)
-Transactions             : 5 (0.0 per day)
-Transactions last 30 days: 0 (0.0 per day)
-Transactions last 7 days : 0 (0.0 per day)
-Payees/descriptions      : 5
-Accounts                 : 8 (depth 3)
-Commodities              : 1 ($)
-Market prices            : 12 ($)
-
-   This command also supports output destination and output format
-selection.
-
-
-File: hledger.info,  Node: tags,  Next: test,  Prev: stats,  Up: COMMANDS
-
-4.28 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.
-
-
-File: hledger.info,  Node: test,  Prev: tags,  Up: COMMANDS
-
-4.29 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
-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 as
-a bug!
-
-   This command also accepts tasty test runner options, written after a
-- (double hyphen).  Eg to run only the tests in Hledger.Data.Amount,
-with ANSI colour codes disabled:
-
-$ hledger test -- -pData.Amount --color=never
-
-   For help on these, see https://github.com/feuerbach/tasty#options
-('-- --help' currently doesn't show them).
-
-
-File: hledger.info,  Node: ADD-ON COMMANDS,  Prev: COMMANDS,  Up: Top
-
-5 ADD-ON COMMANDS
-*****************
-
-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
-extension (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
-things to be aware of.  Eg if the 'hledger-web' add-on is installed,
-
-   * 'hledger -h web' shows hledger's help, while 'hledger web -h' shows
-     hledger-web's help.
-
-   * 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'.
-
-   * 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
-options, journal parsing, reporting, etc.
-
-   Here are some hledger add-ons available:
-
-* Menu:
-
-* Official add-ons::
-* Third party add-ons::
-* Experimental add-ons::
-
-
-File: hledger.info,  Node: Official add-ons,  Next: Third party add-ons,  Up: ADD-ON COMMANDS
-
-5.1 Official add-ons
-====================
-
-These are maintained and released along with hledger.
-
-* Menu:
-
-* ui::
-* web::
-
-
-File: hledger.info,  Node: ui,  Next: web,  Up: Official add-ons
-
-5.1.1 ui
---------
-
-hledger-ui provides an efficient terminal interface.
-
-
-File: hledger.info,  Node: web,  Prev: ui,  Up: Official add-ons
-
-5.1.2 web
----------
-
-hledger-web provides a simple web interface.
-
-
-File: hledger.info,  Node: Third party add-ons,  Next: Experimental add-ons,  Prev: Official add-ons,  Up: ADD-ON COMMANDS
-
-5.2 Third party add-ons
-=======================
-
-These are maintained separately, and usually updated shortly after a
-hledger release.
-
-* Menu:
-
-* diff::
-* iadd::
-* interest::
-* irr::
-
-5.2.1 diff
-----------
-
-hledger-diff shows differences in an account's transactions between one
-journal file and another.
-
-
-File: hledger.info,  Node: iadd,  Next: interest,  Prev: ,  Up: Third party add-ons
-
-5.2.2 iadd
-----------
-
-hledger-iadd is a more interactive, terminal UI replacement for the add
-command.
-
-
-File: hledger.info,  Node: interest,  Next: irr,  Prev: iadd,  Up: Third party add-ons
-
-5.2.3 interest
---------------
-
-hledger-interest generates interest transactions for an account
-according to various schemes.
-
-
-File: hledger.info,  Node: irr,  Prev: interest,  Up: Third party add-ons
-
-5.2.4 irr
----------
-
-hledger-irr calculates the internal rate of return of an investment
-account, but it's superseded now by the built-in roi command.
-
-
-File: hledger.info,  Node: Experimental add-ons,  Prev: Third party add-ons,  Up: ADD-ON COMMANDS
-
-5.3 Experimental add-ons
-========================
-
-These are available in source form in the hledger repo's bin/ directory.
-They may be less mature and documented than built-in commands.  Reading
-and tweaking these is a good way to start making your own!
-
-* Menu:
-
-* autosync::
-* chart::
-* check::
-
-
-File: hledger.info,  Node: autosync,  Next: chart,  Up: Experimental add-ons
-
-5.3.1 autosync
---------------
-
-hledger-autosync is a symbolic link for easily running ledger-autosync,
-if installed.  ledger-autosync does deduplicating conversion of OFX data
-and some CSV formats, and can also download the data if your bank offers
-OFX Direct Connect.
-
-
-File: hledger.info,  Node: chart,  Next: check,  Prev: autosync,  Up: Experimental add-ons
-
-5.3.2 chart
------------
-
-hledger-chart.hs is an old pie chart generator, in need of some love.
-
-
-File: hledger.info,  Node: check,  Prev: chart,  Up: Experimental add-ons
-
-5.3.3 check
------------
-
-hledger-check.hs checks more powerful account balance assertions.
-
-
-Tag Table:
-Node: Top68
-Node: EXAMPLES1891
-Ref: #examples1991
-Node: OPTIONS3637
-Ref: #options3739
-Node: General options4138
-Ref: #general-options4263
-Node: Command options6917
-Ref: #command-options7068
-Node: Command arguments7466
-Ref: #command-arguments7620
-Node: Argument files7741
-Ref: #argument-files7917
-Node: Special characters in arguments and queries8183
-Ref: #special-characters-in-arguments-and-queries8417
-Node: More escaping8868
-Ref: #more-escaping9030
-Node: Even more escaping9326
-Ref: #even-more-escaping9520
-Node: Less escaping10191
-Ref: #less-escaping10353
-Node: Command line tips10598
-Ref: #command-line-tips10784
-Node: Unicode characters11161
-Ref: #unicode-characters11317
-Node: Input files12729
-Ref: #input-files12865
-Node: Smart dates14794
-Ref: #smart-dates14935
-Node: Report start & end date16341
-Ref: #report-start-end-date16513
-Node: Report intervals17937
-Ref: #report-intervals18102
-Node: Period expressions18492
-Ref: #period-expressions18652
-Node: Depth limiting22607
-Ref: #depth-limiting22751
-Node: Pivoting23093
-Ref: #pivoting23216
-Node: Valuation24892
-Ref: #valuation25021
-Node: -B Cost25201
-Ref: #b-cost25312
-Node: -V Market value25510
-Ref: #v-market-value25684
-Node: -X Market value in specified commodity27116
-Ref: #x-market-value-in-specified-commodity27355
-Node: --value Flexible valuation27531
-Ref: #value-flexible-valuation27757
-Node: Effect of --value on reports31947
-Ref: #effect-of---value-on-reports32163
-Node: Combining -B -V -X --value37094
-Ref: #combining--b--v--x---value37277
-Node: Output destination37313
-Ref: #output-destination37465
-Node: Output format37748
-Ref: #output-format37900
-Node: Regular expressions38285
-Ref: #regular-expressions38422
-Node: QUERIES39783
-Ref: #queries39885
-Node: COMMANDS43847
-Ref: #commands43959
-Node: accounts45023
-Ref: #accounts45121
-Node: activity45820
-Ref: #activity45930
-Node: add46313
-Ref: #add46412
-Node: balance49157
-Ref: #balance49268
-Node: Classic balance report50726
-Ref: #classic-balance-report50899
-Node: Customising the classic balance report52268
-Ref: #customising-the-classic-balance-report52496
-Node: Colour support54572
-Ref: #colour-support54739
-Node: Flat mode54912
-Ref: #flat-mode55060
-Node: Depth limited balance reports55473
-Ref: #depth-limited-balance-reports55658
-Node: Percentages56114
-Ref: #percentages56280
-Node: Multicolumn balance report57417
-Ref: #multicolumn-balance-report57597
-Node: Budget report62911
-Ref: #budget-report63054
-Node: Nested budgets68256
-Ref: #nested-budgets68368
-Ref: #output-format-171848
-Node: balancesheet71926
-Ref: #balancesheet72062
-Node: balancesheetequity73445
-Ref: #balancesheetequity73594
-Node: cashflow74155
-Ref: #cashflow74283
-Node: check-dates75379
-Ref: #check-dates75506
-Node: check-dupes75785
-Ref: #check-dupes75909
-Node: close76202
-Ref: #close76316
-Node: commodities79982
-Ref: #commodities80109
-Node: descriptions80191
-Ref: #descriptions80319
-Node: diff80500
-Ref: #diff80606
-Node: files81653
-Ref: #files81753
-Node: help81900
-Ref: #help82000
-Node: import83081
-Ref: #import83195
-Node: Importing balance assignments84088
-Ref: #importing-balance-assignments84236
-Node: incomestatement84885
-Ref: #incomestatement85018
-Node: notes86422
-Ref: #notes86535
-Node: payees86661
-Ref: #payees86767
-Node: prices86925
-Ref: #prices87031
-Node: print87372
-Ref: #print87482
-Node: print-unique91975
-Ref: #print-unique92101
-Node: register92386
-Ref: #register92513
-Node: Custom register output96685
-Ref: #custom-register-output96814
-Node: register-match98076
-Ref: #register-match98210
-Node: rewrite98561
-Ref: #rewrite98676
-Node: Re-write rules in a file100531
-Ref: #re-write-rules-in-a-file100665
-Node: Diff output format101875
-Ref: #diff-output-format102044
-Node: rewrite vs print --auto103136
-Ref: #rewrite-vs.-print---auto103315
-Node: roi103871
-Ref: #roi103969
-Node: stats104981
-Ref: #stats105080
-Node: tags105868
-Ref: #tags105966
-Node: test106260
-Ref: #test106344
-Node: ADD-ON COMMANDS107091
-Ref: #add-on-commands107201
-Node: Official add-ons108489
-Ref: #official-add-ons108629
-Node: ui108709
-Ref: #ui108796
-Node: web108850
-Ref: #web108939
-Node: Third party add-ons108985
-Ref: #third-party-add-ons109160
-Ref: #diff-1109319
-Node: iadd109418
-Ref: #iadd109528
-Node: interest109610
-Ref: #interest109731
-Node: irr109826
-Ref: #irr109924
-Node: Experimental add-ons110055
-Ref: #experimental-add-ons110207
-Node: autosync110455
-Ref: #autosync110566
-Node: chart110805
-Ref: #chart110924
-Node: check110995
-Ref: #check111097
+File: hledger.info,  Node: Top,  Next: COMMON TASKS,  Up: (dir)
+
+hledger(1) hledger 1.17
+***********************
+
+hledger - a command-line accounting tool
+
+   'hledger [-f FILE] COMMAND [OPTIONS] [ARGS]'
+'hledger [-f FILE] ADDONCMD -- [OPTIONS] [ARGS]'
+'hledger'
+
+   hledger is a reliable, cross-platform set of programs for tracking
+money, time, or any other commodity, using double-entry accounting and a
+simple, editable file format.  hledger is inspired by and largely
+compatible with ledger(1).
+
+   This is hledger's command-line interface (there are also terminal and
+web interfaces).  Its basic function is to read a plain text file
+describing financial transactions (in accounting terms, a general
+journal) and print useful reports on standard output, or export them as
+CSV. hledger can also read some other file formats such as CSV files,
+translating them to journal format.  Additionally, hledger lists other
+hledger-* executables found in the user's $PATH and can invoke them as
+subcommands.
+
+   hledger reads data from one or more files in hledger journal,
+timeclock, timedot, or CSV format specified with '-f', or
+'$LEDGER_FILE', or '$HOME/.hledger.journal' (on windows, perhaps
+'C:/Users/USER/.hledger.journal').  If using '$LEDGER_FILE', note this
+must be a real environment variable, not a shell variable.  You can
+specify standard input with '-f-'.
+
+   Transactions are dated movements of money between two (or more) named
+accounts, and are recorded with journal entries like this:
+
+2015/10/16 bought food
+ expenses:food          $10
+ assets:cash
+
+   For more about this format, see hledger_journal(5).
+
+   Most users use a text editor to edit the journal, usually with an
+editor mode such as ledger-mode for added convenience.  hledger's
+interactive add command is another way to record new transactions.
+hledger never changes existing transactions.
+
+   To get started, you can either save some entries like the above in
+'~/.hledger.journal', or run 'hledger add' and follow the prompts.  Then
+try some commands like 'hledger print' or 'hledger balance'.  Run
+'hledger' with no arguments for a list of commands.
+
+* Menu:
+
+* COMMON TASKS::
+* OPTIONS::
+* COMMANDS::
+* ENVIRONMENT::
+* FILES::
+* LIMITATIONS::
+* TROUBLESHOOTING::
+
+
+File: hledger.info,  Node: COMMON TASKS,  Next: OPTIONS,  Prev: Top,  Up: Top
+
+1 COMMON TASKS
+**************
+
+Here are some quick examples of how to do some basic tasks with hledger.
+For more details, see the reference section below, the
+hledger_journal(5) manual, or the more extensive docs at
+https://hledger.org.
+
+* Menu:
+
+* Getting help::
+* Constructing command lines::
+* Starting a journal file::
+* Setting opening balances::
+* Recording transactions::
+* Reconciling::
+* Reporting::
+* Migrating to a new file::
+
+
+File: hledger.info,  Node: Getting help,  Next: Constructing command lines,  Up: COMMON TASKS
+
+1.1 Getting help
+================
+
+$ hledger                 # show available commands
+$ hledger --help          # show common options
+$ hledger CMD --help      # show common and command options, and command help
+$ hledger help            # show available manuals/topics
+$ hledger help hledger    # show hledger manual as info/man/text (auto-chosen)
+$ hledger help journal --man  # show the journal manual as a man page
+$ hledger help --help     # show more detailed help for the help command
+
+   Find more docs, chat, mail list, reddit, issue tracker:
+https://hledger.org#help-feedback
+
+
+File: hledger.info,  Node: Constructing command lines,  Next: Starting a journal file,  Prev: Getting help,  Up: COMMON TASKS
+
+1.2 Constructing command lines
+==============================
+
+hledger has an extensive and powerful command line interface.  We strive
+to keep it simple and ergonomic, but you may run into one of the
+confusing real world details described in OPTIONS, below.  If that
+happens, here are some tips that may help:
+
+   * command-specific options must go after the command (it's fine to
+     put all options there) ('hledger CMD OPTS ARGS')
+   * running add-on executables directly simplifies command line parsing
+     ('hledger-ui OPTS ARGS')
+   * enclose "problematic" args in single quotes
+   * if needed, also add a backslash to hide regular expression
+     metacharacters from the shell
+   * to see how a misbehaving command is being parsed, add '--debug=2'.
+
+
+File: hledger.info,  Node: Starting a journal file,  Next: Setting opening balances,  Prev: Constructing command lines,  Up: COMMON TASKS
+
+1.3 Starting a journal file
+===========================
+
+hledger looks for your accounting data in a journal file,
+'$HOME/.hledger.journal' by default:
+
+$ hledger stats
+The hledger journal file "/Users/simon/.hledger.journal" was not found.
+Please create it first, eg with "hledger add" or a text editor.
+Or, specify an existing journal file with -f or LEDGER_FILE.
+
+   You can override this by setting the 'LEDGER_FILE' environment
+variable.  It's a good practice to keep this important file under
+version control, and to start a new file each year.  So you could do
+something like this:
+
+$ mkdir ~/finance
+$ cd ~/finance
+$ git init
+Initialized empty Git repository in /Users/simon/finance/.git/
+$ touch 2020.journal
+$ echo "export LEDGER_FILE=$HOME/finance/2020.journal" >> ~/.bashrc
+$ source ~/.bashrc
+$ hledger stats
+Main file                : /Users/simon/finance/2020.journal
+Included files           : 
+Transactions span        :  to  (0 days)
+Last transaction         : none
+Transactions             : 0 (0.0 per day)
+Transactions last 30 days: 0 (0.0 per day)
+Transactions last 7 days : 0 (0.0 per day)
+Payees/descriptions      : 0
+Accounts                 : 0 (depth 0)
+Commodities              : 0 ()
+Market prices            : 0 ()
+
+
+File: hledger.info,  Node: Setting opening balances,  Next: Recording transactions,  Prev: Starting a journal file,  Up: COMMON TASKS
+
+1.4 Setting opening balances
+============================
+
+Pick a starting date for which you can look up the balances of some
+real-world assets (bank accounts, wallet..)  and liabilities (credit
+cards..).
+
+   To avoid a lot of data entry, you may want to start with just one or
+two accounts, like your checking account or cash wallet; and pick a
+recent starting date, like today or the start of the week.  You can
+always come back later and add more accounts and older transactions, eg
+going back to january 1st.
+
+   Add an opening balances transaction to the journal, declaring the
+balances on this date.  Here are two ways to do it:
+
+   * The first way: open the journal in any text editor and save an
+     entry like this:
+
+     2020-01-01 * opening balances
+         assets:bank:checking                $1000   = $1000
+         assets:bank:savings                 $2000   = $2000
+         assets:cash                          $100   = $100
+         liabilities:creditcard               $-50   = $-50
+         equity:opening/closing balances
+
+     These are start-of-day balances, ie whatever was in the account at
+     the end of the previous day.
+
+     The * after the date is an optional status flag.  Here it means
+     "cleared & confirmed".
+
+     The currency symbols are optional, but usually a good idea as
+     you'll be dealing with multiple currencies sooner or later.
+
+     The = amounts are optional balance assertions, providing extra
+     error checking.
+
+   * The second way: run 'hledger add' and follow the prompts to record
+     a similar transaction:
+
+     $ hledger add
+     Adding transactions to journal file /Users/simon/finance/2020.journal
+     Any command line arguments will be used as defaults.
+     Use tab key to complete, readline keys to edit, enter to accept defaults.
+     An optional (CODE) may follow transaction dates.
+     An optional ; COMMENT may follow descriptions or amounts.
+     If you make a mistake, enter < at any prompt to go one step backward.
+     To end a transaction, enter . when prompted.
+     To quit, enter . at a date prompt or press control-d or control-c.
+     Date [2020-02-07]: 2020-01-01
+     Description: * opening balances
+     Account 1: assets:bank:checking
+     Amount  1: $1000
+     Account 2: assets:bank:savings
+     Amount  2 [$-1000]: $2000
+     Account 3: assets:cash
+     Amount  3 [$-3000]: $100
+     Account 4: liabilities:creditcard
+     Amount  4 [$-3100]: $-50
+     Account 5: equity:opening/closing balances
+     Amount  5 [$-3050]: 
+     Account 6 (or . or enter to finish this transaction): .
+     2020-01-01 * opening balances
+         assets:bank:checking                      $1000
+         assets:bank:savings                       $2000
+         assets:cash                                $100
+         liabilities:creditcard                     $-50
+         equity:opening/closing balances          $-3050
+     
+     Save this transaction to the journal ? [y]: 
+     Saved.
+     Starting the next transaction (. or ctrl-D/ctrl-C to quit)
+     Date [2020-01-01]: .
+
+   If you're using version control, this could be a good time to commit
+the journal.  Eg:
+
+$ git commit -m 'initial balances' 2020.journal
+
+
+File: hledger.info,  Node: Recording transactions,  Next: Reconciling,  Prev: Setting opening balances,  Up: COMMON TASKS
+
+1.5 Recording transactions
+==========================
+
+As you spend or receive money, you can record these transactions using
+one of the methods above (text editor, hledger add) or by using the
+hledger-iadd or hledger-web add-ons, or by using the import command to
+convert CSV data downloaded from your bank.
+
+   Here are some simple transactions, see the hledger_journal(5) manual
+and hledger.org for more ideas:
+
+2020/1/10 * gift received
+  assets:cash   $20
+  income:gifts
+
+2020.1.12 * farmers market
+  expenses:food    $13
+  assets:cash
+
+2020-01-15 paycheck
+  income:salary
+  assets:bank:checking    $1000
+
+
+File: hledger.info,  Node: Reconciling,  Next: Reporting,  Prev: Recording transactions,  Up: COMMON TASKS
+
+1.6 Reconciling
+===============
+
+Periodically you should reconcile - compare your hledger-reported
+balances against external sources of truth, like bank statements or your
+bank's website - to be sure that your ledger accurately represents the
+real-world balances (and, that the real-world institutions have not made
+a mistake!).  This gets easy and fast with (1) practice and (2)
+frequency.  If you do it daily, it can take 2-10 minutes.  If you let it
+pile up, expect it to take longer as you hunt down errors and
+discrepancies.
+
+   A typical workflow:
+
+  1. Reconcile cash.  Count what's in your wallet.  Compare with what
+     hledger reports ('hledger bal cash').  If they are different, try
+     to remember the missing transaction, or look for the error in the
+     already-recorded transactions.  A register report can be helpful
+     ('hledger reg cash').  If you can't find the error, add an
+     adjustment transaction.  Eg if you have $105 after the above, and
+     can't explain the missing $2, it could be:
+
+     2020-01-16 * adjust cash
+         assets:cash    $-2 = $105
+         expenses:misc
+
+  2. Reconcile checking.  Log in to your bank's website.  Compare
+     today's (cleared) balance with hledger's cleared balance ('hledger
+     bal checking -C').  If they are different, track down the error or
+     record the missing transaction(s) or add an adjustment transaction,
+     similar to the above.  Unlike the cash case, you can usually
+     compare the transaction history and running balance from your bank
+     with the one reported by 'hledger reg checking -C'.  This will be
+     easier if you generally record transaction dates quite similar to
+     your bank's clearing dates.
+
+  3. Repeat for other asset/liability accounts.
+
+   Tip: instead of the register command, use hledger-ui to see a
+live-updating register while you edit the journal: 'hledger-ui --watch
+--register checking -C'
+
+   After reconciling, it could be a good time to mark the reconciled
+transactions' status as "cleared and confirmed", if you want to track
+that, by adding the '*' marker.  Eg in the paycheck transaction above,
+insert '*' between '2020-01-15' and 'paycheck'
+
+   If you're using version control, this can be another good time to
+commit:
+
+$ git commit -m 'txns' 2020.journal
+
+
+File: hledger.info,  Node: Reporting,  Next: Migrating to a new file,  Prev: Reconciling,  Up: COMMON TASKS
+
+1.7 Reporting
+=============
+
+Here are some basic reports.
+
+   Show all transactions:
+
+$ hledger print
+2020-01-01 * opening balances
+    assets:bank:checking                      $1000
+    assets:bank:savings                       $2000
+    assets:cash                                $100
+    liabilities:creditcard                     $-50
+    equity:opening/closing balances          $-3050
+
+2020-01-10 * gift received
+    assets:cash              $20
+    income:gifts
+
+2020-01-12 * farmers market
+    expenses:food             $13
+    assets:cash
+
+2020-01-15 * paycheck
+    income:salary
+    assets:bank:checking           $1000
+
+2020-01-16 * adjust cash
+    assets:cash               $-2 = $105
+    expenses:misc
+
+   Show account names, and their hierarchy:
+
+$ hledger accounts --tree
+assets
+  bank
+    checking
+    savings
+  cash
+equity
+  opening/closing balances
+expenses
+  food
+  misc
+income
+  gifts
+  salary
+liabilities
+  creditcard
+
+   Show all account totals:
+
+$ hledger balance
+               $4105  assets
+               $4000    bank
+               $2000      checking
+               $2000      savings
+                $105    cash
+              $-3050  equity:opening/closing balances
+                 $15  expenses
+                 $13    food
+                  $2    misc
+              $-1020  income
+                $-20    gifts
+              $-1000    salary
+                $-50  liabilities:creditcard
+--------------------
+                   0
+
+   Show only asset and liability balances, as a flat list, limited to
+depth 2:
+
+$ hledger bal assets liabilities --flat -2
+               $4000  assets:bank
+                $105  assets:cash
+                $-50  liabilities:creditcard
+--------------------
+               $4055
+
+   Show the same thing without negative numbers, formatted as a simple
+balance sheet:
+
+$ hledger bs --flat -2
+Balance Sheet 2020-01-16
+
+                        || 2020-01-16 
+========================++============
+ Assets                 ||            
+------------------------++------------
+ assets:bank            ||      $4000 
+ assets:cash            ||       $105 
+------------------------++------------
+                        ||      $4105 
+========================++============
+ Liabilities            ||            
+------------------------++------------
+ liabilities:creditcard ||        $50 
+------------------------++------------
+                        ||        $50 
+========================++============
+ Net:                   ||      $4055 
+
+   The final total is your "net worth" on the end date.  (Or use 'bse'
+for a full balance sheet with equity.)
+
+   Show income and expense totals, formatted as an income statement:
+
+hledger is 
+Income Statement 2020-01-01-2020-01-16
+
+               || 2020-01-01-2020-01-16 
+===============++=======================
+ Revenues      ||                       
+---------------++-----------------------
+ income:gifts  ||                   $20 
+ income:salary ||                 $1000 
+---------------++-----------------------
+               ||                 $1020 
+===============++=======================
+ Expenses      ||                       
+---------------++-----------------------
+ expenses:food ||                   $13 
+ expenses:misc ||                    $2 
+---------------++-----------------------
+               ||                   $15 
+===============++=======================
+ Net:          ||                 $1005 
+
+   The final total is your net income during this period.
+
+   Show transactions affecting your wallet, with running total:
+
+$ hledger register cash
+2020-01-01 opening balances     assets:cash                   $100          $100
+2020-01-10 gift received        assets:cash                    $20          $120
+2020-01-12 farmers market       assets:cash                   $-13          $107
+2020-01-16 adjust cash          assets:cash                    $-2          $105
+
+   Show weekly posting counts as a bar chart:
+
+$ hledger activity -W
+2019-12-30 *****
+2020-01-06 ****
+2020-01-13 ****
+
+
+File: hledger.info,  Node: Migrating to a new file,  Prev: Reporting,  Up: COMMON TASKS
+
+1.8 Migrating to a new file
+===========================
+
+At the end of the year, you may want to continue your journal in a new
+file, so that old transactions don't slow down or clutter your reports,
+and to help ensure the integrity of your accounting history.  See the
+close command.
+
+   If using version control, don't forget to 'git add' the new file.
+
+
+File: hledger.info,  Node: OPTIONS,  Next: COMMANDS,  Prev: COMMON TASKS,  Up: Top
+
+2 OPTIONS
+*********
+
+* Menu:
+
+* General options::
+* Command options::
+* Command arguments::
+* Queries::
+* Special characters in arguments and queries::
+* Unicode characters::
+* Input files::
+* Output destination::
+* Output format::
+* Regular expressions::
+* Smart dates::
+* Report start & end date::
+* Report intervals::
+* Period expressions::
+* Depth limiting::
+* Pivoting::
+* Valuation::
+
+
+File: hledger.info,  Node: General options,  Next: Command options,  Up: OPTIONS
+
+2.1 General options
+===================
+
+To see general usage help, including general options which are supported
+by most hledger commands, run 'hledger -h'.
+
+   General help options:
+
+'-h --help'
+
+     show general usage (or after COMMAND, command usage)
+'--version'
+
+     show version
+'--debug[=N]'
+
+     show debug output (levels 1-9, default: 1)
+
+   General input options:
+
+'-f FILE --file=FILE'
+
+     use a different input file.  For stdin, use - (default:
+     '$LEDGER_FILE' or '$HOME/.hledger.journal')
+'--rules-file=RULESFILE'
+
+     Conversion rules file to use when reading CSV (default: FILE.rules)
+'--separator=CHAR'
+
+     Field separator to expect when reading CSV (default: ',')
+'--alias=OLD=NEW'
+
+     rename accounts named OLD to NEW
+'--anon'
+
+     anonymize accounts and payees
+'--pivot FIELDNAME'
+
+     use some other field or tag for the account name
+'-I --ignore-assertions'
+
+     disable balance assertion checks (note: does not disable balance
+     assignments)
+
+   General reporting options:
+
+'-b --begin=DATE'
+
+     include postings/txns on or after this date
+'-e --end=DATE'
+
+     include postings/txns before this date
+'-D --daily'
+
+     multiperiod/multicolumn report by day
+'-W --weekly'
+
+     multiperiod/multicolumn report by week
+'-M --monthly'
+
+     multiperiod/multicolumn report by month
+'-Q --quarterly'
+
+     multiperiod/multicolumn report by quarter
+'-Y --yearly'
+
+     multiperiod/multicolumn report by year
+'-p --period=PERIODEXP'
+
+     set start date, end date, and/or reporting interval all at once
+     using period expressions syntax
+'--date2'
+
+     match the secondary date instead (see command help for other
+     effects)
+'-U --unmarked'
+
+     include only unmarked postings/txns (can combine with -P or -C)
+'-P --pending'
+
+     include only pending postings/txns
+'-C --cleared'
+
+     include only cleared postings/txns
+'-R --real'
+
+     include only non-virtual postings
+'-NUM --depth=NUM'
+
+     hide/aggregate accounts or postings more than NUM levels deep
+'-E --empty'
+
+     show items with zero amount, normally hidden (and vice-versa in
+     hledger-ui/hledger-web)
+'-B --cost'
+
+     convert amounts to their cost at transaction time (using the
+     transaction price, if any)
+'-V --value'
+
+     convert amounts to their market value on the report end date (using
+     the most recent applicable market price, if any)
+'--auto'
+
+     apply automated posting rules to modify transactions.
+'--forecast'
+
+     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.
+
+   When a reporting option appears more than once in the command line,
+the last one takes precedence.
+
+   Some reporting options can also be written as query arguments.
+
+
+File: hledger.info,  Node: Command options,  Next: Command arguments,  Prev: General options,  Up: OPTIONS
+
+2.2 Command options
+===================
+
+To see options for a particular command, including command-specific
+options, run: 'hledger COMMAND -h'.
+
+   Command-specific options must be written after the command name, eg:
+'hledger print -x'.
+
+   Additionally, if the command is an addon, you may need to put its
+options after a double-hyphen, eg: 'hledger ui -- --watch'.  Or, you can
+run the addon executable directly: 'hledger-ui --watch'.
+
+
+File: hledger.info,  Node: Command arguments,  Next: Queries,  Prev: Command options,  Up: OPTIONS
+
+2.3 Command arguments
+=====================
+
+Most hledger commands accept arguments after the command name, which are
+often a query, filtering the data in some way.
+
+   You can save a set of command line options/arguments in a file, and
+then reuse them by writing '@FILENAME' as a command line argument.  Eg:
+'hledger bal @foo.args'.  (To prevent this, eg if you have an argument
+that begins with a literal '@', precede it with '--', eg: 'hledger bal
+-- @ARG').
+
+   Inside the argument file, each line should contain just one option or
+argument.  Avoid the use of spaces, except inside quotes (or you'll see
+a confusing error).  Between a flag and its argument, use = (or
+nothing).  Bad:
+
+assets depth:2
+-X USD
+
+   Good:
+
+assets
+depth:2
+-X=USD
+
+   For special characters (see below), use one less level of quoting
+than you would at the command prompt.  Bad:
+
+-X"$"
+
+   Good:
+
+-X$
+
+   See also: Save frequently used options.
+
+
+File: hledger.info,  Node: Queries,  Next: Special characters in arguments and queries,  Prev: Command arguments,  Up: OPTIONS
+
+2.4 Queries
+===========
+
+One of hledger's strengths is being able to quickly report on precise
+subsets of your data.  Most commands accept an optional query
+expression, written as arguments after the command name, to filter the
+data by date, account name or other criteria.  The syntax is similar to
+a web search: one or more space-separated search terms, quotes to
+enclose whitespace, prefixes to match specific fields, a not: prefix to
+negate the match.
+
+   We do not yet support arbitrary boolean combinations of search terms;
+instead most commands show transactions/postings/accounts which match
+(or negatively match):
+
+   * any of the description terms AND
+   * any of the account terms AND
+   * any of the status terms AND
+   * all the other terms.
+
+   The print command instead shows transactions which:
+
+   * match any of the description terms AND
+   * have any postings matching any of the positive account terms AND
+   * have no postings matching any of the negative account terms AND
+   * match all the other terms.
+
+   The following kinds of search terms can be used.  Remember these can
+also be prefixed with *'not:'*, eg to exclude a particular subaccount.
+
+*'REGEX', 'acct:REGEX'*
+
+     match account names by this regular expression.  (With no prefix,
+     'acct:' is assumed.)  same as above
+
+*'amt:N, amt:<N, amt:<=N, amt:>N, amt:>=N'*
+
+     match postings with a single-commodity amount that is equal to,
+     less than, or greater than N. (Multi-commodity amounts are not
+     tested, and will always match.)  The comparison has two modes: if N
+     is preceded by a + or - sign (or is 0), the two signed numbers are
+     compared.  Otherwise, the absolute magnitudes are compared,
+     ignoring sign.
+*'code:REGEX'*
+
+     match by transaction code (eg check number)
+*'cur:REGEX'*
+
+     match postings or transactions including any amounts whose
+     currency/commodity symbol is fully matched by REGEX. (For a partial
+     match, use '.*REGEX.*').  Note, to match characters which are
+     regex-significant, like the dollar sign ('$'), you need to prepend
+     '\'.  And when using the command line you need to add one more
+     level of quoting to hide it from the shell, so eg do: 'hledger
+     print cur:'\$'' or 'hledger print cur:\\$'.
+*'desc:REGEX'*
+
+     match transaction descriptions.
+*'date:PERIODEXPR'*
+
+     match dates within the specified period.  PERIODEXPR is a period
+     expression (with no report interval).  Examples: 'date:2016',
+     'date:thismonth', 'date:2000/2/1-2/15', 'date:lastweek-'.  If the
+     '--date2' command line flag is present, this matches secondary
+     dates instead.
+*'date2:PERIODEXPR'*
+
+     match secondary dates within the specified period.
+*'depth:N'*
+
+     match (or display, depending on command) accounts at or above this
+     depth
+*'note:REGEX'*
+
+     match transaction notes (part of description right of '|', or whole
+     description when there's no '|')
+*'payee:REGEX'*
+
+     match transaction payee/payer names (part of description left of
+     '|', or whole description when there's no '|')
+*'real:, real:0'*
+
+     match real or virtual postings respectively
+*'status:, status:!, status:*'*
+
+     match unmarked, pending, or cleared transactions respectively
+*'tag:REGEX[=REGEX]'*
+
+     match by tag name, and optionally also by tag value.  Note a tag:
+     query is considered to match a transaction if it matches any of the
+     postings.  Also remember that postings inherit the tags of their
+     parent transaction.
+
+   The following special search term is used automatically in
+hledger-web, only:
+
+*'inacct:ACCTNAME'*
+
+     tells hledger-web to show the transaction register for this
+     account.  Can be filtered further with 'acct' etc.
+
+   Some of these can also be expressed as command-line options (eg
+'depth:2' is equivalent to '--depth 2').  Generally you can mix options
+and query arguments, and the resulting query will be their intersection
+(perhaps excluding the '-p/--period' option).
+
+
+File: hledger.info,  Node: Special characters in arguments and queries,  Next: Unicode characters,  Prev: Queries,  Up: OPTIONS
+
+2.5 Special characters in arguments and queries
+===============================================
+
+In shell command lines, option and argument values which contain
+"problematic" characters, ie spaces, and also characters significant to
+your shell such as '<', '>', '(', ')', '|' and '$', should be escaped by
+enclosing them in quotes or by writing backslashes before the
+characters.  Eg:
+
+   'hledger register -p 'last year' "accounts receivable
+(receivable|payable)" amt:\>100'.
+
+* Menu:
+
+* More escaping::
+* Even more escaping::
+* Less escaping::
+
+
+File: hledger.info,  Node: More escaping,  Next: Even more escaping,  Up: Special characters in arguments and queries
+
+2.5.1 More escaping
+-------------------
+
+Characters significant both to the shell and in regular expressions may
+need one extra level of escaping.  These include parentheses, the pipe
+symbol and the dollar sign.  Eg, to match the dollar symbol, bash users
+should do:
+
+   'hledger balance cur:'\$''
+
+   or:
+
+   'hledger balance cur:\\$'
+
+
+File: hledger.info,  Node: Even more escaping,  Next: Less escaping,  Prev: More escaping,  Up: Special characters in arguments and queries
+
+2.5.2 Even more escaping
+------------------------
+
+When hledger runs an addon executable (eg you type 'hledger ui', hledger
+runs 'hledger-ui'), it de-escapes command-line options and arguments
+once, so you might need to _triple_-escape.  Eg in bash, running the ui
+command and matching the dollar sign, it's:
+
+   'hledger ui cur:'\\$''
+
+   or:
+
+   'hledger ui cur:\\\\$'
+
+   If you asked why _four_ slashes above, this may help:
+
+unescaped:        '$'
+escaped:          '\$'
+double-escaped:   '\\$'
+triple-escaped:   '\\\\$'
+
+   (The number of backslashes in fish shell is left as an exercise for
+the reader.)
+
+   You can always avoid the extra escaping for addons by running the
+addon directly:
+
+   'hledger-ui cur:\\$'
+
+
+File: hledger.info,  Node: Less escaping,  Prev: Even more escaping,  Up: Special characters in arguments and queries
+
+2.5.3 Less escaping
+-------------------
+
+Inside an argument file, or in the search field of hledger-ui or
+hledger-web, or at a GHCI prompt, you need one less level of escaping
+than at the command line.  And backslashes may work better than quotes.
+Eg:
+
+   'ghci> :main balance cur:\$'
+
+
+File: hledger.info,  Node: Unicode characters,  Next: Input files,  Prev: Special characters in arguments and queries,  Up: OPTIONS
+
+2.6 Unicode characters
+======================
+
+hledger is expected to handle non-ascii characters correctly:
+
+   * they should be parsed correctly in input files and on the command
+     line, by all hledger tools (add, iadd, hledger-web's
+     search/add/edit forms, etc.)
+
+   * they should be displayed correctly by all hledger tools, and
+     on-screen alignment should be preserved.
+
+   This requires a well-configured environment.  Here are some tips:
+
+   * A system locale must be configured, and it must be one that can
+     decode the characters being used.  In bash, you can set a locale
+     like this: 'export LANG=en_US.UTF-8'.  There are some more details
+     in Troubleshooting.  This step is essential - without it, hledger
+     will quit on encountering a non-ascii character (as with all
+     GHC-compiled programs).
+
+   * your terminal software (eg Terminal.app, iTerm, CMD.exe, xterm..)
+     must support unicode
+
+   * the terminal must be using a font which includes the required
+     unicode glyphs
+
+   * the terminal should be configured to display wide characters as
+     double width (for report alignment)
+
+   * on Windows, for best results you should run hledger in the same
+     kind of environment in which it was built.  Eg hledger built in the
+     standard CMD.EXE environment (like the binaries on our download
+     page) might show display problems when run in a cygwin or msys
+     terminal, and vice versa.  (See eg #961).
+
+
+File: hledger.info,  Node: Input files,  Next: Output destination,  Prev: Unicode characters,  Up: OPTIONS
+
+2.7 Input files
+===============
+
+hledger reads transactions from a data file (and the add command writes
+to it).  By default this file is '$HOME/.hledger.journal' (or on
+Windows, something like 'C:/Users/USER/.hledger.journal').  You can
+override this with the '$LEDGER_FILE' environment variable:
+
+$ setenv LEDGER_FILE ~/finance/2016.journal
+$ hledger stats
+
+   or with the '-f/--file' option:
+
+$ hledger -f /some/file stats
+
+   The file name '-' (hyphen) means standard input:
+
+$ 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:
+
+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)
+
+   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 -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:
+
+   * 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'.
+
+
+File: hledger.info,  Node: Output destination,  Next: Output format,  Prev: Input files,  Up: OPTIONS
+
+2.8 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:
+
+$ hledger print > foo.txt
+
+   Some commands (print, register, stats, the balance commands) also
+provide the '-o/--output-file' option, which does the same thing without
+needing the shell.  Eg:
+
+$ hledger print -o foo.txt
+$ hledger print -o -        # write to stdout (the default)
+
+
+File: hledger.info,  Node: Output format,  Next: Regular expressions,  Prev: Output destination,  Up: OPTIONS
+
+2.9 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:
+
+$ hledger print -O csv
+
+   or, by a file extension specified with '-o/--output-file':
+
+$ hledger balancesheet -o foo.html   # write HTML to foo.html
+
+   The '-O' option can be used to override the file extension if needed:
+
+$ hledger balancesheet -o foo.txt -O html   # write HTML to foo.txt
+
+   Some notes about JSON output:
+
+   * This feature is marked experimental, and not yet much used; you
+     should expect our JSON to evolve.  Real-world feedback is welcome.
+
+   * Our JSON is rather large and verbose, as it is quite a faithful
+     representation of hledger's internal data types.  To understand the
+     JSON, read the Haskell type definitions, which are mostly in
+     https://github.com/simonmichael/hledger/blob/master/hledger-lib/Hledger/Data/Types.hs.
+
+   * The JSON output from hledger commands is essentially the same as
+     the JSON served by hledger-web's JSON API, but pretty printed,
+     using line breaks and indentation.  Our pretty printer has the
+     ability to elide data in certain cases - rendering non-strings as
+     if they were strings, or displaying "FOO.." instead of FOO's full
+     details.  This should never happen in hledger's JSON output; if you
+     see otherwise, please report as a bug.
+
+   * hledger represents quantities as Decimal values storing up to 255
+     significant digits, eg for repeating decimals.  Such numbers can
+     arise in practice (from automatically-calculated transaction
+     prices), and would break most JSON consumers.  So in JSON, we show
+     quantities as simple Numbers with at most 10 decimal places.  We
+     don't limit the number of integer digits, but that part is under
+     your control.  We hope this approach will not cause problems in
+     practice; if you find otherwise, please let us know.  (Cf #1195)
+
+
+File: hledger.info,  Node: Regular expressions,  Next: Smart dates,  Prev: Output format,  Up: OPTIONS
+
+2.10 Regular expressions
+========================
+
+hledger uses regular expressions in a number of places:
+
+   * query terms, on the command line and in the hledger-web search
+     form: 'REGEX', 'desc:REGEX', 'cur:REGEX', 'tag:...=REGEX'
+   * CSV rules conditional blocks: 'if REGEX ...'
+   * account alias directives and options: 'alias /REGEX/ =
+     REPLACEMENT', '--alias /REGEX/=REPLACEMENT'
+
+   hledger's regular expressions come from the regex-tdfa library.  In
+general they:
+
+   * are case insensitive
+   * are infix matching (do not need to match the entire thing being
+     matched)
+   * are POSIX extended regular expressions
+   * also support GNU word boundaries (\<, \>, \b, \B)
+   * and parenthesised capturing groups and numeric backreferences in
+     replacement strings
+   * do not support mode modifiers like (?s)
+
+   Some things to note:
+
+   * In the 'alias' directive and '--alias' option, regular expressions
+     must be enclosed in forward slashes ('/REGEX/').  Elsewhere in
+     hledger, these are not required.
+
+   * 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:\$'.
+
+   * On the command line, some metacharacters like '$' have a special
+     meaning to the shell and so must be escaped at least once more.
+     See Special characters.
+
+
+File: hledger.info,  Node: Smart dates,  Next: Report start & end date,  Prev: Regular expressions,  Up: OPTIONS
+
+2.11 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
+omitted (defaulting to 1).
+
+   Examples:
+
+'2004/10/1',              exact date, several separators allowed.  Year
+'2004-01-01',             is 4+ digits, month is 1-12, day is 1-31
+'2004.9.1'
+'2004'                    start of year
+'2004/10'                 start of month
+'10/1'                    month and day in current year
+'21'                      day in current month
+'october, oct'            start of month in current year
+'yesterday, today,        -1, 0, 1 days from today
+tomorrow'
+'last/this/next           -1, 0, 1 periods from the current period
+day/week/month/quarter/year'
+'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
+results:
+
+'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
+             8-digit year
+'20181232'   8 digits with an invalid day gives an error
+'201801012'  9+ digits beginning with a valid YYYYMMDD gives an error
+
+
+File: hledger.info,  Node: Report start & end date,  Next: Report intervals,  Prev: Smart dates,  Up: OPTIONS
+
+2.12 Report start & end date
+============================
+
+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
+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',
+'-e/--end', '-p/--period' or a 'date:' query (described below).  All of
+these accept the smart date syntax.
+
+   Some notes:
+
+   * As in Ledger, end dates are exclusive, so you need to write the
+     date _after_ the last day you want to include.
+   * As noted in reporting options: among start/end dates specified with
+     _options_, the last (i.e.  right-most) option takes precedence.
+   * 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          begin on St. Patrick's day 2016
+2016/3/17'
+'-e 12/1'    end at the start of december 1st of the current year
+             (11/30 will be the last date included)
+'-b          all transactions on or after the 1st of the current month
+thismonth'
+'-p          all transactions in the current month
+thismonth'
+'date:2016/3/17-'the above written as queries instead
+'date:-12/1'
+'date:thismonth-'
+'date:thismonth'
+
+
+File: hledger.info,  Node: Report intervals,  Next: Period expressions,  Prev: Report start & end date,  Up: OPTIONS
+
+2.13 Report intervals
+=====================
+
+A report interval can be specified so that commands like register,
+balance 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
+complex intervals may be specified with a period expression.  Report
+intervals can not be specified with a query.
+
+
+File: hledger.info,  Node: Period expressions,  Next: Depth limiting,  Prev: Report intervals,  Up: OPTIONS
+
+2.14 Period expressions
+=======================
+
+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 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
+"-".  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
+also be written as:
+
+'-p "1/1 4/1"'
+'-p "january-apr"'
+'-p "this year to 4/1"'
+
+   If you specify only one date, the missing start or end date will be
+the earliest or latest transaction in your journal:
+
+'-p "from 2009/1/1"'   everything after january 1, 2009
+'-p "from 2009/1"'     the same
+'-p "from 2009"'       the same
+'-p "to 2009"'         everything before january 1, 2009
+
+   A single date with no "from" or "to" defines both the start and end
+date like so:
+
+'-p "2009"'       the year 2009; equivalent to “2009/1/1 to 2010/1/1”
+'-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”
+
+   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
+'-D','-W','-M','-Q', or '-Y' flags.  Between report interval and
+start/end dates (if any), the word 'in' is optional.  Examples:
+
+'-p "weekly from 2009/1/1 to 2009/4/1"'
+'-p "monthly in 2008"'
+'-p "quarterly"'
+
+   Note that 'weekly', 'monthly', 'quarterly' and 'yearly' intervals
+will always start on the first day on week, month, quarter or year
+accordingly, and will end on the last day of same period, even if
+associated period expression specifies different explicit start and end
+date.
+
+   For example:
+
+'-p "weekly from           starts on 2008/12/29, closest preceding
+2009/1/1 to 2009/4/1"'     Monday
+'-p "monthly in            starts on 2018/11/01
+2008/11/25"'
+'-p "quarterly from        starts on 2009/04/01, ends on 2009/06/30,
+2009-05-05 to              which are first and last days of Q2 2009
+2009-06-01"'
+'-p "yearly from           starts on 2009/01/01, first day of 2009
+2009-12-29"'
+
+   The following more complex report intervals are also supported:
+'biweekly', '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
+end on the last one, as described above.
+
+   Examples:
+
+'-p "bimonthly from        periods will have boundaries on 2008/01/01,
+2008"'                     2008/03/01, ...
+'-p "every 2 weeks"'       starts on closest preceding Monday
+'-p "every 5 month from    periods will have boundaries on 2009/03/01,
+2009/03"'                  2009/08/01, ...
+
+   If you want intervals that start on arbitrary day of your choosing
+and span a week, month or year, you need to use any of the following:
+
+   'every Nth day of week', 'every <weekday>', 'every Nth day [of
+month]', 'every Nth weekday [of month]', 'every MM/DD [of year]', 'every
+Nth MMM [of year]', 'every MMM Nth [of year]'.
+
+   Examples:
+
+'-p "every 2nd day of    periods will go from Tue to Tue
+week"'
+'-p "every Tue"'         same
+'-p "every 15th day"'    period boundaries will be on 15th of each
+                         month
+'-p "every 2nd           period boundaries will be on second Monday of
+Monday"'                 each month
+'-p "every 11/05"'       yearly periods with boundaries on 5th of Nov
+'-p "every 5th Nov"'     same
+'-p "every Nov 5th"'     same
+
+   Show historical balances at end of 15th each month (N is exclusive
+end date):
+
+   'hledger balance -H -p "every 16th day"'
+
+   Group postings from start of wednesday to end of next tuesday (N is
+start date and exclusive end date):
+
+   'hledger register checking -p "every 3rd day of week"'
+
+
+File: hledger.info,  Node: Depth limiting,  Next: Pivoting,  Prev: Period expressions,  Up: OPTIONS
+
+2.15 Depth limiting
+===================
+
+With the '--depth N' option (short form: '-N'), commands like account,
+balance and register will show only the uppermost accounts in the
+account tree, down to level N. Use this when you want a summary with
+less detail.  This flag has the same effect as a 'depth:' query argument
+(so '-2', '--depth=2' or 'depth:2' are basically equivalent).
+
+
+File: hledger.info,  Node: Pivoting,  Next: Valuation,  Prev: Depth limiting,  Up: OPTIONS
+
+2.16 Pivoting
+=============
+
+Normally hledger sums amounts, and organizes them in a hierarchy, based
+on account name.  The '--pivot FIELD' option causes it to sum and
+organize hierarchy based on the value of some other field instead.
+FIELD can be: 'code', 'description', 'payee', 'note', or the full name
+(case insensitive) of any tag.  As with account names, values containing
+'colon:separated:parts' will be displayed hierarchically in reports.
+
+   '--pivot' is a general option affecting all reports; you can think of
+hledger transforming the journal before any other processing, replacing
+every posting's account name with the value of the specified field on
+that posting, inheriting it from the transaction or using a blank value
+if it's not present.
+
+   An example:
+
+2016/02/16 Member Fee Payment
+    assets:bank account                    2 EUR
+    income:member fees                    -2 EUR  ; member: John Doe
+
+   Normal balance report showing account names:
+
+$ hledger balance
+               2 EUR  assets:bank account
+              -2 EUR  income:member fees
+--------------------
+                   0
+
+   Pivoted balance report, using member: tag values instead:
+
+$ hledger balance --pivot member
+               2 EUR
+              -2 EUR  John Doe
+--------------------
+                   0
+
+   One way to show only amounts with a member: value (using a query,
+described below):
+
+$ hledger balance --pivot member tag:member=.
+              -2 EUR  John Doe
+--------------------
+              -2 EUR
+
+   Another way (the acct: query matches against the pivoted "account
+name"):
+
+$ hledger balance --pivot member acct:.
+              -2 EUR  John Doe
+--------------------
+              -2 EUR
+
+
+File: hledger.info,  Node: Valuation,  Prev: Pivoting,  Up: OPTIONS
+
+2.17 Valuation
+==============
+
+* Menu:
+
+* -B Cost::
+* -V Market value::
+* -X Market value in specified commodity::
+* --value Flexible valuation::
+* Effect of --value on reports::
+* Combining -B -V -X --value::
+
+
+File: hledger.info,  Node: -B Cost,  Next: -V Market value,  Up: Valuation
+
+2.17.1 -B: Cost
+---------------
+
+The '-B/--cost' flag converts amounts to their cost (or selling price)
+at transaction time, if they have a transaction price specified.  This
+flag is equivalent to '--value=cost', described below.
+
+
+File: hledger.info,  Node: -V Market value,  Next: -X Market value in specified commodity,  Prev: -B Cost,  Up: Valuation
+
+2.17.2 -V: Market value
+-----------------------
+
+The '-V/--market' flag converts reported amounts to their market value
+in a default valuation commodity, using the market prices in effect on a
+default valuation date.  For single period reports, the valuation date
+is today (equivalent to '--value=now'); for multiperiod reports, it is
+the last day of each subperiod (equivalent to '--value=end').
+
+   The default valuation commodity is the one referenced in the latest
+applicable market price dated on or before the valuation date.  If most
+of your P declarations lead to a single home currency, this will usually
+be what you want.  (To specify the commodity, see -X below.)
+
+   Note that in hledger, market prices are always declared explicitly
+with P directives; we do not infer them from transaction prices as
+Ledger does.
+
+   Here's a quick example of -V:
+
+; one euro is worth this many dollars from nov 1
+P 2016/11/01 € $1.10
+
+; purchase some euros on nov 3
+2016/11/3
+    assets:euros        €100
+    assets:checking
+
+; the euro is worth fewer dollars by dec 21
+P 2016/12/21 € $1.03
+
+   How many euros do I have ?
+
+$ hledger -f t.j bal -N euros
+                €100  assets:euros
+
+   What are they worth at end of nov 3 ?
+
+$ hledger -f t.j bal -N euros -V -e 2016/11/4
+             $110.00  assets:euros
+
+   What are they worth after 2016/12/21 ?  (no report end date
+specified, defaults to today)
+
+$ hledger -f t.j bal -N euros -V
+             $103.00  assets:euros
+
+
+File: hledger.info,  Node: -X Market value in specified commodity,  Next: --value Flexible valuation,  Prev: -V Market value,  Up: Valuation
+
+2.17.3 -X: Market value in specified commodity
+----------------------------------------------
+
+The '-X/--exchange' option is like '-V', except it specifies the target
+commodity you would like to convert to.  It is equivalent to
+'--value=now,COMM' or '--value=end,COMM'.
+
+
+File: hledger.info,  Node: --value Flexible valuation,  Next: Effect of --value on reports,  Prev: -X Market value in specified commodity,  Up: Valuation
+
+2.17.4 -value: Flexible valuation
+---------------------------------
+
+_(experimental, added 201905)_
+
+   '-B', '-V' and '-X' are special cases of the more general '--value'
+option:
+
+ --value=TYPE[,COMM]  TYPE is cost, then, end, now or YYYY-MM-DD.
+                      COMM is an optional commodity symbol.
+                      Shows amounts converted to:
+                      - cost commodity using transaction prices (then optionally to COMM using market prices at period end(s))
+                      - default valuation commodity (or COMM) using market prices at posting dates
+                      - default valuation commodity (or COMM) using market prices at period end(s)
+                      - default valuation commodity (or COMM) using current market prices
+                      - default valuation commodity (or COMM) using market prices at some date
+
+   The TYPE part basically selects either "cost", or "market value" plus
+a valuation date:
+
+'--value=cost'
+
+     Convert amounts to cost, using the prices recorded in transactions.
+'--value=then'
+
+     Convert amounts to their value in a default valuation commodity,
+     using market prices on each posting's date.  This is currently
+     supported only by the print and register commands.
+'--value=end'
+
+     Convert amounts to their value in a default valuation commodity,
+     using market prices on the last day of the report period (or if
+     unspecified, the journal's end date); or in multiperiod reports,
+     market prices on the last day of each subperiod.
+'--value=now'
+
+     Convert amounts to their value in default valuation commodity using
+     current market prices (as of when report is generated).
+'--value=YYYY-MM-DD'
+
+     Convert amounts to their value in default valuation commodity using
+     market prices on this date.
+
+   The default valuation commodity is the commodity mentioned in the
+most recent applicable market price declaration.  When all your price
+declarations lead to a single home currency, this will usually do what
+you want.
+
+   To select a different valuation commodity, add the optional ',COMM'
+part: a comma, then the target commodity's symbol.  Eg:
+*'--value=now,EUR'*.  hledger will do its best to convert amounts to
+this commodity, using:
+
+   * declared prices (from source commodity to valuation commodity)
+   * reverse prices (declared prices from valuation to source commodity,
+     inverted)
+   * indirect prices (prices calculated from the shortest chain of
+     declared or reverse prices from source to valuation commodity)
+
+   in that order.
+
+   Here are some examples showing the effect of '--value' as seen with
+'print':
+
+P 2000-01-01 A  1 B
+P 2000-02-01 A  2 B
+P 2000-03-01 A  3 B
+P 2000-04-01 A  4 B
+
+2000-01-01
+  (a)      1 A @ 5 B
+
+2000-02-01
+  (a)      1 A @ 6 B
+
+2000-03-01
+  (a)      1 A @ 7 B
+
+   Show the cost of each posting:
+
+$ hledger -f- print --value=cost
+2000-01-01
+    (a)             5 B
+
+2000-02-01
+    (a)             6 B
+
+2000-03-01
+    (a)             7 B
+
+   Show the value as of the last day of the report period (2000-02-29):
+
+$ hledger -f- print --value=end date:2000/01-2000/03
+2000-01-01
+    (a)             2 B
+
+2000-02-01
+    (a)             2 B
+
+   With no report period specified, that shows the value as of the last
+day of the journal (2000-03-01):
+
+$ hledger -f- print --value=end
+2000-01-01
+    (a)             3 B
+
+2000-02-01
+    (a)             3 B
+
+2000-03-01
+    (a)             3 B
+
+   Show the current value (the 2000-04-01 price is still in effect
+today):
+
+$ hledger -f- print --value=now
+2000-01-01
+    (a)             4 B
+
+2000-02-01
+    (a)             4 B
+
+2000-03-01
+    (a)             4 B
+
+   Show the value on 2000/01/15:
+
+$ hledger -f- print --value=2000-01-15
+2000-01-01
+    (a)             1 B
+
+2000-02-01
+    (a)             1 B
+
+2000-03-01
+    (a)             1 B
+
+   You may need to explicitly set a commodity's display style, when
+reverse prices are used.  Eg this output might be surprising:
+
+P 2000-01-01 A 2B
+
+2000-01-01
+  a  1B
+  b
+
+$ hledger print -x -X A
+2000-01-01
+    a               0
+    b               0
+
+   Explanation: because there's no amount or commodity directive
+specifying a display style for A, 0.5A gets the default style, which
+shows no decimal digits.  Because the displayed amount looks like zero,
+the commodity symbol and minus sign are not displayed either.  Adding a
+commodity directive sets a more useful display style for A:
+
+P 2000-01-01 A 2B
+commodity 0.00A
+
+2000-01-01
+  a  1B
+  b
+
+$ hledger print -X A
+2000-01-01
+    a           0.50A
+    b          -0.50A
+
+
+File: hledger.info,  Node: Effect of --value on reports,  Next: Combining -B -V -X --value,  Prev: --value Flexible valuation,  Up: Valuation
+
+2.17.5 Effect of -value on reports
+----------------------------------
+
+Here is a reference for how '--value' currently affects each part of
+hledger's reports.  It's work in progress, but may be useful for
+troubleshooting or reporting bugs.  See also the definitions and notes
+below.  If you find problems, please report them, ideally with a
+reproducible example.  Related: #329, #1083.
+
+Report       '-B',        '-V', '-X'   '--value=then' '--value=end' '--value=DATE',
+type         '--value=cost'                                         '--value=now'
+-------------------------------------------------------------------------------
+*print*
+posting      cost         value at     value at       value at      value at
+amounts                   report end   posting date   report or     DATE/today
+                          or today                    journal end
+balance      unchanged    unchanged    unchanged      unchanged     unchanged
+assertions
+/
+assignments
+*register*
+starting     cost         value at     not            value at      value at
+balance                   day before   supported      day before    DATE/today
+(with -H)                 report or                   report or
+                          journal                     journal
+                          start                       start
+posting      cost         value at     value at       value at      value at
+amounts                   report end   posting date   report or     DATE/today
+(no report                or today                    journal end
+interval)
+summary      summarised   value at     sum of         value at      value at
+posting      cost         period       postings in    period ends   DATE/today
+amounts                   ends         interval,
+(with                                  valued at
+report                                 interval
+interval)                              start
+running      sum/average  sum/average  sum/average    sum/average   sum/average
+total/averageof           of           of displayed   of            of
+             displayed    displayed    values         displayed     displayed
+             values       values                      values        values
+*balance
+(bs, bse,
+cf, is..)*
+balances     sums of      value at     not            value at      value at
+(no report   costs        report end   supported      report or     DATE/today
+interval)                 or today                    journal end   of sums
+                          of sums of                  of sums of    of
+                          postings                    postings      postings
+balances     sums of      value at     not            value at      value at
+(with        costs        period       supported      period ends   DATE/today
+report                    ends of                     of sums of    of sums
+interval)                 sums of                     postings      of
+                          postings                                  postings
+starting     sums of      sums of      not            sums of       sums of
+balances     costs of     postings     supported      postings      postings
+(with        postings     before                      before        before
+report       before       report                      report        report
+interval     report       start                       start         start
+and -H)      start
+budget       like         like         not            like          like
+amounts      balances     balances     supported      balances      balances
+with
+-budget
+grand        sum of       sum of       not            sum of        sum of
+total (no    displayed    displayed    supported      displayed     displayed
+report       values       values                      values        values
+interval)
+row          sums/averagessums/averagesnot            sums/averages sums/averages
+totals/averagesof         of           supported      of            of
+(with        displayed    displayed                   displayed     displayed
+report       values       values                      values        values
+interval)
+column       sums of      sums of      not            sums of       sums of
+totals       displayed    displayed    supported      displayed     displayed
+             values       values                      values        values
+grand        sum/average  sum/average  not            sum/average   sum/average
+total/averageof column    of column    supported      of column     of
+             totals       totals                      totals        column
+                                                                    totals
+
+   *Additional notes*
+
+_cost_
+
+     calculated using price(s) recorded in the transaction(s).
+_value_
+
+     market value using available market price declarations, or the
+     unchanged amount if no conversion rate can be found.
+_report start_
+
+     the first day of the report period specified with -b or -p or
+     date:, otherwise today.
+_report or journal start_
+
+     the first day of the report period specified with -b or -p or
+     date:, otherwise the earliest transaction date in the journal,
+     otherwise today.
+_report end_
+
+     the last day of the report period specified with -e or -p or date:,
+     otherwise today.
+_report or journal end_
+
+     the last day of the report period specified with -e or -p or date:,
+     otherwise the latest transaction date in the journal, otherwise
+     today.
+_report interval_
+
+     a flag (-D/-W/-M/-Q/-Y) or period expression that activates the
+     report's multi-period mode (whether showing one or many
+     subperiods).
+
+
+File: hledger.info,  Node: Combining -B -V -X --value,  Prev: Effect of --value on reports,  Up: Valuation
+
+2.17.6 Combining -B, -V, -X, -value
+-----------------------------------
+
+The rightmost of these flags wins.
+
+
+File: hledger.info,  Node: COMMANDS,  Next: ENVIRONMENT,  Prev: OPTIONS,  Up: Top
+
+3 COMMANDS
+**********
+
+hledger provides a number of subcommands; 'hledger' with no arguments
+shows a list.
+
+   If you install additional 'hledger-*' packages, or if you put
+programs or scripts named 'hledger-NAME' in your PATH, these will also
+be listed as subcommands.
+
+   Run a subcommand by writing its name as first argument (eg 'hledger
+incomestatement').  You can also write one of the standard short aliases
+displayed in parentheses in the command list ('hledger b'), or any any
+unambiguous prefix of a command name ('hledger inc').
+
+   Here are all the builtin commands in alphabetical order.  See also
+'hledger' for a more organised command list, and 'hledger CMD -h' for
+detailed command help.
+
+* Menu:
+
+* accounts::
+* activity::
+* add::
+* balance::
+* balancesheet::
+* balancesheetequity::
+* cashflow::
+* check-dates::
+* check-dupes::
+* close::
+* commodities::
+* descriptions::
+* diff::
+* files::
+* help::
+* import::
+* incomestatement::
+* notes::
+* payees::
+* prices::
+* print::
+* print-unique::
+* register::
+* register-match::
+* rewrite::
+* roi::
+* stats::
+* tags::
+* test::
+* Add-on Commands::
+
+
+File: hledger.info,  Node: accounts,  Next: activity,  Up: COMMANDS
+
+3.1 accounts
+============
+
+accounts, a
+Show account names.
+
+   This command lists account names, either declared with account
+directives (-declared), posted to (-used), or both (the default).  With
+query arguments, only matched account names and account names referenced
+by matched postings are shown.  It shows a flat list by default.  With
+'--tree', it uses indentation to show the account hierarchy.  In flat
+mode you can add '--drop N' to omit the first few account name
+components.  Account names can be depth-clipped with 'depth:N' or
+'--depth N' or '-N'.
+
+   Examples:
+
+$ hledger accounts
+assets:bank:checking
+assets:bank:saving
+assets:cash
+expenses:food
+expenses:supplies
+income:gifts
+income:salary
+liabilities:debts
+
+
+File: hledger.info,  Node: activity,  Next: add,  Prev: accounts,  Up: COMMANDS
+
+3.2 activity
+============
+
+activity
+Show an ascii barchart of posting counts per interval.
+
+   The activity command displays an ascii histogram showing transaction
+counts by day, week, month or other reporting interval (by day is the
+default).  With query arguments, it counts only matched transactions.
+
+   Examples:
+
+$ hledger activity --quarterly
+2008-01-01 **
+2008-04-01 *******
+2008-07-01 
+2008-10-01 **
+
+
+File: hledger.info,  Node: add,  Next: balance,  Prev: activity,  Up: COMMANDS
+
+3.3 add
+=======
+
+add
+Prompt for transactions and add them to the journal.
+
+   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
+transactions, 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.
+
+   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 control-d or control-c to exit.
+
+   Features:
+
+   * add tries to provide useful defaults, using the most similar (by
+     description) recent transaction (filtered by the query, if any) as
+     a template.
+   * You can also set the initial defaults with command line arguments.
+   * Readline-style edit keys can be used during data entry.
+   * The tab key will auto-complete whenever possible - accounts,
+     descriptions, dates ('yesterday', 'today', 'tomorrow').  If the
+     input area is empty, it will insert the default value.
+   * If the journal defines a default commodity, it will be added to any
+     bare numbers entered.
+   * A parenthesised transaction code may be entered following a date.
+   * Comments and tags may be entered following a description or amount.
+   * If you make a mistake, enter '<' at any prompt to go one step
+     backward.
+   * Input prompts are displayed in a different colour when the terminal
+     supports it.
+
+   Example (see the tutorial for a detailed explanation):
+
+$ hledger add
+Adding transactions to journal file /src/hledger/examples/sample.journal
+Any command line arguments will be used as defaults.
+Use tab key to complete, readline keys to edit, enter to accept defaults.
+An optional (CODE) may follow transaction dates.
+An optional ; COMMENT may follow descriptions or amounts.
+If you make a mistake, enter < at any prompt to go one step backward.
+To end a transaction, enter . when prompted.
+To quit, enter . at a date prompt or press control-d or control-c.
+Date [2015/05/22]: 
+Description: supermarket
+Account 1: expenses:food
+Amount  1: $10
+Account 2: assets:checking
+Amount  2 [$-10.0]: 
+Account 3 (or . or enter to finish this transaction): .
+2015/05/22 supermarket
+    expenses:food             $10
+    assets:checking        $-10.0
+
+Save this transaction to the journal ? [y]: 
+Saved.
+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 platform
+(cf #1056).
+
+
+File: hledger.info,  Node: balance,  Next: balancesheet,  Prev: add,  Up: COMMANDS
+
+3.4 balance
+===========
+
+balance, bal, b
+Show accounts and their balances.
+
+   The balance command is hledger's most versatile command.  Note,
+despite the name, it is not always used for showing real-world account
+balances; the more accounting-aware balancesheet and incomestatement may
+be more convenient for that.
+
+   By default, it displays all accounts, and each account's change in
+balance during the entire period of the journal.  Balance changes are
+calculated by adding up the postings in each account.  You can limit the
+postings matched, by a query, to see fewer accounts, changes over a
+different time period, changes from only cleared transactions, etc.
+
+   If you include an account's complete history of postings in the
+report, the balance change is equivalent to the account's current ending
+balance.  For a real-world account, typically you won't have all
+transactions in the journal; instead you'll have all transactions after
+a certain date, and an "opening balances" transaction setting the
+correct starting balance on that date.  Then the balance command will
+show real-world account balances.  In some cases the -H/-historical flag
+is used to ensure this (more below).
+
+   The balance command can produce several styles of report:
+
+* Menu:
+
+* Classic balance report::
+* Customising the classic balance report::
+* Colour support::
+* Flat mode::
+* Depth limited balance reports::
+* Percentages::
+* Multicolumn balance report::
+* Budget report::
+* Output format::
+
+
+File: hledger.info,  Node: Classic balance report,  Next: Customising the classic balance report,  Up: balance
+
+3.4.1 Classic balance report
+----------------------------
+
+This is the original balance report, as found in Ledger.  It usually
+looks like this:
+
+$ hledger balance
+                 $-1  assets
+                  $1    bank:saving
+                 $-2    cash
+                  $2  expenses
+                  $1    food
+                  $1    supplies
+                 $-2  income
+                 $-1    gifts
+                 $-1    salary
+                  $1  liabilities:debts
+--------------------
+                   0
+
+   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.
+
+   "Boring" accounts, which contain a single interesting subaccount and
+no balance of their own, are elided into the following line for more
+compact output.  (Eg above, the "liabilities" account.)  Use
+'--no-elide' to prevent this.
+
+   Account balances are "inclusive" - they include the balances of any
+subaccounts.
+
+   Accounts which have zero balance (and no non-zero subaccounts) are
+omitted.  Use '-E/--empty' to show them.
+
+   A final total is displayed by default; use '-N/--no-total' to
+suppress it, eg:
+
+$ hledger balance -p 2008/6 expenses --no-total
+                  $2  expenses
+                  $1    food
+                  $1    supplies
+
+
+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
+--------------------------------------------
+
+You can customise the layout of classic balance reports with '--format
+FMT':
+
+$ hledger balance --format "%20(account) %12(total)"
+              assets          $-1
+         bank:saving           $1
+                cash          $-2
+            expenses           $2
+                food           $1
+            supplies           $1
+              income          $-2
+               gifts          $-1
+              salary          $-1
+   liabilities:debts           $1
+---------------------------------
+                                0
+
+   The FMT format string (plus a newline) specifies the formatting
+applied to each account/balance pair.  It may contain any suitable text,
+with data fields interpolated like so:
+
+   '%[MIN][.MAX](FIELDNAME)'
+
+   * MIN pads with spaces to at least this width (optional)
+
+   * MAX truncates at this width (optional)
+
+   * FIELDNAME must be enclosed in parentheses, and can be one of:
+
+        * 'depth_spacer' - a number of spaces equal to the account's
+          depth, or if MIN is specified, MIN * depth spaces.
+        * 'account' - the account's name
+        * 'total' - the account's balance/posted total, right justified
+
+   Also, FMT can begin with an optional prefix to control how
+multi-commodity amounts are rendered:
+
+   * '%_' - render on multiple lines, bottom-aligned (the default)
+   * '%^' - render on multiple lines, top-aligned
+   * '%,' - render on one line, comma-separated
+
+   There are some quirks.  Eg in one-line mode, '%(depth_spacer)' has no
+effect, instead '%(account)' has indentation built in.  Experimentation
+may be needed to get pleasing results.
+
+   Some example formats:
+
+   * '%(total)' - the account's total
+   * '%-20.20(account)' - the account's name, left justified, padded to
+     20 characters and clipped at 20 characters
+   * '%,%-50(account) %25(total)' - account name padded to 50
+     characters, total padded to 20 characters, with multiple
+     commodities rendered on one line
+   * '%20(total) %2(depth_spacer)%-(account)' - the default format for
+     the single-column balance report
+
+
+File: hledger.info,  Node: Colour support,  Next: Flat mode,  Prev: Customising the classic balance report,  Up: balance
+
+3.4.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
+
+
+File: hledger.info,  Node: Flat mode,  Next: Depth limited balance reports,  Prev: Colour support,  Up: balance
+
+3.4.4 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
+this mode, you can also use '--drop N' to omit the first few account
+name components.
+
+$ hledger balance -p 2008/6 expenses -N --flat --drop 1
+                  $1  food
+                  $1  supplies
+
+
+File: hledger.info,  Node: Depth limited balance reports,  Next: Percentages,  Prev: Flat mode,  Up: balance
+
+3.4.5 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 a complex set of accounts and get an overview.
+
+$ hledger balance -N -1
+                 $-1  assets
+                  $2  expenses
+                 $-2  income
+                  $1  liabilities
+
+   Flat-mode balance reports, which normally show exclusive balances,
+show inclusive balances at the depth limit.
+
+
+File: hledger.info,  Node: Percentages,  Next: Multicolumn balance report,  Prev: Depth limited balance reports,  Up: balance
+
+3.4.6 Percentages
+-----------------
+
+With '-%' or '--percent', balance reports show each account's value
+expressed 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 -%
+             100.0 %  expenses
+              50.0 %    food
+              50.0 %    supplies
+--------------------
+             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
+relative 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 (eg
+'hledger balance -B') all percentage values will be zero.
+
+   This flag does not work if the report contains any mixed commodity
+accounts.  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.
+
+
+File: hledger.info,  Node: Multicolumn balance report,  Next: Budget report,  Prev: Percentages,  Up: balance
+
+3.4.7 Multicolumn balance report
+--------------------------------
+
+Multicolumn or tabular balance reports are a very useful hledger
+feature, and usually the preferred style.  They share many of the above
+features, but they show the report as a table, with columns representing
+time periods.  This mode is activated by providing a reporting interval.
+
+   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 for a monthly income statement:
+
+     $ hledger balance --quarterly income expenses -E
+     Balance changes in 2008:
+     
+                        ||  2008q1  2008q2  2008q3  2008q4 
+     ===================++=================================
+      expenses:food     ||       0      $1       0       0 
+      expenses:supplies ||       0      $1       0       0 
+      income:gifts      ||       0     $-1       0       0 
+      income:salary     ||     $-1       0       0       0 
+     -------------------++---------------------------------
+                        ||     $-1      $1       0       0 
+
+  2. With '--cumulative': each column shows the ending balance for that
+     period, accumulating the changes across periods, starting from 0 at
+     the report start date:
+
+     $ hledger balance --quarterly income expenses -E --cumulative
+     Ending balances (cumulative) in 2008:
+     
+                        ||  2008/03/31  2008/06/30  2008/09/30  2008/12/31 
+     ===================++=================================================
+      expenses:food     ||           0          $1          $1          $1 
+      expenses:supplies ||           0          $1          $1          $1 
+      income:gifts      ||           0         $-1         $-1         $-1 
+      income:salary     ||         $-1         $-1         $-1         $-1 
+     -------------------++-------------------------------------------------
+                        ||         $-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 useful eg for a multi-period balance sheet, and when you
+     are showing only the data after a certain start date:
+
+     $ hledger balance ^assets ^liabilities --quarterly --historical --begin 2008/4/1
+     Ending balances (historical) in 2008/04/01-2008/12/31:
+     
+                           ||  2008/06/30  2008/09/30  2008/12/31 
+     ======================++=====================================
+      assets:bank:checking ||          $1          $1           0 
+      assets:bank:saving   ||          $1          $1          $1 
+      assets:cash          ||         $-2         $-2         $-2 
+      liabilities:debts    ||           0           0          $1 
+     ----------------------++-------------------------------------
+                           ||           0           0           0 
+
+   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;
+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 the
+displayed report periods.  This is so that the first and last periods
+will be "full" and comparable to the others.
+
+   The '-E/--empty' flag does two things in multicolumn balance reports:
+first, the report will show all columns within the specified report
+period (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 row.
+
+   Here's an example of all three:
+
+$ hledger balance -Q income expenses --tree -ETA
+Balance changes in 2008:
+
+            ||  2008q1  2008q2  2008q3  2008q4    Total  Average 
+============++===================================================
+ expenses   ||       0      $2       0       0       $2       $1 
+   food     ||       0      $1       0       0       $1        0 
+   supplies ||       0      $1       0       0       $1        0 
+ income     ||     $-1     $-1       0       0      $-2      $-1 
+   gifts    ||       0     $-1       0       0      $-1        0 
+   salary   ||     $-1       0       0       0      $-1        0 
+------------++---------------------------------------------------
+            ||     $-1      $1       0       0        0        0 
+
+(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.
+
+
+File: hledger.info,  Node: Budget report,  Next: ,  Prev: Multicolumn balance report,  Up: balance
+
+3.4.8 Budget report
+-------------------
+
+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
+income, expenses, time usage, etc.  -budget is most often combined with
+a report interval.
+
+   For example, you can take average monthly expenses in the common
+expense categories to construct a minimal monthly budget:
+
+;; Budget
+~ monthly
+  income  $2000
+  expenses:food    $400
+  expenses:bus     $50
+  expenses:movies  $30
+  assets:bank:checking
+
+;; Two months worth of expenses
+2017-11-01
+  income  $1950
+  expenses:food    $396
+  expenses:bus     $49
+  expenses:movies  $30
+  expenses:supplies  $20
+  assets:bank:checking
+
+2017-12-01
+  income  $2100
+  expenses:food    $412
+  expenses:bus     $53
+  expenses:gifts   $100
+  assets:bank:checking
+
+   You can now see a monthly budget report:
+
+$ hledger balance -M --budget
+Budget performance in 2017/11/01-2017/12/31:
+
+                      ||                      Nov                       Dec 
+======================++====================================================
+ assets               || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
+ assets:bank          || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
+ assets:bank:checking || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
+ expenses             ||   $495 [ 103% of   $480]    $565 [ 118% of   $480] 
+ expenses:bus         ||    $49 [  98% of    $50]     $53 [ 106% of    $50] 
+ expenses:food        ||   $396 [  99% of   $400]    $412 [ 103% of   $400] 
+ expenses:movies      ||    $30 [ 100% of    $30]       0 [   0% of    $30] 
+ income               ||  $1950 [  98% of  $2000]   $2100 [ 105% of  $2000] 
+----------------------++----------------------------------------------------
+                      ||      0 [              0]       0 [              0] 
+
+   Note this is different from a normal balance report in several ways:
+
+   * Only accounts with budget goals during the report period are shown,
+     by default.
+
+   * In each column, in square brackets after the actual amount,
+     budgeted amounts are shown, along with the percentage of budget
+     used.
+
+   * All parent accounts are always shown, even in flat mode.  Eg
+     assets, assets:bank, and expenses above.
+
+   * 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
+transactions, 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
+ones, giving the full picture.  Eg:
+
+$ hledger balance -M --budget --empty
+Budget performance in 2017/11/01-2017/12/31:
+
+                      ||                      Nov                       Dec 
+======================++====================================================
+ assets               || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
+ assets:bank          || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
+ assets:bank:checking || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
+ expenses             ||   $495 [ 103% of   $480]    $565 [ 118% of   $480] 
+ expenses:bus         ||    $49 [  98% of    $50]     $53 [ 106% of    $50] 
+ expenses:food        ||   $396 [  99% of   $400]    $412 [ 103% of   $400] 
+ expenses:gifts       ||      0                      $100                   
+ expenses:movies      ||    $30 [ 100% of    $30]       0 [   0% of    $30] 
+ expenses:supplies    ||    $20                         0                   
+ income               ||  $1950 [  98% of  $2000]   $2100 [ 105% of  $2000] 
+----------------------++----------------------------------------------------
+                      ||      0 [              0]       0 [              0] 
+
+   You can roll over unspent budgets to next period with '--cumulative':
+
+$ hledger balance -M --budget --cumulative
+Budget performance in 2017/11/01-2017/12/31:
+
+                      ||                      Nov                       Dec 
+======================++====================================================
+ assets               || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960] 
+ assets:bank          || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960] 
+ assets:bank:checking || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960] 
+ expenses             ||   $495 [ 103% of   $480]   $1060 [ 110% of   $960] 
+ expenses:bus         ||    $49 [  98% of    $50]    $102 [ 102% of   $100] 
+ expenses:food        ||   $396 [  99% of   $400]    $808 [ 101% of   $800] 
+ expenses:movies      ||    $30 [ 100% of    $30]     $30 [  50% of    $60] 
+ income               ||  $1950 [  98% of  $2000]   $4050 [ 101% of  $4000] 
+----------------------++----------------------------------------------------
+                      ||      0 [              0]       0 [              0] 
+
+   For more examples, see Budgeting and Forecasting.
+
+* Menu:
+
+* Nested budgets::
+
+
+File: hledger.info,  Node: Nested budgets,  Up: Budget report
+
+3.4.8.1 Nested budgets
+......................
+
+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
+budget(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
+account, all its parents would have budget as well.
+
+   To illustrate this, consider the following budget:
+
+~ monthly from 2019/01
+    expenses:personal             $1,000.00
+    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
+means that budget for both 'expenses:personal' and 'expenses' is $1100.
+
+   Transactions in 'expenses:personal:electronics' will be counted both
+towards its $100 budget and $1100 of 'expenses:personal' , and
+transactions 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:
+
+~ monthly from 2019/01
+    expenses:personal             $1,000.00
+    expenses:personal:electronics    $100.00
+    liabilities
+
+2019/01/01 Google home hub
+    expenses:personal:electronics          $90.00
+    liabilities                           $-90.00
+
+2019/01/02 Phone screen protector
+    expenses:personal:electronics:upgrades          $10.00
+    liabilities
+
+2019/01/02 Weekly train ticket
+    expenses:personal:train tickets       $153.00
+    liabilities
+
+2019/01/03 Flowers
+    expenses:personal          $30.00
+    liabilities
+
+   As you can see, we have transactions in
+'expenses:personal:electronics:upgrades' and 'expenses:personal:train
+tickets', and since both of these accounts are without explicitly
+defined budget, these transactions would be counted towards budgets of
+'expenses:personal:electronics' and 'expenses:personal' accordingly:
+
+$ hledger balance --budget -M
+Budget performance in 2019/01:
+
+                               ||                           Jan 
+===============================++===============================
+ expenses                      ||  $283.00 [  26% of  $1100.00] 
+ expenses:personal             ||  $283.00 [  26% of  $1100.00] 
+ expenses:personal:electronics ||  $100.00 [ 100% of   $100.00] 
+ liabilities                   || $-283.00 [  26% of $-1100.00] 
+-------------------------------++-------------------------------
+                               ||        0 [                 0] 
+
+   And with '--empty', we can get a better picture of budget allocation
+and consumption:
+
+$ hledger balance --budget -M --empty
+Budget performance in 2019/01:
+
+                                        ||                           Jan 
+========================================++===============================
+ expenses                               ||  $283.00 [  26% of  $1100.00] 
+ expenses:personal                      ||  $283.00 [  26% of  $1100.00] 
+ expenses:personal:electronics          ||  $100.00 [ 100% of   $100.00] 
+ expenses:personal:electronics:upgrades ||   $10.00                      
+ expenses:personal:train tickets        ||  $153.00                      
+ liabilities                            || $-283.00 [  26% of $-1100.00] 
+----------------------------------------++-------------------------------
+                                        ||        0 [                 0] 
+
+3.4.9 Output format
+-------------------
+
+This command also supports the output destination and output format
+options The output formats supported are 'txt', 'csv', (multicolumn
+non-budget reports only) 'html', and (experimental) 'json'.
+
+
+File: hledger.info,  Node: balancesheet,  Next: balancesheetequity,  Prev: balance,  Up: COMMANDS
+
+3.5 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).
+
+   Note this report shows all account balances with normal positive sign
+(like conventional financial statements, unlike balance/print/register)
+(experimental).
+
+   Example:
+
+$ hledger balancesheet
+Balance Sheet
+
+Assets:
+                 $-1  assets
+                  $1    bank:saving
+                 $-2    cash
+--------------------
+                 $-1
+
+Liabilities:
+                  $1  liabilities:debts
+--------------------
+                  $1
+
+Total:
+--------------------
+                   0
+
+   With a reporting interval, multiple columns will be shown, one for
+each report period.  As with multicolumn balance reports, you can alter
+the report mode with '--change'/'--cumulative'/'--historical'.  Normally
+balancesheet shows historical ending balances, which is what you need
+for a balance sheet; note this means it ignores report begin dates (and
+'-T/--row-total', since summing end balances generally does not make
+sense).  Instead of absolute values percentages can be displayed with
+'-%'.
+
+   This command also supports the output destination and output format
+options The output formats supported are 'txt', 'csv', 'html', and
+(experimental) 'json'.
+
+
+File: hledger.info,  Node: balancesheetequity,  Next: cashflow,  Prev: balancesheet,  Up: COMMANDS
+
+3.6 balancesheetequity
+======================
+
+balancesheetequity, bse
+Just like balancesheet, but also reports Equity (which it assumes is
+under a top-level 'equity' account).
+
+   Example:
+
+$ hledger balancesheetequity
+Balance Sheet With Equity
+
+Assets:
+                 $-2  assets
+                  $1    bank:saving
+                 $-3    cash
+--------------------
+                 $-2
+
+Liabilities:
+                  $1  liabilities:debts
+--------------------
+                  $1
+
+Equity:
+          $1  equity:owner
+--------------------
+          $1
+
+Total:
+--------------------
+                   0
+
+   This command also supports the output destination and output format
+options The output formats supported are 'txt', 'csv', 'html', and
+(experimental) 'json'.
+
+
+File: hledger.info,  Node: cashflow,  Next: check-dates,  Prev: balancesheetequity,  Up: COMMANDS
+
+3.7 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).
+
+   Example:
+
+$ hledger cashflow
+Cashflow Statement
+
+Cash flows:
+                 $-1  assets
+                  $1    bank:saving
+                 $-2    cash
+--------------------
+                 $-1
+
+Total:
+--------------------
+                 $-1
+
+   With a reporting interval, multiple columns will be shown, one for
+each report period.  Normally cashflow shows changes in assets per
+period, though as with multicolumn balance reports you can alter the
+report mode with '--change'/'--cumulative'/'--historical'.  Instead of
+absolute values percentages can be displayed with '-%'.
+
+   This command also supports the output destination and output format
+options The output formats supported are 'txt', 'csv', 'html', and
+(experimental) 'json'.
+
+
+File: hledger.info,  Node: check-dates,  Next: check-dupes,  Prev: cashflow,  Up: COMMANDS
+
+3.8 check-dates
+===============
+
+check-dates
+Check that transactions are sorted by increasing date.  With -date2,
+checks secondary dates instead.  With -strict, dates must also be
+unique.  With a query, only matched transactions' dates are checked.
+Reads the default journal file, or another specified with -f.
+
+
+File: hledger.info,  Node: check-dupes,  Next: close,  Prev: check-dates,  Up: COMMANDS
+
+3.9 check-dupes
+===============
+
+check-dupes
+Reports account names having the same leaf but different prefixes.  In
+other words, two or more leaves that are categorized differently.  Reads
+the default journal file, or another specified as an argument.
+
+   An example: http://stefanorodighiero.net/software/hledger-dupes.html
+
+
+File: hledger.info,  Node: close,  Next: commodities,  Prev: check-dupes,  Up: COMMANDS
+
+3.10 close
+==========
+
+close, equity
+Prints a "closing balances" transaction and an "opening balances"
+transaction that bring account balances to and from zero, respectively.
+These can be added to your journal file(s), eg to bring asset/liability
+balances forward into a new journal file, or to close out
+revenues/expenses to retained earnings at the end of a period.
+
+   You can print just one of these transactions by using the '--close'
+or '--open' flag.  You can customise their descriptions with the
+'--close-desc' and '--open-desc' options.
+
+   One amountless posting to "equity:opening/closing balances" is added
+to balance the transactions, by default.  You can customise this account
+name with '--close-acct' and '--open-acct'; if you specify only one of
+these, it will be used for both.
+
+   With '--x/--explicit', the equity posting's amount will be shown.
+And if it involves multiple commodities, a posting for each commodity
+will be shown, as with the print command.
+
+   With '--interleaved', the equity postings are shown next to the
+postings they balance, which makes troubleshooting easier.
+
+   By default, transaction prices in the journal are ignored when
+generating the closing/opening transactions.  With '--show-costs', this
+cost information is preserved ('balance -B' reports will be unchanged
+after the transition).  Separate postings are generated for each cost in
+each commodity.  Note this can generate very large journal entries, if
+you have many foreign currency or investment transactions.
+
+* Menu:
+
+* close usage::
+
+
+File: hledger.info,  Node: close usage,  Up: close
+
+3.10.1 close usage
+------------------
+
+If you split your journal files by time (eg yearly), you will typically
+run this command at the end of the year, and save the closing
+transaction as last entry of the old file, and the opening transaction
+as the first entry of the new file.  This makes the files self
+contained, so that correct balances are reported no matter which of them
+are loaded.  Ie, if you load just one file, the balances are initialised
+correctly; or if you load several files, the redundant closing/opening
+transactions cancel each other out.  (They will show up in print or
+register reports; you can exclude them with a query like
+'not:desc:'(opening|closing) balances''.)
+
+   If you're running a business, you might also use this command to
+"close the books" at the end of an accounting period, transferring
+income statement account balances to retained earnings.  (You may want
+to change the equity account name to something like "equity:retained
+earnings".)
+
+   By default, the closing transaction is dated yesterday, the balances
+are calculated as of end of yesterday, and the opening transaction is
+dated today.  To close on some other date, use: 'hledger close -e
+OPENINGDATE'.  Eg, to close/open on the 2018/2019 boundary, use '-e
+2019'.  You can also use -p or 'date:PERIOD' (any starting date is
+ignored).
+
+   Both transactions will include balance assertions for the
+closed/reopened accounts.  You probably shouldn't use status or realness
+filters (like -C or -R or 'status:') with this command, or the generated
+balance assertions will depend on these flags.  Likewise, if you run
+this command with -auto, the balance assertions will probably always
+require -auto.
+
+   Examples:
+
+   Carrying asset/liability balances into a new file for 2019:
+
+$ hledger close -f 2018.journal -e 2019 assets liabilities --open
+    # (copy/paste the output to the start of your 2019 journal file)
+$ hledger close -f 2018.journal -e 2019 assets liabilities --close
+    # (copy/paste the output to the end of your 2018 journal file)
+
+   Now:
+
+$ hledger bs -f 2019.journal                   # one file - balances are correct
+$ hledger bs -f 2018.journal -f 2019.journal   # two files - balances still correct
+$ hledger bs -f 2018.journal not:desc:closing  # to see year-end balances, must exclude closing txn
+
+   Transactions spanning the closing date can complicate matters,
+breaking balance assertions:
+
+2018/12/30 a purchase made in 2018, clearing the following year
+    expenses:food          5
+    assets:bank:checking  -5  ; [2019/1/2]
+
+   Here's one way to resolve that:
+
+; in 2018.journal:
+2018/12/30 a purchase made in 2018, clearing the following year
+    expenses:food          5
+    liabilities:pending
+
+; in 2019.journal:
+2019/1/2 clearance of last year's pending transactions
+    liabilities:pending    5 = 0
+    assets:checking
+
+
+File: hledger.info,  Node: commodities,  Next: descriptions,  Prev: close,  Up: COMMANDS
+
+3.11 commodities
+================
+
+commodities
+List all commodity/currency symbols used or declared in the journal.
+
+
+File: hledger.info,  Node: descriptions,  Next: diff,  Prev: commodities,  Up: COMMANDS
+
+3.12 descriptions
+=================
+
+descriptions Show descriptions.
+
+   This command lists all descriptions that appear in transactions.
+
+   Examples:
+
+$ hledger descriptions
+Store Name
+Gas Station | Petrol
+Person A
+
+
+File: hledger.info,  Node: diff,  Next: files,  Prev: descriptions,  Up: COMMANDS
+
+3.13 diff
+=========
+
+diff
+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.)
+Since postings not transactions are compared, this also works when
+multiple 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 the account balance, you can compare the bank data with your
+journal to find out the cause.
+
+   Examples:
+
+$ hledger diff -f $LEDGER_FILE -f bank.csv assets:bank:giro 
+These transactions are in the first file only:
+
+2014/01/01 Opening Balances
+    assets:bank:giro              EUR ...
+    ...
+    equity:opening balances       EUR -...
+
+These transactions are in the second file only:
+
+
+File: hledger.info,  Node: files,  Next: help,  Prev: diff,  Up: COMMANDS
+
+3.14 files
+==========
+
+files
+List all files included in the journal.  With a REGEX argument, only
+file names matching the regular expression (case sensitive) are shown.
+
+
+File: hledger.info,  Node: help,  Next: import,  Prev: files,  Up: COMMANDS
+
+3.15 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 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 force a
+particular viewer with the '--info', '--man', '--pager', '--cat' flags.
+
+   Examples:
+
+$ hledger help
+Please choose a manual by typing "hledger help MANUAL" (a substring is ok).
+Manuals: hledger hledger-ui hledger-web journal csv timeclock timedot
+
+$ hledger help h --man
+
+hledger(1)                    hledger User Manuals                    hledger(1)
+
+NAME
+       hledger - a command-line accounting tool
+
+SYNOPSIS
+       hledger [-f FILE] COMMAND [OPTIONS] [ARGS]
+       hledger [-f FILE] ADDONCMD -- [OPTIONS] [ARGS]
+       hledger
+
+DESCRIPTION
+       hledger  is  a  cross-platform  program  for tracking money, time, or any
+...
+
+
+File: hledger.info,  Node: import,  Next: incomestatement,  Prev: help,  Up: COMMANDS
+
+3.16 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 transactions
+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 each one.  So eg to add new transactions from all CSV files to
+the main journal, it's just: 'hledger import *.csv'
+
+   New transactions are detected in the same way as print -new: by
+assuming 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
+see only uncategorised transactions:
+
+$ hledger import --dry ... | hledger -f- print unknown --ignore-assertions
+
+* Menu:
+
+* Importing balance assignments::
+
+
+File: hledger.info,  Node: Importing balance assignments,  Up: import
+
+3.16.1 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
+balance assignments (eg from an institution that provides only balances
+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,
+please test it and send a pull request.)
+
+
+File: hledger.info,  Node: incomestatement,  Next: notes,  Prev: import,  Up: COMMANDS
+
+3.17 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,
+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 simple income statement.  It currently
+assumes that you have top-level accounts named 'income' (or 'revenue')
+and 'expense' (plural forms also allowed.)
+
+$ hledger incomestatement
+Income Statement
+
+Revenues:
+                 $-2  income
+                 $-1    gifts
+                 $-1    salary
+--------------------
+                 $-2
+
+Expenses:
+                  $2  expenses
+                  $1    food
+                  $1    supplies
+--------------------
+                  $2
+
+Total:
+--------------------
+                   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
+absolute values percentages can be displayed with '-%'.
+
+   This command also supports the output destination and output format
+options The output formats supported are 'txt', 'csv', 'html', and
+(experimental) 'json'.
+
+
+File: hledger.info,  Node: notes,  Next: payees,  Prev: incomestatement,  Up: COMMANDS
+
+3.18 notes
+==========
+
+notes Show notes.
+
+   This command lists all notes that appear in transactions.
+
+   Examples:
+
+$ hledger notes
+Petrol
+Snacks
+
+
+File: hledger.info,  Node: payees,  Next: prices,  Prev: notes,  Up: COMMANDS
+
+3.19 payees
+===========
+
+payees Show payee names.
+
+   This command lists all payee names that appear in transactions.
+
+   Examples:
+
+$ hledger payees
+Store Name
+Gas Station
+Person A
+
+
+File: hledger.info,  Node: prices,  Next: print,  Prev: payees,  Up: COMMANDS
+
+3.20 prices
+===========
+
+prices
+Print market price directives from the journal.  With -costs, also print
+synthetic market prices based on transaction prices.  With
+-inverted-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.
+
+
+File: hledger.info,  Node: print,  Next: print-unique,  Prev: prices,  Up: COMMANDS
+
+3.21 print
+==========
+
+print, txns, p
+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,
+transactions 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
+directives or inter-transaction comments
+
+$ hledger print
+2008/01/01 income
+    assets:bank:checking            $1
+    income:salary                  $-1
+
+2008/06/01 gift
+    assets:bank:checking            $1
+    income:gifts                   $-1
+
+2008/06/02 save
+    assets:bank:saving              $1
+    assets:bank:checking           $-1
+
+2008/06/03 * eat & shop
+    expenses:food                $1
+    expenses:supplies            $1
+    assets:cash                 $-2
+
+2008/12/31 * pay off
+    liabilities:debts               $1
+    assets:bank:checking           $-1
+
+   Normally, the journal entry's explicit or implicit amount style is
+preserved.  For example, when an amount is omitted in the journal, it
+will not appear in the output.  Similarly, when a transaction price is
+implied but not written, it will not appear in the output.  You can use
+the '-x'/'--explicit' flag to make all amounts and transaction prices
+explicit, 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 the output parseable.
+
+   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
+transaction: 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
+special 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
+ignoring 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
+increasing dates, and that transactions on the same day do not get
+reordered.  See also the import command.
+
+   This command also supports the output destination and output format
+options The output formats supported are 'txt', 'csv', and
+(experimental) 'json'.
+
+   Here's an example of print's CSV output:
+
+$ hledger print -Ocsv
+"txnidx","date","date2","status","code","description","comment","account","amount","commodity","credit","debit","posting-status","posting-comment"
+"1","2008/01/01","","","","income","","assets:bank:checking","1","$","","1","",""
+"1","2008/01/01","","","","income","","income:salary","-1","$","1","","",""
+"2","2008/06/01","","","","gift","","assets:bank:checking","1","$","","1","",""
+"2","2008/06/01","","","","gift","","income:gifts","-1","$","1","","",""
+"3","2008/06/02","","","","save","","assets:bank:saving","1","$","","1","",""
+"3","2008/06/02","","","","save","","assets:bank:checking","-1","$","1","","",""
+"4","2008/06/03","","*","","eat & shop","","expenses:food","1","$","","1","",""
+"4","2008/06/03","","*","","eat & shop","","expenses:supplies","1","$","","1","",""
+"4","2008/06/03","","*","","eat & shop","","assets:cash","-2","$","2","","",""
+"5","2008/12/31","","*","","pay off","","liabilities:debts","1","$","","1","",""
+"5","2008/12/31","","*","","pay off","","assets:bank:checking","-1","$","1","","",""
+
+   * There is one CSV record per posting, with the parent transaction's
+     fields repeated.
+   * 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 order, etc.)
+   * The amount is separated into "commodity" (the symbol) and "amount"
+     (numeric quantity) fields.
+   * The numeric amount is repeated in either the "credit" or "debit"
+     column, for convenience.  (Those names are not accurate in the
+     accounting sense; it just puts negative amounts under credit and
+     zero or greater amounts under debit.)
+
+
+File: hledger.info,  Node: print-unique,  Next: register,  Prev: print,  Up: COMMANDS
+
+3.22 print-unique
+=================
+
+print-unique
+Print transactions which do not reuse an already-seen description.
+
+   Example:
+
+$ cat unique.journal
+1/1 test
+ (acct:one)  1
+2/2 test
+ (acct:two)  2
+$ LEDGER_FILE=unique.journal hledger print-unique
+(-f option not supported)
+2015/01/01 test
+    (acct:one)             1
+
+
+File: hledger.info,  Node: register,  Next: register-match,  Prev: print-unique,  Up: COMMANDS
+
+3.23 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:
+
+$ hledger register checking
+2008/01/01 income               assets:bank:checking            $1           $1
+2008/06/01 gift                 assets:bank:checking            $1           $2
+2008/06/02 save                 assets:bank:checking           $-1           $1
+2008/12/31 pay off              assets:bank:checking           $-1            0
+
+   With -date2, it shows and sorts by secondary date instead.
+
+   The '--historical'/'-H' flag adds the balance from any undisplayed
+prior postings to the running total.  This is useful when you want to
+see only recent activity, with a historically accurate running balance:
+
+$ hledger register checking -b 2008/6 --historical
+2008/06/01 gift                 assets:bank:checking            $1           $2
+2008/06/02 save                 assets:bank:checking           $-1           $1
+2008/12/31 pay off              assets:bank:checking           $-1            0
+
+   The '--depth' option limits the amount of sub-account detail
+displayed.
+
+   The '--average'/'-A' flag shows the running average posting amount
+instead of the running total (so, the final number displayed is the
+average for the whole report period).  This flag implies '--empty' (see
+below).  It is affected by '--historical'.  It works best when showing
+just one account and one commodity.
+
+   The '--related'/'-r' flag shows the _other_ postings in the
+transactions of the postings which would normally be shown.
+
+   The '--invert' flag negates all amounts.  For example, it can be used
+on an income account where amounts are normally displayed as negative
+numbers.  It's also useful to show postings on the checking account
+together with the related account:
+
+$ hledger register --related --invert assets:checking
+
+   With a reporting interval, register shows summary postings, one per
+interval, aggregating the postings to each account:
+
+$ hledger register --monthly income
+2008/01                 income:salary                          $-1          $-1
+2008/06                 income:gifts                           $-1          $-2
+
+   Periods with no activity, and summary postings with a zero amount,
+are not shown by default; use the '--empty'/'-E' flag to see them:
+
+$ hledger register --monthly income -E
+2008/01                 income:salary                          $-1          $-1
+2008/02                                                          0          $-1
+2008/03                                                          0          $-1
+2008/04                                                          0          $-1
+2008/05                                                          0          $-1
+2008/06                 income:gifts                           $-1          $-2
+2008/07                                                          0          $-2
+2008/08                                                          0          $-2
+2008/09                                                          0          $-2
+2008/10                                                          0          $-2
+2008/11                                                          0          $-2
+2008/12                                                          0          $-2
+
+   Often, you'll want to see just one line per interval.  The '--depth'
+option helps with this, causing subaccounts to be aggregated:
+
+$ hledger register --monthly assets --depth 1h
+2008/01                 assets                                  $1           $1
+2008/06                 assets                                 $-1            0
+2008/12                 assets                                 $-1          $-1
+
+   Note when using report intervals, if you specify start/end dates
+these will be adjusted outward if necessary to contain a whole number of
+intervals.  This ensures that the first and last intervals are full
+length and comparable to the others in the report.
+
+* Menu:
+
+* Custom register output::
+
+
+File: hledger.info,  Node: Custom register output,  Up: register
+
+3.23.1 Custom register output
+-----------------------------
+
+register uses the full terminal width by default, except on windows.
+You can override this by setting the 'COLUMNS' environment variable (not
+a bash shell variable) or by using the '--width'/'-w' option.
+
+   The description and account columns normally share the space equally
+(about half of (width - 40) each).  You can adjust this by adding a
+description width as part of -width's argument, comma-separated:
+'--width W,D' .  Here's a diagram (won't display correctly in -help):
+
+<--------------------------------- width (W) ---------------------------------->
+date (10)  description (D)       account (W-41-D)     amount (12)   balance (12)
+DDDDDDDDDD dddddddddddddddddddd  aaaaaaaaaaaaaaaaaaa  AAAAAAAAAAAA  AAAAAAAAAAAA
+
+   and some examples:
+
+$ hledger reg                     # use terminal width (or 80 on windows)
+$ hledger reg -w 100              # use width 100
+$ COLUMNS=100 hledger reg         # set with one-time environment variable
+$ export COLUMNS=100; hledger reg # set till session end (or window resize)
+$ hledger reg -w 100,40           # set overall width 100, description width 40
+$ hledger reg -w $COLUMNS,40      # use terminal width, & description width 40
+
+   This command also supports the output destination and output format
+options The output formats supported are 'txt', 'csv', and
+(experimental) 'json'.
+
+
+File: hledger.info,  Node: register-match,  Next: rewrite,  Prev: register,  Up: COMMANDS
+
+3.24 register-match
+===================
+
+register-match
+Print the one posting whose transaction description is closest to DESC,
+in the style of the register command.  If there are multiple equally
+good matches, it shows the most recent.  Query options (options, not
+arguments) can be used to restrict the search space.  Helps
+ledger-autosync detect already-seen transactions when importing.
+
+
+File: hledger.info,  Node: rewrite,  Next: roi,  Prev: register-match,  Up: COMMANDS
+
+3.25 rewrite
+============
+
+rewrite
+Print all transactions, rewriting the postings of matched transactions.
+For now the only rewrite available is adding new postings, like print
+-auto.
+
+   This is a start at a generic rewriter of transaction entries.  It
+reads the default journal and prints the transactions, like print, but
+adds one or more specified postings to any transactions matching QUERY.
+The posting amounts can be fixed, or a multiplier of the existing
+transaction's first posting amount.
+
+   Examples:
+
+$ hledger-rewrite.hs ^income --add-posting '(liabilities:tax)  *.33  ; income tax' --add-posting '(reserve:gifts)  $100'
+$ hledger-rewrite.hs expenses:gifts --add-posting '(reserve:gifts)  *-1"'
+$ hledger-rewrite.hs -f rewrites.hledger
+
+   rewrites.hledger may consist of entries like:
+
+= ^income amt:<0 date:2017
+  (liabilities:tax)  *0.33  ; tax on income
+  (reserve:grocery)  *0.25  ; reserve 25% for grocery
+  (reserve:)  *0.25  ; reserve 25% for grocery
+
+   Note the single quotes to protect the dollar sign from bash, and the
+two spaces between account and amount.
+
+   More:
+
+$ hledger rewrite -- [QUERY]        --add-posting "ACCT  AMTEXPR" ...
+$ hledger rewrite -- ^income        --add-posting '(liabilities:tax)  *.33'
+$ hledger rewrite -- expenses:gifts --add-posting '(budget:gifts)  *-1"'
+$ hledger rewrite -- ^income        --add-posting '(budget:foreign currency)  *0.25 JPY; diversify'
+
+   Argument for '--add-posting' option is a usual posting of transaction
+with an exception for amount specification.  More precisely, you can use
+''*'' (star symbol) before the amount to indicate that that this is a
+factor for an amount of original matched posting.  If the amount
+includes a commodity name, the new posting amount will be in the new
+commodity; otherwise, it will be in the matched posting amount's
+commodity.
+
+* Menu:
+
+* Re-write rules in a file::
+
+
+File: hledger.info,  Node: Re-write rules in a file,  Up: rewrite
+
+3.25.1 Re-write rules in a file
+-------------------------------
+
+During the run this tool will execute so called "Automated Transactions"
+found in any journal it process.  I.e instead of specifying this
+operations in command line you can put them in a journal file.
+
+$ rewrite-rules.journal
+
+   Make contents look like this:
+
+= ^income
+    (liabilities:tax)  *.33
+
+= expenses:gifts
+    budget:gifts  *-1
+    assets:budget  *1
+
+   Note that ''='' (equality symbol) that is used instead of date in
+transactions you usually write.  It indicates the query by which you
+want to match the posting to add new ones.
+
+$ hledger rewrite -- -f input.journal -f rewrite-rules.journal > rewritten-tidy-output.journal
+
+   This is something similar to the commands pipeline:
+
+$ hledger rewrite -- -f input.journal '^income' --add-posting '(liabilities:tax)  *.33' \
+  | hledger rewrite -- -f - expenses:gifts      --add-posting 'budget:gifts  *-1'       \
+                                                --add-posting 'assets:budget  *1'       \
+  > rewritten-tidy-output.journal
+
+   It is important to understand that relative order of such entries in
+journal is important.  You can re-use result of previously added
+postings.
+
+* Menu:
+
+* Diff output format::
+* rewrite vs print --auto::
+
+
+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
+...........................
+
+To use this tool for batch modification of your journal files you may
+find useful output in form of unified diff.
+
+$ hledger rewrite -- --diff -f examples/sample.journal '^income' --add-posting '(liabilities:tax)  *.33'
+
+   Output might look like:
+
+--- /tmp/examples/sample.journal
++++ /tmp/examples/sample.journal
+@@ -18,3 +18,4 @@
+ 2008/01/01 income
+-    assets:bank:checking  $1
++    assets:bank:checking            $1
+     income:salary
++    (liabilities:tax)                0
+@@ -22,3 +23,4 @@
+ 2008/06/01 gift
+-    assets:bank:checking  $1
++    assets:bank:checking            $1
+     income:gifts
++    (liabilities:tax)                0
+
+   If you'll pass this through 'patch' tool you'll get transactions
+containing the posting that matches your query be updated.  Note that
+multiple files might be update according to list of input files
+specified via '--file' options and 'include' directives inside of these
+files.
+
+   Be careful.  Whole transaction being re-formatted in a style of
+output from 'hledger print'.
+
+   See also:
+
+   https://github.com/simonmichael/hledger/issues/99
+
+
+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
+................................
+
+This command predates print -auto, and currently does much the same
+thing, but with these differences:
+
+   * with multiple files, rewrite lets rules in any file affect all
+     other files.  print -auto uses standard directive scoping; rules
+     affect only child files.
+
+   * rewrite's query limits which transactions can be rewritten; all are
+     printed.  print -auto's query limits which transactions are
+     printed.
+
+   * rewrite applies rules specified on command line or in the journal.
+     print -auto applies rules specified in the journal.
+
+
+File: hledger.info,  Node: roi,  Next: stats,  Prev: rewrite,  Up: COMMANDS
+
+3.26 roi
+========
+
+roi
+Shows the time-weighted (TWR) and money-weighted (IRR) rate of return on
+your investments.
+
+   This command assumes that you have account(s) that hold nothing but
+your investments and whenever you record current appraisal/valuation of
+these investments you offset unrealized profit and loss into account(s)
+that, again, hold nothing but unrealized profit and loss.
+
+   Any transactions affecting balance of investment account(s) and not
+originating from unrealized profit and loss account(s) are assumed to be
+your investments or withdrawals.
+
+   At a minimum, you need to supply a query (which could be just an
+account name) to select your investments with '--inv', and another query
+to identify your profit and loss transactions with '--pnl'.
+
+   It will compute and display the internalized rate of return (IRR) and
+time-weighted rate of return (TWR) for your investments for the time
+period requested.  Both rates of return are annualized before display,
+regardless of the length of reporting interval.
+
+
+File: hledger.info,  Node: stats,  Next: tags,  Prev: roi,  Up: COMMANDS
+
+3.27 stats
+==========
+
+stats
+Show some journal statistics.
+
+   The stats command displays summary information for the whole journal,
+or a matched part of it.  With a reporting interval, it shows a report
+for each report period.
+
+   Example:
+
+$ hledger stats
+Main journal file        : /src/hledger/examples/sample.journal
+Included journal files   : 
+Transactions span        : 2008-01-01 to 2009-01-01 (366 days)
+Last transaction         : 2008-12-31 (2333 days ago)
+Transactions             : 5 (0.0 per day)
+Transactions last 30 days: 0 (0.0 per day)
+Transactions last 7 days : 0 (0.0 per day)
+Payees/descriptions      : 5
+Accounts                 : 8 (depth 3)
+Commodities              : 1 ($)
+Market prices            : 12 ($)
+
+   This command also supports output destination and output format
+selection.
+
+
+File: hledger.info,  Node: tags,  Next: test,  Prev: stats,  Up: COMMANDS
+
+3.28 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.
+
+
+File: hledger.info,  Node: test,  Next: Add-on Commands,  Prev: tags,  Up: COMMANDS
+
+3.29 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
+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 as
+a bug!
+
+   This command also accepts tasty test runner options, written after a
+- (double hyphen).  Eg to run only the tests in Hledger.Data.Amount,
+with ANSI colour codes disabled:
+
+$ hledger test -- -pData.Amount --color=never
+
+   For help on these, see https://github.com/feuerbach/tasty#options
+('-- --help' currently doesn't show them).
+
+
+File: hledger.info,  Node: Add-on Commands,  Prev: test,  Up: COMMANDS
+
+3.30 Add-on Commands
+====================
+
+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
+extension (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
+things to be aware of.  Eg if the 'hledger-web' add-on is installed,
+
+   * 'hledger -h web' shows hledger's help, while 'hledger web -h' shows
+     hledger-web's help.
+
+   * 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'.
+
+   * 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
+options, journal parsing, reporting, etc.
+
+   Two important add-ons are the hledger-ui and hledger-web user
+interfaces.  These are maintained and released along with hledger:
+
+* Menu:
+
+* ui::
+* web::
+* iadd::
+* interest::
+
+
+File: hledger.info,  Node: ui,  Next: web,  Up: Add-on Commands
+
+3.30.1 ui
+---------
+
+hledger-ui provides an efficient terminal interface.
+
+
+File: hledger.info,  Node: web,  Next: iadd,  Prev: ui,  Up: Add-on Commands
+
+3.30.2 web
+----------
+
+hledger-web provides a simple web interface.
+
+   Third party add-ons, maintained separately from hledger, include:
+
+
+File: hledger.info,  Node: iadd,  Next: interest,  Prev: web,  Up: Add-on Commands
+
+3.30.3 iadd
+-----------
+
+hledger-iadd is a more interactive, terminal UI replacement for the add
+command.
+
+
+File: hledger.info,  Node: interest,  Prev: iadd,  Up: Add-on Commands
+
+3.30.4 interest
+---------------
+
+hledger-interest generates interest transactions for an account
+according to various schemes.
+
+   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.
+
+
+File: hledger.info,  Node: ENVIRONMENT,  Next: FILES,  Prev: COMMANDS,  Up: Top
+
+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'.
+Default: '~/.hledger.journal' (on windows, perhaps
+'C:/Users/USER/.hledger.journal').
+
+   A typical value is '~/DIR/YYYY.journal', where DIR is a
+version-controlled finance directory and YYYY is the current year.  Or
+'~/DIR/current.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
+(say, an Emacs dock icon).  Eg on MacOS Catalina I have a
+'~/.MacOSX/environment.plist' file containing
+
+{
+  "LEDGER_FILE" : "~/finance/current.journal"
+}
+
+   To see the effect you may need to 'killall Dock', or reboot.
+
+
+File: hledger.info,  Node: FILES,  Next: LIMITATIONS,  Prev: ENVIRONMENT,  Up: Top
+
+5 FILES
+*******
+
+Reads data from one or more files in hledger journal, timeclock,
+timedot, or CSV format specified with '-f', or '$LEDGER_FILE', or
+'$HOME/.hledger.journal' (on windows, perhaps
+'C:/Users/USER/.hledger.journal').
+
+
+File: hledger.info,  Node: LIMITATIONS,  Next: TROUBLESHOOTING,  Prev: FILES,  Up: Top
+
+6 LIMITATIONS
+*************
+
+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 must be configured (or there will be an unhelpful error).  Eg on
+POSIX, set LANG to something other than C.
+
+   In a Microsoft Windows CMD window, non-ascii characters and colours
+are not supported.
+
+   On Windows, non-ascii characters may not display correctly when
+running a hledger built in CMD in MSYS/CYGWIN, or vice-versa.
+
+   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 differences.
+
+   On large data files, hledger is slower and uses more memory than
+Ledger.
+
+
+File: hledger.info,  Node: TROUBLESHOOTING,  Prev: LIMITATIONS,  Up: Top
+
+7 TROUBLESHOOTING
+*****************
+
+Here are some issues you might encounter when you run hledger (and
+remember 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,
+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
+need to use 'export'.  Here's an explanation.
+
+   *"Illegal byte sequence" or "Invalid or incomplete multibyte or wide
+character" errors*
+In order to handle non-ascii letters and symbols (like £), hledger needs
+an appropriate locale.  This is usually configured system-wide; you can
+also configure it temporarily.  The locale may need to be one that
+supports UTF-8, if you built hledger with GHC < 7.2 (or possibly always,
+I'm not sure yet).
+
+   Here's an example of setting the locale temporarily, on ubuntu
+gnu/linux:
+
+$ file my.journal
+my.journal: UTF-8 Unicode text                 # <- the file is UTF8-encoded
+$ locale -a
+C
+en_US.utf8                             # <- a UTF8-aware locale is available
+POSIX
+$ LANG=en_US.utf8 hledger -f my.journal print   # <- use it for this command
+
+   Here's one way to set it permanently, there are probably better ways:
+
+$ echo "export LANG=en_US.UTF-8" >>~/.bash_profile
+$ bash --login
+
+   If we preferred to use eg 'fr_FR.utf8', we might have to install that
+first:
+
+$ apt-get install language-pack-fr
+$ locale -a
+C
+en_US.utf8
+fr_BE.utf8
+fr_CA.utf8
+fr_CH.utf8
+fr_FR.utf8
+fr_LU.utf8
+POSIX
+$ LANG=fr_FR.utf8 hledger -f my.journal print
+
+   Note some platforms allow variant locale spellings, but not all
+(ubuntu accepts 'fr_FR.UTF8', mac osx requires exactly 'fr_FR.UTF-8').
+
+
+Tag Table:
+Node: Top68
+Node: COMMON TASKS2315
+Ref: #common-tasks2427
+Node: Getting help2834
+Ref: #getting-help2966
+Node: Constructing command lines3519
+Ref: #constructing-command-lines3711
+Node: Starting a journal file4408
+Ref: #starting-a-journal-file4606
+Node: Setting opening balances5794
+Ref: #setting-opening-balances5990
+Node: Recording transactions9131
+Ref: #recording-transactions9311
+Node: Reconciling9867
+Ref: #reconciling10010
+Node: Reporting12267
+Ref: #reporting12407
+Node: Migrating to a new file16406
+Ref: #migrating-to-a-new-file16554
+Node: OPTIONS16853
+Ref: #options16960
+Node: General options17330
+Ref: #general-options17455
+Node: Command options20225
+Ref: #command-options20376
+Node: Command arguments20774
+Ref: #command-arguments20921
+Node: Queries21801
+Ref: #queries21956
+Node: Special characters in arguments and queries25918
+Ref: #special-characters-in-arguments-and-queries26146
+Node: More escaping26597
+Ref: #more-escaping26759
+Node: Even more escaping27055
+Ref: #even-more-escaping27249
+Node: Less escaping27920
+Ref: #less-escaping28082
+Node: Unicode characters28327
+Ref: #unicode-characters28509
+Node: Input files29921
+Ref: #input-files30064
+Node: Output destination31993
+Ref: #output-destination32145
+Node: Output format32570
+Ref: #output-format32720
+Node: Regular expressions34768
+Ref: #regular-expressions34925
+Node: Smart dates36286
+Ref: #smart-dates36437
+Node: Report start & end date37798
+Ref: #report-start-end-date37970
+Node: Report intervals39408
+Ref: #report-intervals39573
+Node: Period expressions39963
+Ref: #period-expressions40123
+Node: Depth limiting44249
+Ref: #depth-limiting44393
+Node: Pivoting44735
+Ref: #pivoting44858
+Node: Valuation46534
+Ref: #valuation46636
+Node: -B Cost46816
+Ref: #b-cost46927
+Node: -V Market value47125
+Ref: #v-market-value47299
+Node: -X Market value in specified commodity48731
+Ref: #x-market-value-in-specified-commodity48970
+Node: --value Flexible valuation49146
+Ref: #value-flexible-valuation49372
+Node: Effect of --value on reports53877
+Ref: #effect-of---value-on-reports54093
+Node: Combining -B -V -X --value59639
+Ref: #combining--b--v--x---value59822
+Node: COMMANDS59858
+Ref: #commands59966
+Node: accounts61050
+Ref: #accounts61148
+Node: activity61847
+Ref: #activity61957
+Node: add62340
+Ref: #add62439
+Node: balance65178
+Ref: #balance65289
+Node: Classic balance report66747
+Ref: #classic-balance-report66920
+Node: Customising the classic balance report68289
+Ref: #customising-the-classic-balance-report68517
+Node: Colour support70593
+Ref: #colour-support70760
+Node: Flat mode70933
+Ref: #flat-mode71081
+Node: Depth limited balance reports71494
+Ref: #depth-limited-balance-reports71679
+Node: Percentages72135
+Ref: #percentages72301
+Node: Multicolumn balance report73438
+Ref: #multicolumn-balance-report73618
+Node: Budget report78880
+Ref: #budget-report79023
+Node: Nested budgets84225
+Ref: #nested-budgets84337
+Ref: #output-format-187818
+Node: balancesheet88015
+Ref: #balancesheet88151
+Node: balancesheetequity89617
+Ref: #balancesheetequity89766
+Node: cashflow90489
+Ref: #cashflow90617
+Node: check-dates91796
+Ref: #check-dates91923
+Node: check-dupes92202
+Ref: #check-dupes92326
+Node: close92619
+Ref: #close92733
+Node: close usage94255
+Ref: #close-usage94348
+Node: commodities97161
+Ref: #commodities97288
+Node: descriptions97370
+Ref: #descriptions97498
+Node: diff97679
+Ref: #diff97785
+Node: files98832
+Ref: #files98932
+Node: help99079
+Ref: #help99179
+Node: import100260
+Ref: #import100374
+Node: Importing balance assignments101267
+Ref: #importing-balance-assignments101415
+Node: incomestatement102064
+Ref: #incomestatement102197
+Node: notes103684
+Ref: #notes103797
+Node: payees103923
+Ref: #payees104029
+Node: prices104187
+Ref: #prices104293
+Node: print104634
+Ref: #print104744
+Node: print-unique109530
+Ref: #print-unique109656
+Node: register109941
+Ref: #register110068
+Node: Custom register output114240
+Ref: #custom-register-output114369
+Node: register-match115706
+Ref: #register-match115840
+Node: rewrite116191
+Ref: #rewrite116306
+Node: Re-write rules in a file118161
+Ref: #re-write-rules-in-a-file118295
+Node: Diff output format119505
+Ref: #diff-output-format119674
+Node: rewrite vs print --auto120766
+Ref: #rewrite-vs.-print---auto120945
+Node: roi121501
+Ref: #roi121599
+Node: stats122611
+Ref: #stats122710
+Node: tags123498
+Ref: #tags123596
+Node: test123890
+Ref: #test123998
+Node: Add-on Commands124745
+Ref: #add-on-commands124862
+Node: ui126205
+Ref: #ui126293
+Node: web126347
+Ref: #web126450
+Node: iadd126566
+Ref: #iadd126677
+Node: interest126759
+Ref: #interest126866
+Node: ENVIRONMENT127106
+Ref: #environment127218
+Node: FILES128047
+Ref: #files-1128150
+Node: LIMITATIONS128363
+Ref: #limitations128482
+Node: TROUBLESHOOTING129224
+Ref: #troubleshooting129337
 
 End Tag Table
 
diff --git a/embeddedfiles/hledger.txt b/embeddedfiles/hledger.txt
--- a/embeddedfiles/hledger.txt
+++ b/embeddedfiles/hledger.txt
@@ -12,2812 +12,3179 @@
        hledger
 
 DESCRIPTION
-       hledger  is  a  cross-platform program for tracking money, time, or any
-       other commodity, using double-entry accounting and a  simple,  editable
-       file  format.   hledger  is  inspired  by  and  largely compatible with
-       ledger(1).
-       Tested on unix, mac, windows, hledger aims to be a reliable,  practical
-       tool for daily use.
-
-       This  is  hledger's command-line interface (there are also terminal and
-       web interfaces).  Its basic function is to read a plain text  file  de-
-       scribing  financial  transactions (in accounting terms, a general jour-
-       nal) and print useful reports on standard output,  or  export  them  as
-       CSV.   hledger can also read some other file formats such as CSV files,
-       translating them to journal format.  Additionally, hledger lists  other
-       hledger-*  executables found in the user's $PATH and can invoke them as
-       subcommands.
-
-       hledger reads data from one or more files  in  hledger  journal,  time-
-       clock,  timedot,  or  CSV format specified with -f, or $LEDGER_FILE, or
-       $HOME/.hledger.journal          (on          windows,           perhaps
-       C:/Users/USER/.hledger.journal).  If using $LEDGER_FILE, note this must
-       be a real environment variable, not a shell variable.  You can  specify
-       standard input with -f-.
-
-       Transactions  are  dated movements of money between two (or more) named
-       accounts, and are recorded with journal entries like this:
-
-              2015/10/16 bought food
-               expenses:food          $10
-               assets:cash
-
-       For more about this format, see hledger_journal(5).
-
-       Most users use a text editor to edit the journal, usually with an  edi-
-       tor mode such as ledger-mode for added convenience.  hledger's interac-
-       tive add command is another way to record  new  transactions.   hledger
-       never changes existing transactions.
-
-       To  get  started,  you  can  either save some entries like the above in
-       ~/.hledger.journal, or run hledger add and follow  the  prompts.   Then
-       try  some  commands like hledger print or hledger balance.  Run hledger
-       with no arguments for a list of commands.
-
-EXAMPLES
-       Two simple transactions in hledger journal format:
-
-              2015/9/30 gift received
-                assets:cash   $20
-                income:gifts
-
-              2015/10/16 farmers market
-                expenses:food    $10
-                assets:cash
-
-       Some basic reports:
-
-              $ hledger print
-              2015/09/30 gift received
-                  assets:cash            $20
-                  income:gifts          $-20
-
-              2015/10/16 farmers market
-                  expenses:food           $10
-                  assets:cash            $-10
-
-              $ hledger accounts --tree
-              assets
-                cash
-              expenses
-                food
-              income
-                gifts
-
-              $ hledger balance
-                               $10  assets:cash
-                               $10  expenses:food
-                              $-20  income:gifts
-              --------------------
-                                 0
-
-              $ hledger register cash
-              2015/09/30 gift received   assets:cash               $20           $20
-              2015/10/16 farmers market  assets:cash              $-10           $10
-
-       More commands:
-
-              $ hledger                                 # show available commands
-              $ hledger add                             # add more transactions to the journal file
-              $ hledger balance                         # all accounts with aggregated balances
-              $ hledger balance --help                  # show detailed help for balance command
-              $ hledger balance --depth 1               # only top-level accounts
-              $ hledger register                        # show account postings, with running total
-              $ hledger reg income                      # show postings to/from income accounts
-              $ hledger reg 'assets:some bank:checking' # show postings to/from this checking account
-              $ hledger print desc:shop                 # show transactions with shop in the description
-              $ hledger activity -W                     # show transaction counts per week as a bar chart
-
-OPTIONS
-   General options
-       To see general usage help, including general  options  which  are  sup-
-       ported by most hledger commands, run hledger -h.
-
-       General help options:
-
-       -h --help
-              show general usage (or after COMMAND, command usage)
-
-       --version
-              show version
-
-       --debug[=N]
-              show debug output (levels 1-9, default: 1)
-
-       General input options:
-
-       -f FILE --file=FILE
-              use  a  different  input  file.   For  stdin,  use  -  (default:
-              $LEDGER_FILE or $HOME/.hledger.journal)
-
-       --rules-file=RULESFILE
-              Conversion  rules  file  to  use  when  reading  CSV   (default:
-              FILE.rules)
-
-       --separator=CHAR
-              Field separator to expect when reading CSV (default: ',')
-
-       --alias=OLD=NEW
-              rename accounts named OLD to NEW
-
-       --anon anonymize accounts and payees
-
-       --pivot FIELDNAME
-              use some other field or tag for the account name
-
-       -I --ignore-assertions
-              ignore any failing balance assertions
-
-       General reporting options:
-
-       -b --begin=DATE
-              include postings/txns on or after this date
-
-       -e --end=DATE
-              include postings/txns before this date
-
-       -D --daily
-              multiperiod/multicolumn report by day
-
-       -W --weekly
-              multiperiod/multicolumn report by week
-
-       -M --monthly
-              multiperiod/multicolumn report by month
-
-       -Q --quarterly
-              multiperiod/multicolumn report by quarter
-
-       -Y --yearly
-              multiperiod/multicolumn report by year
-
-       -p --period=PERIODEXP
-              set  start date, end date, and/or reporting interval all at once
-              using period expressions syntax
-
-       --date2
-              match the secondary date instead (see command help for other ef-
-              fects)
-
-       -U --unmarked
-              include only unmarked postings/txns (can combine with -P or -C)
-
-       -P --pending
-              include only pending postings/txns
-
-       -C --cleared
-              include only cleared postings/txns
-
-       -R --real
-              include only non-virtual postings
-
-       -NUM --depth=NUM
-              hide/aggregate accounts or postings more than NUM levels deep
-
-       -E --empty
-              show  items with zero amount, normally hidden (and vice-versa in
-              hledger-ui/hledger-web)
-
-       -B --cost
-              convert amounts to their cost at  transaction  time  (using  the
-              transaction price, if any)
-
-       -V --value
-              convert  amounts  to  their  market value on the report end date
-              (using the most recent applicable market price, if any)
-
-       --auto apply automated posting rules to modify transactions.
-
-       --forecast
-              apply periodic transaction rules  to  generate  future  transac-
-              tions, to 6 months from now or report end date.
-
-       When a reporting option appears more than once in the command line, the
-       last one takes precedence.
-
-       Some reporting options can also be written as query arguments.
-
-   Command options
-       To see options for a particular command, including command-specific op-
-       tions, run: hledger COMMAND -h.
-
-       Command-specific  options  must  be written after the command name, eg:
-       hledger print -x.
-
-       Additionally, if the command is an addon, you may need to put  its  op-
-       tions  after  a  double-hyphen, eg: hledger ui -- --watch.  Or, you can
-       run the addon executable directly: hledger-ui --watch.
-
-   Command arguments
-       Most hledger commands accept arguments after the  command  name,  which
-       are often a query, filtering the data in some way.
-
-   Argument files
-       You can save a set of command line options/arguments in a file, one per
-       line, and then reuse them by writing @FILENAME in a command  line.   To
-       prevent this expansion of @-arguments, precede them with a -- argument.
-       For more, see Save frequently used options.
-
-   Special characters in arguments and queries
-       In shell command lines, option and argument values which contain "prob-
-       lematic" characters, ie spaces, and also characters significant to your
-       shell such as <, >, (, ), | and $, should be escaped by enclosing  them
-       in quotes or by writing backslashes before the characters.  Eg:
-
-       hledger   register   -p   'last  year'  "accounts  receivable  (receiv-
-       able|payable)" amt:\>100.
-
-   More escaping
-       Characters significant both to the shell and in regular expressions may
-       need  one extra level of escaping.  These include parentheses, the pipe
-       symbol and the dollar sign.  Eg, to match the dollar symbol, bash users
-       should do:
-
-       hledger balance cur:'\$'
-
-       or:
-
-       hledger balance cur:\\$
-
-   Even more escaping
-       When  hledger runs an addon executable (eg you type hledger ui, hledger
-       runs hledger-ui), it  de-escapes  command-line  options  and  arguments
-       once,  so  you might need to triple-escape.  Eg in bash, running the ui
-       command and matching the dollar sign, it's:
-
-       hledger ui cur:'\\$'
-
-       or:
-
-       hledger ui cur:\\\\$
-
-       If you asked why four slashes above, this may help:
-
-       unescaped:        $
-       escaped:          \$
-       double-escaped:   \\$
-       triple-escaped:   \\\\$
-
-       (The number of backslashes in fish shell is left as an exercise for the
-       reader.)
-
-       You can always avoid the extra escaping for addons by running the addon
-       directly:
-
-       hledger-ui cur:\\$
-
-   Less escaping
-       Inside an argument file, or  in  the  search  field  of  hledger-ui  or
-       hledger-web,  or  at a GHCI prompt, you need one less level of escaping
-       than at the command line.  And backslashes may work better than quotes.
-       Eg:
-
-       ghci> :main balance cur:\$
-
-   Command line tips
-       If in doubt, keep things simple:
-
-       o write options after the command (hledger CMD -OPTIONS ARGS)
-
-       o run add-on executables directly (hledger-ui -OPTIONS ARGS)
-
-       o enclose problematic args in single quotes
-
-       o if needed, also add a backslash to escape regexp metacharacters
-
-       To  find  out exactly how a command line is being parsed, add --debug=2
-       to troubleshoot.
-
-   Unicode characters
-       hledger is expected to handle non-ascii characters correctly:
-
-       o they should be parsed correctly in input files  and  on  the  command
-         line,  by all hledger tools (add, iadd, hledger-web's search/add/edit
-         forms, etc.)
-
-       o they should be displayed correctly by  all  hledger  tools,  and  on-
-         screen alignment should be preserved.
-
-       This requires a well-configured environment.  Here are some tips:
-
-       o A  system  locale must be configured, and it must be one that can de-
-         code the characters being used.  In bash, you can set a  locale  like
-         this:  export LANG=en_US.UTF-8.  There are some more details in Trou-
-         bleshooting.  This step is essential - without it, hledger will  quit
-         on  encountering a non-ascii character (as with all GHC-compiled pro-
-         grams).
-
-       o your terminal software (eg  Terminal.app,  iTerm,  CMD.exe,  xterm..)
-         must support unicode
-
-       o the terminal must be using a font which includes the required unicode
-         glyphs
-
-       o the terminal should be configured to display wide characters as  dou-
-         ble width (for report alignment)
-
-       o on  Windows, for best results you should run hledger in the same kind
-         of environment in which it was built.  Eg hledger built in the  stan-
-         dard  CMD.EXE  environment  (like  the binaries on our download page)
-         might show display problems when run in a cygwin  or  msys  terminal,
-         and vice versa.  (See eg #961).
-
-   Input files
-       hledger reads transactions from a data file (and the add command writes
-       to it).  By default this file is $HOME/.hledger.journal (or on Windows,
-       something  like C:/Users/USER/.hledger.journal).  You can override this
-       with the $LEDGER_FILE environment variable:
-
-              $ setenv LEDGER_FILE ~/finance/2016.journal
-              $ hledger stats
-
-       or with the -f/--file option:
-
-              $ hledger -f /some/file stats
-
-       The file name - (hyphen) means standard input:
-
-              $ 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:
-
-       Reader:    Reads:                            Used for file extensions:
-       -----------------------------------------------------------------------------
-       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)
-
-       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 -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:
-
-       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.
-
-   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
-       omitted (defaulting to 1).
-
-       Examples:
-
-       2004/10/1,     2004-01-01,   exact  date, several sepa-
-       2004.9.1                     rators allowed.   Year  is
-                                    4+  digits, month is 1-12,
-                                    day is 1-31
-       2004                         start of year
-       2004/10                      start of month
-       10/1                         month and day  in  current
-                                    year
-       21                           day in current month
-       october, oct                 start  of month in current
-                                    year
-       yesterday, today, tomorrow   -1, 0, 1 days from today
-       last/this/next               -1, 0, 1 periods from  the
-       day/week/month/quar-         current period
-       ter/year
-       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-
-       sults:
-
-       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 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
-       journal data, by default.  So, the effective report start and end dates
-       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,
-       -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
-         after the last day you want to include.
-
-       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
-         smallest common time span.
-
-       Examples:
-
-       -b 2016/3/17      begin  on  St.   Patrick's
-                         day 2016
-
-
-
-
-       -e 12/1           end at the start of decem-
-                         ber  1st  of  the  current
-                         year  (11/30  will  be the
-                         last date included)
-       -b thismonth      all transactions on or af-
-                         ter the 1st of the current
-                         month
-       -p thismonth      all  transactions  in  the
-                         current month
-       date:2016/3/17-   the   above   written   as
-                         queries instead
-       date:-12/1
-       date:thismonth-
-       date:thismonth
-
-   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-
-       tervals can not be specified with a query.
-
-   Period expressions
-       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
-       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
-       "-".  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
-       also be written as:
-
-       -p "1/1 4/1"
-       -p "january-apr"
-       -p "this year to 4/1"
-
-       If you specify only one date, the missing start or end date will be the
-       earliest or latest transaction in your journal:
-
-       -p "from 2009/1/1"   everything  after  january
-                            1, 2009
-       -p "from 2009/1"     the same
-       -p "from 2009"       the same
-       -p "to 2009"         everything  before january
-                            1, 2009
-
-       A single date with no "from" or "to" defines both  the  start  and  end
-       date like so:
-
-       -p "2009"       the  year 2009; equivalent
-                       to "2009/1/1 to 2010/1/1"
-       -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
-                       to "2009/1/1 to 2009/1/2"
-
-       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
-       flags.  Between report interval and start/end dates (if any), the  word
-       in is optional.  Examples:
-
-       -p "weekly from 2009/1/1 to 2009/4/1"
-       -p "monthly in 2008"
-       -p "quarterly"
-
-       Note  that  weekly, monthly, quarterly and yearly intervals will always
-       start on the first day on week, month, quarter or year accordingly, and
-       will  end on the last day of same period, even if associated period ex-
-       pression specifies different explicit start and end date.
-
-       For example:
-
-       -p "weekly from 2009/1/1  to  2009/4/1"
-       --  starts  on 2008/12/29, closest pre-
-       ceding Monday
-       -p "monthly in 2008/11/25" -- starts on
-       2018/11/01
-       -p   "quarterly   from   2009-05-05  to
-       2009-06-01"  -  starts  on  2009/04/01,
-       ends on 2009/06/30, which are first and
-       last days of Q2 2009
-       -p "yearly from 2009-12-29" - starts on
-       2009/01/01, first day of 2009
-
-       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.
-
-       All  of  these  will start on the first day of the requested period and
-       end on the last one, as described above.
-
-       Examples:
-
-       -p "bimonthly  from  2008"  --  periods
-       will  have  boundaries  on  2008/01/01,
-       2008/03/01, ...
-       -p "every 2 weeks" -- starts on closest
-       preceding Monday
-       -p  "every 5 month from 2009/03" -- pe-
-       riods   will   have    boundaries    on
-       2009/03/01, 2009/08/01, ...
-
-       If  you want intervals that start on arbitrary day of your choosing and
-       span a week, month or year, you need to use any of the following:
-
-       every Nth day of week, every <weekday>, every Nth day [of month], every
-       Nth weekday [of month], every MM/DD [of year], every Nth MMM [of year],
-       every MMM Nth [of year].
-
-       Examples:
-
-       -p "every 2nd day of week"  --  periods
-       will go from Tue to Tue
-       -p "every Tue" -- same
-       -p  "every  15th  day" -- period bound-
-       aries will be on 15th of each month
-       -p "every 2nd Monday" -- period  bound-
-       aries  will be on second Monday of each
-       month
-
-       -p "every 11/05" -- yearly periods with
-       boundaries on 5th of Nov
-       -p "every 5th Nov" -- same
-       -p "every Nov 5th" -- same
-
-       Show  historical balances at end of 15th each month (N is exclusive end
-       date):
-
-       hledger balance -H -p "every 16th day"
-
-       Group postings from start of wednesday to end of  next  tuesday  (N  is
-       start date and exclusive end date):
-
-       hledger register checking -p "every 3rd day of week"
-
-   Depth limiting
-       With the --depth N option (short form: -N), commands like account, bal-
-       ance and register will show only the uppermost accounts in the  account
-       tree,  down to level N.  Use this when you want a summary with less de-
-       tail.  This flag has the same effect as a depth: query argument (so -2,
-       --depth=2 or depth:2 are basically equivalent).
-
-   Pivoting
-       Normally hledger sums amounts, and organizes them in a hierarchy, based
-       on account name.  The --pivot FIELD option causes it to sum  and  orga-
-       nize  hierarchy  based on the value of some other field instead.  FIELD
-       can be: code, description, payee, note, or the full name (case insensi-
-       tive) of any tag.  As with account names, values containing colon:sepa-
-       rated:parts will be displayed hierarchically in reports.
-
-       --pivot is a general option affecting all reports;  you  can  think  of
-       hledger transforming the journal before any other processing, replacing
-       every posting's account name with the value of the specified  field  on
-       that posting, inheriting it from the transaction or using a blank value
-       if it's not present.
-
-       An example:
-
-              2016/02/16 Member Fee Payment
-                  assets:bank account                    2 EUR
-                  income:member fees                    -2 EUR  ; member: John Doe
-
-       Normal balance report showing account names:
-
-              $ hledger balance
-                             2 EUR  assets:bank account
-                            -2 EUR  income:member fees
-              --------------------
-                                 0
-
-       Pivoted balance report, using member: tag values instead:
-
-              $ hledger balance --pivot member
-                             2 EUR
-                            -2 EUR  John Doe
-              --------------------
-                                 0
-
-       One way to show only amounts with a member: value (using a  query,  de-
-       scribed below):
-
-              $ hledger balance --pivot member tag:member=.
-                            -2 EUR  John Doe
-              --------------------
-                            -2 EUR
-
-       Another  way  (the  acct:  query  matches  against the pivoted "account
-       name"):
-
-              $ hledger balance --pivot member acct:.
-                            -2 EUR  John Doe
-              --------------------
-                            -2 EUR
-
-   Valuation
-   -B: Cost
-       The -B/--cost flag converts amounts to their cost (or selling price) at
-       transaction  time,  if  they  have a transaction price specified.  This
-       flag is equivalent to --value=cost, described below.
-
-   -V: Market value
-       The -V/--market flag converts reported amounts to their market value in
-       a  default  valuation commodity, using the market prices in effect on a
-       default valuation date.  For single period reports, the valuation  date
-       is  today  (equivalent  to --value=now); for multiperiod reports, it is
-       the last day of each subperiod (equivalent to --value=end).
-
-       The default valuation commodity is the one referenced in the latest ap-
-       plicable  market  price dated on or before the valuation date.  If most
-       of your P declarations lead to a single home currency, this  will  usu-
-       ally be what you want.  (To specify the commodity, see -X below.)
-
-       Note that in hledger, market prices are always declared explicitly with
-       P directives; we do not infer them from transaction  prices  as  Ledger
-       does.
-
-       Here's a quick example of -V:
-
-              ; one euro is worth this many dollars from nov 1
-              P 2016/11/01 EUR $1.10
-
-              ; purchase some euros on nov 3
-              2016/11/3
-                  assets:euros        EUR100
-                  assets:checking
-
-              ; the euro is worth fewer dollars by dec 21
-              P 2016/12/21 EUR $1.03
-
-       How many euros do I have ?
-
-              $ hledger -f t.j bal -N euros
-                              EUR100  assets:euros
-
-       What are they worth at end of nov 3 ?
-
-              $ hledger -f t.j bal -N euros -V -e 2016/11/4
-                           $110.00  assets:euros
-
-       What  are they worth after 2016/12/21 ?  (no report end date specified,
-       defaults to today)
-
-              $ hledger -f t.j bal -N euros -V
-                           $103.00  assets:euros
-
-   -X: Market value in specified commodity
-       The -X/--exchange option is like -V, except  it  specifies  the  target
-       commodity   you  would  like  to  convert  to.   It  is  equivalent  to
-       --value=now,COMM or --value=end,COMM.
-
-   --value: Flexible valuation
-       (experimental, added 201905)
-
-       -B, -V and -X are special cases of the more general --value option:
-
-               --value=TYPE[,COMM]  TYPE is cost, end, now or YYYY-MM-DD.
-                                    COMM is an optional commodity symbol.
-                                    Shows amounts converted to:
-                                    - cost commodity using transaction prices (then optionally to COMM using market prices at period end(s))
-                                    - default valuation commodity (or COMM) using market prices at period end(s)
-                                    - default valuation commodity (or COMM) using current market prices
-                                    - default valuation commodity (or COMM) using market prices at some date
-
-       The TYPE part basically selects either "cost", or "market value" plus a
-       valuation date:
-
-       --value=cost
-              Convert  amounts  to cost, using the prices recorded in transac-
-              tions.
-
-       --value=end
-              Convert amounts to their value in a default valuation commodity,
-              using  market prices on the last day of the report period (or if
-              unspecified, the journal's end date); or in multiperiod reports,
-              market prices on the last day of each subperiod.
-
-       --value=now
-              Convert  amounts  to  their value in default valuation commodity
-              using current market prices (as of when report is generated).
-
-       --value=YYYY-MM-DD
-              Convert amounts to their value in  default  valuation  commodity
-              using market prices on this date.
-
-       The  default valuation commodity is the commodity mentioned in the most
-       recent applicable market price declaration.  When all your price decla-
-       rations  lead  to a single home currency, this will usually do what you
-       want.
-
-       To select a different valuation commodity, add the optional ,COMM part:
-       a  comma,  then  the  target  commodity's symbol.  Eg: --value=now,EUR.
-       hledger will do its best to convert amounts to this commodity, using:
-
-       o declared prices (from source commodity to valuation commodity)
-
-       o reverse prices (declared prices from valuation to  source  commodity,
-         inverted)
-
-       o indirect  prices  (prices  calculated  from the shortest chain of de-
-         clared or reverse prices from source to valuation commodity)
-
-       in that order.
-
-       Here are some examples showing the  effect  of  --value  as  seen  with
-       print:
-
-              P 2000-01-01 A  1 B
-              P 2000-02-01 A  2 B
-              P 2000-03-01 A  3 B
-              P 2000-04-01 A  4 B
-
-              2000-01-01
-                (a)      1 A @ 5 B
-
-              2000-02-01
-                (a)      1 A @ 6 B
-
-              2000-03-01
-                (a)      1 A @ 7 B
-
-       Show the cost of each posting:
-
-              $ hledger -f- print --value=cost
-              2000/01/01
-                  (a)             5 B
-
-              2000/02/01
-                  (a)             6 B
-
-              2000/03/01
-                  (a)             7 B
-
-       Show the value as of the last day of the report period (2000-02-29):
-
-              $ hledger -f- print --value=end date:2000/01-2000/03
-              2000-01-01
-                  (a)             2 B
-
-              2000-02-01
-                  (a)             2 B
-
-       With  no  report  period specified, that shows the value as of the last
-       day of the journal (2000-03-01):
-
-              $ hledger -f- print --value=end
-              2000/01/01
-                  (a)             3 B
-
-              2000/02/01
-                  (a)             3 B
-
-              2000/03/01
-                  (a)             3 B
-
-       Show the current value (the 2000-04-01 price is still in effect today):
-
-              $ hledger -f- print --value=now
-              2000-01-01
-                  (a)             4 B
-
-              2000-02-01
-                  (a)             4 B
-
-              2000-03-01
-                  (a)             4 B
-
-       Show the value on 2000/01/15:
-
-              $ hledger -f- print --value=2000-01-15
-              2000/01/01
-                  (a)             1 B
-
-              2000/02/01
-                  (a)             1 B
-
-              2000/03/01
-                  (a)             1 B
-
-       You may need to explicitly set a commodity's display  style,  when  re-
-       verse prices are used.  Eg this output might be surprising:
-
-              P 2000-01-01 A 2B
-
-              2000-01-01
-                a  1B
-                b
-
-              $ hledger print -x -X A
-              2000/01/01
-                  a               0
-                  b               0
-
-       Explanation:  because there's no amount or commodity directive specify-
-       ing a display style for A, 0.5A gets the default style, which shows  no
-       decimal digits.  Because the displayed amount looks like zero, the com-
-       modity symbol and minus sign are not displayed either.  Adding  a  com-
-       modity directive sets a more useful display style for A:
-
-              P 2000-01-01 A 2B
-              commodity 0.00A
-
-              2000-01-01
-                a  1B
-                b
-
-              $ hledger print -X A
-              2000/01/01
-                  a           0.50A
-                  b          -0.50A
-
-   Effect of --value on reports
-       Here  is  a  reference  for  how --value currently affects each part of
-       hledger's reports.  It's work in progress, but may be useful for  trou-
-       bleshooting  or reporting bugs.  See also the definitions and notes be-
-       low.  If you find problems, please report them, ideally with  a  repro-
-       ducible example.  Related: #329, #1083.
-
-       Report type      -B,              -V, -X            --value=end        --value=DATE,
-                        --value=cost                                          --value=now
-       -------------------------------------------------------------------------------------
-       print
-       posting          cost             value at report   value at report    value      at
-       amounts                           end or today      or journal end     DATE/today
-       balance asser-   unchanged        unchanged         unchanged          unchanged
-       tions  /   as-
-       signments
-
-       register
-       starting  bal-   cost             value  at   day   value   at  day    value      at
-       ance (with -H)                    before   report   before   report    DATE/today
-                                         or      journal   or      journal
-                                         start             start
-       posting          cost             value at report   value at report    value      at
-       amounts    (no                    end or today      or journal end     DATE/today
-       report  inter-
-       val)
-       summary  post-   summarised       value at period   value at period    value      at
-       ing    amounts   cost             ends              ends               DATE/today
-       (with   report
-       interval)
-       running    to-   sum/average of   sum/average  of   sum/average  of    sum/average
-       tal/average      displayed val-   displayed  val-   displayed  val-    of  displayed
-                        ues              ues               ues                values
-
-       balance   (bs,
-       bse, cf, is..)
-       balances   (no   sums of costs    value at report   value at report    value      at
-       report  inter-                    end or today of   or journal  end    DATE/today of
-       val)                              sums  of  post-   of    sums   of    sums of post-
-                                         ings              postings           ings
-       balances (with   sums of costs    value at period   value at period    value      at
-       report  inter-                    ends of sums of   ends of sums of    DATE/today of
-       val)                              postings          postings           sums of post-
-                                                                              ings
-       starting  bal-   sums  of costs   sums  of  post-   sums  of  post-    sums of post-
-       ances    (with   of    postings   ings before re-   ings before re-    ings   before
-       report  inter-   before  report   port start        port start         report start
-       val and -H)      start
-       budget amounts   like balances    like balances     like balances      like balances
-       with --budget
-       grand    total   sum   of  dis-   sum   of   dis-   sum   of   dis-    sum  of  dis-
-       (no report in-   played values    played values     played values      played values
-       terval)
-
-       row totals/av-   sums/averages    sums/averages     sums/averages      sums/averages
-       erages   (with   of   displayed   of    displayed   of    displayed    of  displayed
-       report  inter-   values           values            values             values
-       val)
-       column totals    sums  of  dis-   sums   of  dis-   sums  of   dis-    sums  of dis-
-                        played values    played values     played values      played values
-       grand      to-   sum/average of   sum/average  of   sum/average  of    sum/average
-       tal/average      column totals    column totals     column totals      of column to-
-                                                                              tals
-
-
-       Additional notes
-
-       cost   calculated using price(s) recorded in the transaction(s).
-
-       value  market value using available market price declarations,  or  the
-              unchanged amount if no conversion rate can be found.
-
-       report start
-              the  first  day  of the report period specified with -b or -p or
-              date:, otherwise today.
-
-       report or journal start
-              the first day of the report period specified with -b  or  -p  or
-              date:,  otherwise  the earliest transaction date in the journal,
-              otherwise today.
-
-       report end
-              the last day of the report period specified with  -e  or  -p  or
-              date:, otherwise today.
-
-       report or journal end
-              the  last  day  of  the report period specified with -e or -p or
-              date:, otherwise the latest transaction  date  in  the  journal,
-              otherwise today.
-
-       report interval
-              a  flag (-D/-W/-M/-Q/-Y) or period expression that activates the
-              report's multi-period mode (whether showing one or many subperi-
-              ods).
-
-   Combining -B, -V, -X, --value
-       The rightmost of these flags wins.
-
-   Output destination
-       Some  commands (print, register, stats, the balance commands) can write
-       their output to a destination other than the  console.   This  is  con-
-       trolled by the -o/--output-file option.
-
-              $ hledger balance -o -     # write to stdout (the default)
-              $ hledger balance -o FILE  # write to FILE
-
-   Output format
-       Some  commands  can  write their output in other formats.  Eg print and
-       register can output CSV, and the balance commands  can  output  CSV  or
-       HTML.  This is controlled by the -O/--output-format option, or by spec-
-       ifying a .csv or .html file extension with -o/--output-file.
-
-              $ hledger balance -O csv       # write CSV to stdout
-              $ hledger balance -o FILE.csv  # write CSV to FILE.csv
-
-   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:
-         REGEX, desc:REGEX, cur:REGEX, tag:...=REGEX
-
-       o CSV rules conditional blocks: if REGEX ...
-
-       o account  alias  directives  and options: alias /REGEX/ = REPLACEMENT,
-         --alias /REGEX/=REPLACEMENT
-
-       hledger's regular expressions come from  the  regex-tdfa  library.   In
-       general they:
-
-       o are case insensitive
-
-       o are  infix  matching  (do  not  need  to match the entire thing being
-         matched)
-
-       o are POSIX extended regular expressions
-
-       o also support GNU word boundaries (\<, \>, \b, \B)
-
-       o and parenthesised capturing groups and numeric backreferences in  re-
-         placement strings
-
-       o do not support mode modifiers like (?s)
-
-       Some things to note:
-
-       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
-         with the dollar sign in hledger-web, write cur:\$.
-
-       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.
-
-QUERIES
-       One  of  hledger's strengths is being able to quickly report on precise
-       subsets of your data.  Most commands accept an optional  query  expres-
-       sion,  written  as arguments after the command name, to filter the data
-       by date, account name or other criteria.  The syntax is  similar  to  a
-       web search: one or more space-separated search terms, quotes to enclose
-       whitespace, prefixes to match specific fields, a not: prefix to  negate
-       the match.
-
-       We  do  not yet support arbitrary boolean combinations of search terms;
-       instead most commands show transactions/postings/accounts  which  match
-       (or negatively match):
-
-       o any of the description terms AND
-
-       o any of the account terms AND
-
-       o any of the status terms AND
-
-       o all the other terms.
-
-       The print command instead shows transactions which:
-
-       o match any of the description terms AND
-
-       o have any postings matching any of the positive account terms AND
-
-       o have no postings matching any of the negative account terms AND
-
-       o match all the other terms.
-
-       The  following  kinds  of search terms can be used.  Remember these can
-       also be prefixed with not:, eg to exclude a particular subaccount.
-
-       REGEX, acct:REGEX
-              match account names by this regular expression.  (With  no  pre-
-              fix, acct: is assumed.)  same as above
-
-       amt:N, amt:<N, amt:<=N, amt:>N, amt:>=N
-              match  postings with a single-commodity amount that is equal to,
-              less than, or greater than N.  (Multi-commodity amounts are  not
-              tested, and will always match.) The comparison has two modes: if
-              N is preceded by a + or - sign (or is 0), the two signed numbers
-              are  compared.  Otherwise, the absolute magnitudes are compared,
-              ignoring sign.
-
-       code:REGEX
-              match by transaction code (eg check number)
-
-       cur:REGEX
-              match postings or transactions including any amounts whose  cur-
-              rency/commodity  symbol  is fully matched by REGEX.  (For a par-
-              tial match, use .*REGEX.*).  Note, to match characters which are
-              regex-significant, like the dollar sign ($), you need to prepend
-              \.  And when using the command line you need  to  add  one  more
-              level  of  quoting  to hide it from the shell, so eg do: hledger
-              print cur:'\$' or hledger print cur:\\$.
-
-       desc:REGEX
-              match transaction descriptions.
-
-       date:PERIODEXPR
-              match dates within the specified period.  PERIODEXPR is a period
-              expression  (with  no  report  interval).   Examples: date:2016,
-              date:thismonth,  date:2000/2/1-2/15,  date:lastweek-.   If   the
-              --date2  command  line  flag  is present, this matches secondary
-              dates instead.
-
-       date2:PERIODEXPR
-              match secondary dates within the specified period.
-
-       depth:N
-              match (or display, depending on command) accounts  at  or  above
-              this depth
-
-       note:REGEX
-              match  transaction  notes  (part  of  description right of |, or
-              whole description when there's no |)
-
-       payee:REGEX
-              match transaction payee/payer names (part of description left of
-              |, or whole description when there's no |)
-
-       real:, real:0
-              match real or virtual postings respectively
-
-       status:, status:!, status:*
-              match unmarked, pending, or cleared transactions respectively
-
-       tag:REGEX[=REGEX]
-              match  by  tag  name,  and optionally also by tag value.  Note a
-              tag: query is considered to match a transaction  if  it  matches
-              any  of  the  postings.  Also remember that postings inherit the
-              tags of their parent transaction.
-
-       The following special search term is used automatically in hledger-web,
-       only:
-
-       inacct:ACCTNAME
-              tells  hledger-web to show the transaction register for this ac-
-              count.  Can be filtered further with acct etc.
-
-       Some of these can also be expressed as command-line options (eg depth:2
-       is  equivalent  to --depth 2).  Generally you can mix options and query
-       arguments, and the resulting query will be their intersection  (perhaps
-       excluding the -p/--period option).
-
-COMMANDS
-       hledger  provides  a  number  of subcommands; hledger with no arguments
-       shows a list.
-
-       If you install additional hledger-* packages, or if you put programs or
-       scripts  named  hledger-NAME in your PATH, these will also be listed as
-       subcommands.
-
-       Run a subcommand by writing its name as first argument (eg hledger  in-
-       comestatement).   You  can also write one of the standard short aliases
-       displayed in parentheses in the command list (hledger b),  or  any  any
-       unambiguous prefix of a command name (hledger inc).
-
-       Here  are  all  the  builtin  commands in alphabetical order.  See also
-       hledger for a more organised command list, and hledger CMD -h  for  de-
-       tailed command help.
-
-   accounts
-       accounts, a
-       Show account names.
-
-       This  command  lists account names, either declared with account direc-
-       tives (--declared), posted to (--used), or both  (the  default).   With
-       query  arguments,  only  matched account names and account names refer-
-       enced by matched postings are shown.  It shows a flat list by  default.
-       With  --tree,  it  uses  indentation to show the account hierarchy.  In
-       flat mode you can add --drop N to omit the first few account name  com-
-       ponents.   Account names can be depth-clipped with depth:N or --depth N
-       or -N.
-
-       Examples:
-
-              $ hledger accounts
-              assets:bank:checking
-              assets:bank:saving
-              assets:cash
-              expenses:food
-              expenses:supplies
-              income:gifts
-              income:salary
-              liabilities:debts
-
-   activity
-       activity
-       Show an ascii barchart of posting counts per interval.
-
-       The activity command displays an ascii  histogram  showing  transaction
-       counts  by  day, week, month or other reporting interval (by day is the
-       default).  With query arguments, it counts only matched transactions.
-
-       Examples:
-
-              $ hledger activity --quarterly
-              2008-01-01 **
-              2008-04-01 *******
-              2008-07-01
-              2008-10-01 **
-
-   add
-       add
-       Prompt for transactions and add them to the journal.
-
-       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.
-
-       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
-       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
-         template.
-
-       o You can also set the initial defaults with command line arguments.
-
-       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
-         empty, it will insert the default value.
-
-       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.
-
-       o Comments and tags may be entered following a description or amount.
-
-       o If  you make a mistake, enter < at any prompt to restart the transac-
-         tion.
-
-       o Input prompts are displayed in a different colour when  the  terminal
-         supports it.
-
-       Example (see the tutorial for a detailed explanation):
-
-              $ hledger add
-              Adding transactions to journal file /src/hledger/examples/sample.journal
-              Any command line arguments will be used as defaults.
-              Use tab key to complete, readline keys to edit, enter to accept defaults.
-              An optional (CODE) may follow transaction dates.
-              An optional ; COMMENT may follow descriptions or amounts.
-              If you make a mistake, enter < at any prompt to restart the transaction.
-              To end a transaction, enter . when prompted.
-              To quit, enter . at a date prompt or press control-d or control-c.
-              Date [2015/05/22]:
-              Description: supermarket
-              Account 1: expenses:food
-              Amount  1: $10
-              Account 2: assets:checking
-              Amount  2 [$-10.0]:
-              Account 3 (or . or enter to finish this transaction): .
-              2015/05/22 supermarket
-                  expenses:food             $10
-                  assets:checking        $-10.0
-
-              Save this transaction to the journal ? [y]:
-              Saved.
-              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).
-
-   balance
-       balance, bal, b
-       Show accounts and their balances.
-
-       The balance command is hledger's most versatile command.  Note, despite
-       the name, it is not always used for  showing  real-world  account  bal-
-       ances;  the  more accounting-aware balancesheet and incomestatement may
-       be more convenient for that.
-
-       By default, it displays all accounts, and each account's change in bal-
-       ance during the entire period of the journal.  Balance changes are cal-
-       culated by adding up the postings in each account.  You can  limit  the
-       postings  matched,  by  a  query, to see fewer accounts, changes over a
-       different time period, changes from only cleared transactions, etc.
-
-       If you include an account's complete history of postings in the report,
-       the  balance  change is equivalent to the account's current ending bal-
-       ance.  For a real-world account, typically you won't have all  transac-
-       tions in the journal; instead you'll have all transactions after a cer-
-       tain date, and an "opening balances" transaction  setting  the  correct
-       starting  balance  on  that  date.   Then the balance command will show
-       real-world account balances.  In some cases the -H/--historical flag is
-       used to ensure this (more below).
-
-       The balance command can produce several styles of report:
-
-   Classic balance report
-       This  is  the  original balance report, as found in Ledger.  It usually
-       looks like this:
-
-              $ hledger balance
-                               $-1  assets
-                                $1    bank:saving
-                               $-2    cash
-                                $2  expenses
-                                $1    food
-                                $1    supplies
-                               $-2  income
-                               $-1    gifts
-                               $-1    salary
-                                $1  liabilities:debts
-              --------------------
-                                 0
-
-       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.
-
-       "Boring" accounts, which contain a single interesting subaccount and no
-       balance of their own, are elided into the following line for more  com-
-       pact  output.  (Eg above, the "liabilities" account.) Use --no-elide to
-       prevent this.
-
-       Account balances are "inclusive" - they include  the  balances  of  any
-       subaccounts.
-
-       Accounts  which  have  zero  balance  (and no non-zero subaccounts) are
-       omitted.  Use -E/--empty to show them.
-
-       A final total is displayed by default; use  -N/--no-total  to  suppress
-       it, eg:
-
-              $ hledger balance -p 2008/6 expenses --no-total
-                                $2  expenses
-                                $1    food
-                                $1    supplies
-
-   Customising the classic balance report
-       You  can  customise the layout of classic balance reports with --format
-       FMT:
-
-              $ hledger balance --format "%20(account) %12(total)"
-                            assets          $-1
-                       bank:saving           $1
-                              cash          $-2
-                          expenses           $2
-                              food           $1
-                          supplies           $1
-                            income          $-2
-                             gifts          $-1
-                            salary          $-1
-                 liabilities:debts           $1
-              ---------------------------------
-                                              0
-
-       The FMT format string (plus a newline) specifies the formatting applied
-       to  each  account/balance pair.  It may contain any suitable text, with
-       data fields interpolated like so:
-
-       %[MIN][.MAX](FIELDNAME)
-
-       o MIN pads with spaces to at least this width (optional)
-
-       o MAX truncates at this width (optional)
-
-       o FIELDNAME must be enclosed in parentheses, and can be one of:
-
-         o depth_spacer - a number of spaces equal to the account's depth,  or
-           if MIN is specified, MIN * depth spaces.
-
-         o account - the account's name
-
-         o total - the account's balance/posted total, right justified
-
-       Also,  FMT  can begin with an optional prefix to control how multi-com-
-       modity amounts are rendered:
-
-       o %_ - render on multiple lines, bottom-aligned (the default)
-
-       o %^ - render on multiple lines, top-aligned
-
-       o %, - render on one line, comma-separated
-
-       There are some quirks.  Eg in one-line mode, %(depth_spacer) has no ef-
-       fect, instead %(account) has indentation built in.  Experimentation may
-       be needed to get pleasing results.
-
-       Some example formats:
-
-       o %(total) - the account's total
-
-       o %-20.20(account) - the account's name, left justified, padded  to  20
-         characters and clipped at 20 characters
-
-       o %,%-50(account)   %25(total)  - account name padded to 50 characters,
-         total padded to 20 characters, with multiple commodities rendered  on
-         one line
-
-       o %20(total)   %2(depth_spacer)%-(account) - the default format for the
-         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
-
-   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
-       this mode, you can also use --drop N to omit the first few account name
-       components.
-
-              $ hledger balance -p 2008/6 expenses -N --flat --drop 1
-                                $1  food
-                                $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
-       a complex set of accounts and get an overview.
-
-              $ hledger balance -N -1
-                               $-1  assets
-                                $2  expenses
-                               $-2  income
-                                $1  liabilities
-
-       Flat-mode balance reports, which normally show exclusive balances, show
-       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
-       obtain an overview of expenses:
-
-              $ hledger balance expenses -%
-                           100.0 %  expenses
-                            50.0 %    food
-                            50.0 %    supplies
-              --------------------
-                           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-
-       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
-       (eg hledger balance -B) all percentage values will be zero.
-
-       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-
-       terval.
-
-       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
-          for a monthly income statement:
-
-                  $ hledger balance --quarterly income expenses -E
-                  Balance changes in 2008:
-
-                                     ||  2008q1  2008q2  2008q3  2008q4
-                  ===================++=================================
-                   expenses:food     ||       0      $1       0       0
-                   expenses:supplies ||       0      $1       0       0
-                   income:gifts      ||       0     $-1       0       0
-                   income:salary     ||     $-1       0       0       0
-                  -------------------++---------------------------------
-                                     ||     $-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
-          the report start date:
-
-                  $ hledger balance --quarterly income expenses -E --cumulative
-                  Ending balances (cumulative) in 2008:
-
-                                     ||  2008/03/31  2008/06/30  2008/09/30  2008/12/31
-                  ===================++=================================================
-                   expenses:food     ||           0          $1          $1          $1
-                   expenses:supplies ||           0          $1          $1          $1
-                   income:gifts      ||           0         $-1         $-1         $-1
-                   income:salary     ||         $-1         $-1         $-1         $-1
-                  -------------------++-------------------------------------------------
-                                     ||         $-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
-          useful eg for a multi-period balance sheet, and when you are showing
-          only the data after a certain start date:
-
-                  $ hledger balance ^assets ^liabilities --quarterly --historical --begin 2008/4/1
-                  Ending balances (historical) in 2008/04/01-2008/12/31:
-
-                                        ||  2008/06/30  2008/09/30  2008/12/31
-                  ======================++=====================================
-                   assets:bank:checking ||          $1          $1           0
-                   assets:bank:saving   ||          $1          $1          $1
-                   assets:cash          ||         $-2         $-2         $-2
-                   liabilities:debts    ||           0           0          $1
-                  ----------------------++-------------------------------------
-                                        ||           0           0           0
-
-       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;
-       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
-       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:
-       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
-       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
-       row.
-
-       Here's an example of all three:
-
-              $ hledger balance -Q income expenses --tree -ETA
-              Balance changes in 2008:
-
-                          ||  2008q1  2008q2  2008q3  2008q4    Total  Average
-              ============++===================================================
-               expenses   ||       0      $2       0       0       $2       $1
-                 food     ||       0      $1       0       0       $1        0
-                 supplies ||       0      $1       0       0       $1        0
-               income     ||     $-1     $-1       0       0      $-2      $-1
-                 gifts    ||       0     $-1       0       0      $-1        0
-                 salary   ||     $-1       0       0       0      $-1        0
-              ------------++---------------------------------------------------
-                          ||     $-1      $1       0       0        0        0
-
-              # Average is rounded to the dollar here since all journal amounts are
-
-       Limitations:
-
-       In multicolumn reports the -V/--value flag uses the market price on the
-       report  end  date,  for all columns (not the price on each column's end
-       date).
-
-       Eliding of boring parent accounts in tree mode, as in the classic  bal-
-       ance report, is not yet supported in multicolumn reports.
-
-   Budget report
-       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
-       a report interval.
-
-       For  example,  you  can take average monthly expenses in the common ex-
-       pense categories to construct a minimal monthly budget:
-
-              ;; Budget
-              ~ monthly
-                income  $2000
-                expenses:food    $400
-                expenses:bus     $50
-                expenses:movies  $30
-                assets:bank:checking
-
-              ;; Two months worth of expenses
-              2017-11-01
-                income  $1950
-                expenses:food    $396
-                expenses:bus     $49
-                expenses:movies  $30
-                expenses:supplies  $20
-                assets:bank:checking
-
-              2017-12-01
-                income  $2100
-                expenses:food    $412
-                expenses:bus     $53
-                expenses:gifts   $100
-                assets:bank:checking
-
-       You can now see a monthly budget report:
-
-              $ hledger balance -M --budget
-              Budget performance in 2017/11/01-2017/12/31:
-
-                                    ||                      Nov                       Dec
-              ======================++====================================================
-               assets               || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480]
-               assets:bank          || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480]
-               assets:bank:checking || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480]
-               expenses             ||   $495 [ 103% of   $480]    $565 [ 118% of   $480]
-               expenses:bus         ||    $49 [  98% of    $50]     $53 [ 106% of    $50]
-               expenses:food        ||   $396 [  99% of   $400]    $412 [ 103% of   $400]
-               expenses:movies      ||    $30 [ 100% of    $30]       0 [   0% of    $30]
-               income               ||  $1950 [  98% of  $2000]   $2100 [ 105% of  $2000]
-              ----------------------++----------------------------------------------------
-                                    ||      0 [              0]       0 [              0]
-
-       Note this is different from a normal balance report in several ways:
-
-       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, budgeted
-         amounts are shown, along with the percentage of budget used.
-
-       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
-         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
-       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
-       ones, giving the full picture.  Eg:
-
-              $ hledger balance -M --budget --empty
-              Budget performance in 2017/11/01-2017/12/31:
-
-                                    ||                      Nov                       Dec
-              ======================++====================================================
-               assets               || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480]
-               assets:bank          || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480]
-               assets:bank:checking || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480]
-               expenses             ||   $495 [ 103% of   $480]    $565 [ 118% of   $480]
-               expenses:bus         ||    $49 [  98% of    $50]     $53 [ 106% of    $50]
-               expenses:food        ||   $396 [  99% of   $400]    $412 [ 103% of   $400]
-               expenses:gifts       ||      0                      $100
-               expenses:movies      ||    $30 [ 100% of    $30]       0 [   0% of    $30]
-               expenses:supplies    ||    $20                         0
-               income               ||  $1950 [  98% of  $2000]   $2100 [ 105% of  $2000]
-              ----------------------++----------------------------------------------------
-                                    ||      0 [              0]       0 [              0]
-
-       You can roll over unspent budgets to next period with --cumulative:
-
-              $ hledger balance -M --budget --cumulative
-              Budget performance in 2017/11/01-2017/12/31:
-
-                                    ||                      Nov                       Dec
-              ======================++====================================================
-               assets               || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960]
-               assets:bank          || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960]
-               assets:bank:checking || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960]
-               expenses             ||   $495 [ 103% of   $480]   $1060 [ 110% of   $960]
-               expenses:bus         ||    $49 [  98% of    $50]    $102 [ 102% of   $100]
-               expenses:food        ||   $396 [  99% of   $400]    $808 [ 101% of   $800]
-               expenses:movies      ||    $30 [ 100% of    $30]     $30 [  50% of    $60]
-               income               ||  $1950 [  98% of  $2000]   $4050 [ 101% of  $4000]
-              ----------------------++----------------------------------------------------
-                                    ||      0 [              0]       0 [              0]
-
-       For more examples, see Budgeting and Forecasting.
-
-   Nested budgets
-       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
-       parent, much like account balances behave.
-
-       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:
-
-              ~ monthly from 2019/01
-                  expenses:personal             $1,000.00
-                  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  implicity
-       means that budget for both expenses:personal and expenses is $1100.
-
-       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
-       only towards the budget of expenses:personal.
-
-       For example, let's consider these transactions:
-
-              ~ monthly from 2019/01
-                  expenses:personal             $1,000.00
-                  expenses:personal:electronics    $100.00
-                  liabilities
-
-              2019/01/01 Google home hub
-                  expenses:personal:electronics          $90.00
-                  liabilities                           $-90.00
-
-              2019/01/02 Phone screen protector
-                  expenses:personal:electronics:upgrades          $10.00
-                  liabilities
-
-              2019/01/02 Weekly train ticket
-                  expenses:personal:train tickets       $153.00
-                  liabilities
-
-              2019/01/03 Flowers
-                  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-
-       tions would be counted towards budgets of expenses:personal:electronics
-       and expenses:personal accordingly:
-
-              $ hledger balance --budget -M
-              Budget performance in 2019/01:
-
-                                             ||                           Jan
-              ===============================++===============================
-               expenses                      ||  $283.00 [  26% of  $1100.00]
-               expenses:personal             ||  $283.00 [  26% of  $1100.00]
-               expenses:personal:electronics ||  $100.00 [ 100% of   $100.00]
-               liabilities                   || $-283.00 [  26% of $-1100.00]
-              -------------------------------++-------------------------------
-                                             ||        0 [                 0]
-
-       And with --empty, we can get a better picture of budget allocation  and
-       consumption:
-
-              $ hledger balance --budget -M --empty
-              Budget performance in 2019/01:
-
-                                                      ||                           Jan
-              ========================================++===============================
-               expenses                               ||  $283.00 [  26% of  $1100.00]
-               expenses:personal                      ||  $283.00 [  26% of  $1100.00]
-               expenses:personal:electronics          ||  $100.00 [ 100% of   $100.00]
-               expenses:personal:electronics:upgrades ||   $10.00
-               expenses:personal:train tickets        ||  $153.00
-               liabilities                            || $-283.00 [  26% of $-1100.00]
-              ----------------------------------------++-------------------------------
-                                                      ||        0 [                 0]
-
-   Output format
-       The  balance  command supports output destination and output format se-
-       lection.
-
-   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).
-
-       Note  this  report shows all account balances with normal positive sign
-       (like conventional financial statements, unlike balance/print/register)
-       (experimental).
-
-       Example:
-
-              $ hledger balancesheet
-              Balance Sheet
-
-              Assets:
-                               $-1  assets
-                                $1    bank:saving
-                               $-2    cash
-              --------------------
-                               $-1
-
-              Liabilities:
-                                $1  liabilities:debts
-              --------------------
-                                $1
-
-              Total:
-              --------------------
-                                 0
-
-       With a reporting interval, multiple columns will be shown, one for each
-       report period.  As with multicolumn balance reports, you can alter  the
-       report  mode  with  --change/--cumulative/--historical.   Normally bal-
-       ancesheet shows historical ending balances, which is what you need  for
-       a  balance  sheet;  note  this means it ignores report begin dates (and
-       -T/--row-total, since summing end  balances  generally  does  not  make
-       sense).   Instead  of absolute values percentages can be displayed with
-       -%.
-
-       This command also supports output destination and output format  selec-
-       tion.
-
-   balancesheetequity
-       balancesheetequity, bse
-       Just  like  balancesheet,  but also reports Equity (which it assumes is
-       under a top-level equity account).
-
-       Example:
-
-              $ hledger balancesheetequity
-              Balance Sheet With Equity
-
-              Assets:
-                               $-2  assets
-                                $1    bank:saving
-                               $-3    cash
-              --------------------
-                               $-2
-
-              Liabilities:
-                                $1  liabilities:debts
-              --------------------
-                                $1
-
-              Equity:
-                        $1  equity:owner
-              --------------------
-                        $1
-
-              Total:
-              --------------------
-                                 0
-
-   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).
-
-       Example:
-
-              $ hledger cashflow
-              Cashflow Statement
-
-              Cash flows:
-                               $-1  assets
-                                $1    bank:saving
-                               $-2    cash
-              --------------------
-                               $-1
-
-              Total:
-              --------------------
-                               $-1
-
-       With a reporting interval, multiple columns will be shown, one for each
-       report period.  Normally cashflow shows changes in assets  per  period,
-       though  as  with  multicolumn  balance reports you can alter the report
-       mode with --change/--cumulative/--historical.  Instead of absolute val-
-       ues percentages can be displayed with -%.
-
-       This  command also supports output destination and output format selec-
-       tion.
-
-   check-dates
-       check-dates
-       Check that transactions are sorted by increasing date.   With  --date2,
-       checks  secondary  dates  instead.   With  --strict, dates must also be
-       unique.  With a query, only matched transactions'  dates  are  checked.
-       Reads the default journal file, or another specified with -f.
-
-   check-dupes
-       check-dupes
-       Reports  account names having the same leaf but different prefixes.  In
-       other words, two or  more  leaves  that  are  categorized  differently.
-       Reads the default journal file, or another specified as an argument.
-
-       An example: http://stefanorodighiero.net/software/hledger-dupes.html
-
-   close
-       close, equity
-       Prints  a  "closing  balances"  transaction  and  an "opening balances"
-       transaction that bring account balances to and from zero, respectively.
-       Useful for bringing asset/liability balances forward into a new journal
-       file, or for closing out revenues/expenses to retained earnings at  the
-       end of a period.
-
-       The  closing  transaction  transfers  balances  to "equity:closing bal-
-       ances", and  the  opening  transaction  transfers  balances  from  "eq-
-       uity:opening  balances", or you can customise these with the --close-to
-       and --open-from options.  You can choose  to  print  just  one  of  the
-       transactions by using the --opening or --closing flag.
-
-       If you split your journal files by time (eg yearly), you will typically
-       run this command at the end of the year, and save the closing  transac-
-       tion  as last entry of the old file, and the opening transaction as the
-       first entry of the new file.  This makes the files self  contained,  so
-       that  correct balances are reported no matter which of them are loaded.
-       Ie, if you load just one file, the balances are initialised  correctly;
-       or  if  you  load several files, the redundant closing/opening transac-
-       tions cancel each other out.  (They will show up in print  or  register
-       reports;  you  can  exclude  them  with  a  query like not:desc:'(open-
-       ing|closing) balances'.)
-
-       If you're running a business, you might also use this command to "close
-       the  books"  at  the  end  of an accounting period, transferring income
-       statement account balances to retained  earnings.   (You  may  want  to
-       change the equity account name to something like "equity:retained earn-
-       ings".)
-
-       By default, the closing transaction is dated  yesterday,  the  balances
-       are  calculated  as of end of yesterday, and the opening transaction is
-       dated today.  To close on some other date, use: hledger close -e  OPEN-
-       INGDATE.   Eg,  to  close/open  on the 2018/2019 boundary, use -e 2019.
-       You can also use -p or date:PERIOD (any starting date is ignored).
-
-       Both transactions will include balance assertions  for  the  closed/re-
-       opened accounts.  You probably shouldn't use status or realness filters
-       (like -C or -R or status:) with this command, or the generated  balance
-       assertions  will depend on these flags.  Likewise, if you run this com-
-       mand with --auto, the balance assertions will probably  always  require
-       --auto.
-
-       When  account  balances have cost information (transaction prices), the
-       closing/opening transactions will preserve it, so that  eg  balance  -B
-       reports will not be affected.
-
-       Examples:
-
-       Carrying  asset/liability  balances  into a new file for 2019, all from
-       command line:
-
-       Warning: we use >> here to append; be careful not to type  a  single  >
-       which would wipe your journal!
-
-              $ hledger close -f 2018.journal -e 2019 assets liabilities --opening >>2019.journal
-              $ hledger close -f 2018.journal -e 2019 assets liabilities --closing >>2018.journal
-
-       Now:
-
-              $ hledger bs -f 2019.journal                   # one file - balances are correct
-              $ hledger bs -f 2018.journal -f 2019.journal   # two files - balances still correct
-              $ hledger bs -f 2018.journal not:desc:closing  # to see year-end balances, must exclude closing txn
-
-       Transactions spanning the closing date can complicate matters, breaking
-       balance assertions:
-
-              2018/12/30 a purchase made in 2018, clearing the following year
-                  expenses:food          5
-                  assets:bank:checking  -5  ; [2019/1/2]
-
-       Here's one way to resolve that:
-
-              ; in 2018.journal:
-              2018/12/30 a purchase made in 2018, clearing the following year
-                  expenses:food          5
-                  liabilities:pending
-
-              ; in 2019.journal:
-              2019/1/2 clearance of last year's pending transactions
-                  liabilities:pending    5 = 0
-                  assets:checking
-
-   commodities
-       commodities
-       List all commodity/currency symbols used or declared in the journal.
-
-   descriptions
-       descriptions Show descriptions.
-
-       This command lists all descriptions that appear in transactions.
-
-       Examples:
-
-              $ hledger descriptions
-              Store Name
-              Gas Station | Petrol
-              Person A
-
-   diff
-       diff
-       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.)
-       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
-       the account balance, you can compare the bank data with your journal to
-       find out the cause.
-
-       Examples:
-
-              $ hledger diff -f $LEDGER_FILE -f bank.csv assets:bank:giro
-              These transactions are in the first file only:
-
-              2014/01/01 Opening Balances
-                  assets:bank:giro              EUR ...
-                  ...
-                  equity:opening balances       EUR -...
-
-              These transactions are in the second file only:
-
-   files
-       files
-       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
-       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
-       force a particular viewer with the --info, --man, --pager, --cat flags.
-
-       Examples:
-
-              $ hledger help
-              Please choose a manual by typing "hledger help MANUAL" (a substring is ok).
-              Manuals: hledger hledger-ui hledger-web journal csv timeclock timedot
-
-              $ hledger help h --man
-
-              hledger(1)                    hledger User Manuals                    hledger(1)
-
-              NAME
-                     hledger - a command-line accounting tool
-
-              SYNOPSIS
-                     hledger [-f FILE] COMMAND [OPTIONS] [ARGS]
-                     hledger [-f FILE] ADDONCMD -- [OPTIONS] [ARGS]
-                     hledger
-
-              DESCRIPTION
-                     hledger  is  a  cross-platform  program  for tracking money, time, or any
-              ...
-
-   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
-       FILEs' transactions as imported, without actually importing any.
-
-       The input files are specified as arguments - no need to write -f before
-       each one.  So eg to add new transactions from all CSV files to the main
-       journal, it's just: hledger import *.csv
-
-       New transactions are detected in the same way as print --new: by assum-
-       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
-       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
-       balance assignments (eg from an institution that provides only balances
-       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,
-       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 a simple income statement.  It currently assumes
-       that you have top-level accounts named income (or revenue) and  expense
-       (plural forms also allowed.)
-
-              $ hledger incomestatement
-              Income Statement
-
-              Revenues:
-                               $-2  income
-                               $-1    gifts
-                               $-1    salary
-              --------------------
-                               $-2
-
-              Expenses:
-                                $2  expenses
-                                $1    food
-                                $1    supplies
-              --------------------
-                                $2
-
-              Total:
-              --------------------
-                                 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-
-       lute values percentages can be displayed with -%.
-
-       This  command also supports output destination and output format selec-
-       tion.
-
-   notes
-       notes Show notes.
-
-       This command lists all notes that appear in transactions.
-
-       Examples:
-
-              $ hledger notes
-              Petrol
-              Snacks
-
-   payees
-       payees Show payee names.
-
-       This command lists all payee names that appear in transactions.
-
-       Examples:
-
-              $ hledger payees
-              Store Name
-              Gas Station
-              Person A
-
-   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.
-       Price amounts are always displayed with their full precision.
-
-   print
-       print, txns, p
-       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-
-       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-
-       rectives or inter-transaction comments
-
-              $ hledger print
-              2008/01/01 income
-                  assets:bank:checking            $1
-                  income:salary                  $-1
-
-              2008/06/01 gift
-                  assets:bank:checking            $1
-                  income:gifts                   $-1
-
-              2008/06/02 save
-                  assets:bank:saving              $1
-                  assets:bank:checking           $-1
-
-              2008/06/03 * eat & shop
-                  expenses:food                $1
-                  expenses:supplies            $1
-                  assets:cash                 $-2
-
-              2008/12/31 * pay off
-                  liabilities:debts               $1
-                  assets:bank:checking           $-1
-
-       Normally, the journal entry's explicit or implicit amount style is pre-
-       served.  Ie when an amount is omitted in the journal, it will be  omit-
-       ted  in  the  output.   You  can use the -x/--explicit flag to make all
-       amounts explicit, which can be useful for troubleshooting or for making
-       your journal more readable and robust against data entry errors.  Note,
-       -x will cause postings with a multi-commodity amount (these  can  arise
-       when  a  multi-commodity  transaction  has  an implicit amount) will be
-       split into multiple single-commodity postings, for valid  journal  out-
-       put.
-
-       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
-       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
-       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-
-       ordered.  See also the import command.
-
-       This  command also supports output destination and output format selec-
-       tion.  Here's an example of print's CSV output:
-
-              $ hledger print -Ocsv
-              "txnidx","date","date2","status","code","description","comment","account","amount","commodity","credit","debit","posting-status","posting-comment"
-              "1","2008/01/01","","","","income","","assets:bank:checking","1","$","","1","",""
-              "1","2008/01/01","","","","income","","income:salary","-1","$","1","","",""
-              "2","2008/06/01","","","","gift","","assets:bank:checking","1","$","","1","",""
-              "2","2008/06/01","","","","gift","","income:gifts","-1","$","1","","",""
-              "3","2008/06/02","","","","save","","assets:bank:saving","1","$","","1","",""
-              "3","2008/06/02","","","","save","","assets:bank:checking","-1","$","1","","",""
-              "4","2008/06/03","","*","","eat & shop","","expenses:food","1","$","","1","",""
-              "4","2008/06/03","","*","","eat & shop","","expenses:supplies","1","$","","1","",""
-              "4","2008/06/03","","*","","eat & shop","","assets:cash","-2","$","2","","",""
-              "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
-         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
-         order, etc.)
-
-       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
-         greater amounts under debit.)
-
-   print-unique
-       print-unique
-       Print transactions which do not reuse an already-seen description.
-
-       Example:
-
-              $ cat unique.journal
-              1/1 test
-               (acct:one)  1
-              2/2 test
-               (acct:two)  2
-              $ LEDGER_FILE=unique.journal hledger print-unique
-              (-f option not supported)
-              2015/01/01 test
-                  (acct:one)             1
-
-   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:
-
-              $ hledger register checking
-              2008/01/01 income               assets:bank:checking            $1           $1
-              2008/06/01 gift                 assets:bank:checking            $1           $2
-              2008/06/02 save                 assets:bank:checking           $-1           $1
-              2008/12/31 pay off              assets:bank:checking           $-1            0
-
-       With --date2, it shows and sorts by secondary date instead.
-
-       The --historical/-H flag adds the balance from  any  undisplayed  prior
-       postings  to  the  running  total.  This is useful when you want to see
-       only recent activity, with a historically accurate running balance:
-
-              $ hledger register checking -b 2008/6 --historical
-              2008/06/01 gift                 assets:bank:checking            $1           $2
-              2008/06/02 save                 assets:bank:checking           $-1           $1
-              2008/12/31 pay off              assets:bank:checking           $-1            0
-
-       The --depth option limits the amount of sub-account detail displayed.
-
-       The --average/-A flag shows the running average posting amount  instead
-       of the running total (so, the final number displayed is the average for
-       the whole report period).  This flag implies --empty (see  below).   It
-       is  affected  by --historical.  It works best when showing just one ac-
-       count and one commodity.
-
-       The --related/-r flag shows the other postings in the  transactions  of
-       the postings which would normally be shown.
-
-       The  --invert flag negates all amounts.  For example, it can be used on
-       an income account where amounts are normally displayed as negative num-
-       bers.   It's  also  useful to show postings on the checking account to-
-       gether with the related account:
-
-              $ hledger register --related --invert assets:checking
-
-       With a reporting interval, register shows summary postings, one per in-
-       terval, aggregating the postings to each account:
-
-              $ hledger register --monthly income
-              2008/01                 income:salary                          $-1          $-1
-              2008/06                 income:gifts                           $-1          $-2
-
-       Periods  with no activity, and summary postings with a zero amount, are
-       not shown by default; use the --empty/-E flag to see them:
-
-              $ hledger register --monthly income -E
-              2008/01                 income:salary                          $-1          $-1
-              2008/02                                                          0          $-1
-              2008/03                                                          0          $-1
-              2008/04                                                          0          $-1
-              2008/05                                                          0          $-1
-              2008/06                 income:gifts                           $-1          $-2
-              2008/07                                                          0          $-2
-              2008/08                                                          0          $-2
-              2008/09                                                          0          $-2
-              2008/10                                                          0          $-2
-              2008/11                                                          0          $-2
-              2008/12                                                          0          $-2
-
-       Often, you'll want to see just one line per interval.  The --depth  op-
-       tion helps with this, causing subaccounts to be aggregated:
-
-              $ hledger register --monthly assets --depth 1h
-              2008/01                 assets                                  $1           $1
-              2008/06                 assets                                 $-1            0
-              2008/12                 assets                                 $-1          $-1
-
-       Note  when using report intervals, if you specify start/end dates these
-       will be adjusted outward if necessary to contain a whole number of  in-
-       tervals.   This  ensures  that  the  first  and last intervals are full
-       length and comparable to the others in the report.
-
-   Custom register output
-       register uses the full terminal width by default,  except  on  windows.
-       You  can override this by setting the COLUMNS environment variable (not
-       a bash shell variable) or by using the --width/-w option.
-
-       The description and account columns normally share  the  space  equally
-       (about half of (width - 40) each).  You can adjust this by adding a de-
-       scription width as part of --width's argument, comma-separated: --width
-       W,D .  Here's a diagram (won't display correctly in --help):
-
-              <--------------------------------- width (W) ---------------------------------->
-              date (10)  description (D)       account (W-41-D)     amount (12)   balance (12)
-              DDDDDDDDDD dddddddddddddddddddd  aaaaaaaaaaaaaaaaaaa  AAAAAAAAAAAA  AAAAAAAAAAAA
-
-       and some examples:
-
-              $ hledger reg                     # use terminal width (or 80 on windows)
-              $ hledger reg -w 100              # use width 100
-              $ COLUMNS=100 hledger reg         # set with one-time environment variable
-              $ export COLUMNS=100; hledger reg # set till session end (or window resize)
-              $ hledger reg -w 100,40           # set overall width 100, description width 40
-              $ hledger reg -w $COLUMNS,40      # use terminal width, & description width 40
-
-       This  command also supports output destination and output format selec-
-       tion.
-
-   register-match
-       register-match
-       Print the one posting whose transaction description is closest to DESC,
-       in  the  style  of the register command.  If there are multiple equally
-       good matches, it shows the most recent.  Query  options  (options,  not
-       arguments)  can be used to restrict the search space.  Helps ledger-au-
-       tosync detect already-seen transactions when importing.
-
-   rewrite
-       rewrite
-       Print all transactions, rewriting the postings of matched transactions.
-       For  now  the only rewrite available is adding new postings, like print
-       --auto.
-
-       This is a start at a generic rewriter of transaction entries.  It reads
-       the  default  journal and prints the transactions, like print, but adds
-       one or more specified postings to any transactions matching QUERY.  The
-       posting  amounts can be fixed, or a multiplier of the existing transac-
-       tion's first posting amount.
-
-       Examples:
-
-              $ hledger-rewrite.hs ^income --add-posting '(liabilities:tax)  *.33  ; income tax' --add-posting '(reserve:gifts)  $100'
-              $ hledger-rewrite.hs expenses:gifts --add-posting '(reserve:gifts)  *-1"'
-              $ hledger-rewrite.hs -f rewrites.hledger
-
-       rewrites.hledger may consist of entries like:
-
-              = ^income amt:<0 date:2017
-                (liabilities:tax)  *0.33  ; tax on income
-                (reserve:grocery)  *0.25  ; reserve 25% for grocery
-                (reserve:)  *0.25  ; reserve 25% for grocery
-
-       Note the single quotes to protect the dollar sign from  bash,  and  the
-       two spaces between account and amount.
-
-       More:
-
-              $ hledger rewrite -- [QUERY]        --add-posting "ACCT  AMTEXPR" ...
-              $ hledger rewrite -- ^income        --add-posting '(liabilities:tax)  *.33'
-              $ hledger rewrite -- expenses:gifts --add-posting '(budget:gifts)  *-1"'
-              $ hledger rewrite -- ^income        --add-posting '(budget:foreign currency)  *0.25 JPY; diversify'
-
-       Argument  for  --add-posting  option  is a usual posting of transaction
-       with an exception for amount specification.  More  precisely,  you  can
-       use '*' (star symbol) before the amount to indicate that that this is a
-       factor for an amount of original matched posting.  If  the  amount  in-
-       cludes a commodity name, the new posting amount will be in the new com-
-       modity; otherwise, it will be in the matched posting  amount's  commod-
-       ity.
-
-   Re-write rules in a file
-       During  the  run  this  tool will execute so called "Automated Transac-
-       tions" found in any journal it process.  I.e instead of specifying this
-       operations in command line you can put them in a journal file.
-
-              $ rewrite-rules.journal
-
-       Make contents look like this:
-
-              = ^income
-                  (liabilities:tax)  *.33
-
-              = expenses:gifts
-                  budget:gifts  *-1
-                  assets:budget  *1
-
-       Note  that '=' (equality symbol) that is used instead of date in trans-
-       actions you usually write.  It indicates the query by which you want to
-       match the posting to add new ones.
-
-              $ hledger rewrite -- -f input.journal -f rewrite-rules.journal > rewritten-tidy-output.journal
-
-       This is something similar to the commands pipeline:
-
-              $ hledger rewrite -- -f input.journal '^income' --add-posting '(liabilities:tax)  *.33' \
-                | hledger rewrite -- -f - expenses:gifts      --add-posting 'budget:gifts  *-1'       \
-                                                              --add-posting 'assets:budget  *1'       \
-                > rewritten-tidy-output.journal
-
-       It  is  important  to understand that relative order of such entries in
-       journal is important.  You can re-use result of previously added  post-
-       ings.
-
-   Diff output format
-       To  use  this tool for batch modification of your journal files you may
-       find useful output in form of unified diff.
-
-              $ hledger rewrite -- --diff -f examples/sample.journal '^income' --add-posting '(liabilities:tax)  *.33'
-
-       Output might look like:
-
-              --- /tmp/examples/sample.journal
-              +++ /tmp/examples/sample.journal
-              @@ -18,3 +18,4 @@
-               2008/01/01 income
-              -    assets:bank:checking  $1
-              +    assets:bank:checking            $1
-                   income:salary
-              +    (liabilities:tax)                0
-              @@ -22,3 +23,4 @@
-               2008/06/01 gift
-              -    assets:bank:checking  $1
-              +    assets:bank:checking            $1
-                   income:gifts
-              +    (liabilities:tax)                0
-
-       If you'll pass this through patch tool you'll get transactions contain-
-       ing the posting that matches your query be updated.  Note that multiple
-       files might be update according to list of input  files  specified  via
-       --file options and include directives inside of these files.
-
-       Be  careful.  Whole transaction being re-formatted in a style of output
-       from hledger print.
-
-       See also:
-
-       https://github.com/simonmichael/hledger/issues/99
-
-   rewrite vs. print --auto
-       This command predates print --auto, and currently does  much  the  same
-       thing, but with these differences:
-
-       o with  multiple files, rewrite lets rules in any file affect all other
-         files.  print --auto uses standard directive  scoping;  rules  affect
-         only child files.
-
-       o rewrite's  query  limits which transactions can be rewritten; all are
-         printed.  print --auto's query limits which transactions are printed.
-
-       o rewrite applies rules specified on command line or  in  the  journal.
-         print --auto applies rules specified in the journal.
-
-   roi
-       roi
-       Shows  the  time-weighted (TWR) and money-weighted (IRR) rate of return
-       on your investments.
-
-       This command assumes that you have account(s)  that  hold  nothing  but
-       your investments and whenever you record current appraisal/valuation of
-       these investments you offset unrealized profit and loss into account(s)
-       that, again, hold nothing but unrealized profit and loss.
-
-       Any  transactions  affecting  balance  of investment account(s) and not
-       originating from unrealized profit and loss account(s) are  assumed  to
-       be your investments or withdrawals.
-
-       At  a  minimum,  you need to supply a query (which could be just an ac-
-       count name) to select your investments with --inv, and another query to
-       identify your profit and loss transactions with --pnl.
-
-       It  will  compute and display the internalized rate of return (IRR) and
-       time-weighted rate of return (TWR) for your investments  for  the  time
-       period  requested.  Both rates of return are annualized before display,
-       regardless of the length of reporting interval.
-
-   stats
-       stats
-       Show some journal statistics.
-
-       The stats command displays summary information for the  whole  journal,
-       or  a matched part of it.  With a reporting interval, it shows a report
-       for each report period.
-
-       Example:
-
-              $ hledger stats
-              Main journal file        : /src/hledger/examples/sample.journal
-              Included journal files   :
-              Transactions span        : 2008-01-01 to 2009-01-01 (366 days)
-              Last transaction         : 2008-12-31 (2333 days ago)
-              Transactions             : 5 (0.0 per day)
-              Transactions last 30 days: 0 (0.0 per day)
-              Transactions last 7 days : 0 (0.0 per day)
-              Payees/descriptions      : 5
-              Accounts                 : 8 (depth 3)
-              Commodities              : 1 ($)
-              Market prices            : 12 ($)
-
-       This command also supports output destination and output format  selec-
-       tion.
-
-   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.
-
-   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
-       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
-       as a bug!
-
-       This command also accepts tasty test runner options, written after a --
-       (double hyphen).  Eg to run only the tests in Hledger.Data.Amount, with
-       ANSI colour codes disabled:
-
-              $ hledger test -- -pData.Amount --color=never
-
-       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
-       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-
-       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
-       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
-         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;
-         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
-       options, journal parsing, reporting, etc.
-
-       Here are some hledger add-ons available:
-
-   Official add-ons
-       These are maintained and released along with hledger.
-
-   ui
-       hledger-ui provides an efficient terminal interface.
-
-   web
-       hledger-web provides a simple web interface.
-
-   Third party add-ons
-       These  are  maintained  separately, and usually updated shortly after a
-       hledger release.
-
-   diff
-       hledger-diff shows differences in an account's transactions between one
-       journal file and another.
-
-   iadd
-       hledger-iadd is a more interactive, terminal UI replacement for the add
-       command.
-
-   interest
-       hledger-interest generates interest transactions for an account accord-
-       ing to various schemes.
-
-   irr
-       hledger-irr calculates the internal rate of return of an investment ac-
-       count, but it's superseded now by the built-in roi command.
-
-   Experimental add-ons
-       These are available in source form in the hledger  repo's  bin/  direc-
-       tory.   They  may be less mature and documented than built-in commands.
-       Reading and tweaking these is a good way to start making your own!
-
-   autosync
-       hledger-autosync is a symbolic link for easily running ledger-autosync,
-       if  installed.   ledger-autosync  does  deduplicating conversion of OFX
-       data and some CSV formats, and can also download the data if your  bank
-       offers OFX Direct Connect.
-
-   chart
-       hledger-chart.hs is an old pie chart generator, in need of some love.
-
-   check
-       hledger-check.hs checks more powerful account balance assertions.
-
-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).
-
-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
-       C:/Users/USER/.hledger.journal).
-
-LIMITATIONS
-       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
-       must be configured (or there will be an unhelpful error).  Eg on POSIX,
-       set LANG to something other than C.
-
-       In a Microsoft Windows CMD window, non-ascii characters and colours are
-       not supported.
-
-       On Windows, non-ascii characters may not display correctly when running
-       a hledger built in CMD in MSYS/CYGWIN, or vice-versa.
-
-       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
-       differences.
-
-       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
-       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,
-       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
-       need to use export.  Here's an explanation.
-
-       "Illegal  byte  sequence"  or  "Invalid or incomplete multibyte or wide
-       character" errors
-       In order to handle non-ascii letters and symbols (like ), hledger needs
-       an appropriate locale.  This is usually configured system-wide; you can
-       also configure it temporarily.  The locale may need to be one that sup-
-       ports  UTF-8,  if you built hledger with GHC < 7.2 (or possibly always,
-       I'm not sure yet).
-
-       Here's  an  example  of  setting  the  locale  temporarily,  on  ubuntu
-       gnu/linux:
-
-              $ file my.journal
-              my.journal: UTF-8 Unicode text                 # <- the file is UTF8-encoded
-              $ locale -a
-              C
-              en_US.utf8                             # <- a UTF8-aware locale is available
-              POSIX
-              $ LANG=en_US.utf8 hledger -f my.journal print   # <- use it for this command
-
-       Here's one way to set it permanently, there are probably better ways:
-
-              $ echo "export LANG=en_US.UTF-8" >>~/.bash_profile
-              $ bash --login
-
-       If  we  preferred  to  use eg fr_FR.utf8, we might have to install that
-       first:
-
-              $ apt-get install language-pack-fr
-              $ locale -a
-              C
-              en_US.utf8
-              fr_BE.utf8
-              fr_CA.utf8
-              fr_CH.utf8
-              fr_FR.utf8
-              fr_LU.utf8
-              POSIX
-              $ LANG=fr_FR.utf8 hledger -f my.journal print
-
-       Note some platforms allow variant locale spellings, but not all (ubuntu
-       accepts fr_FR.UTF8, mac osx requires exactly fr_FR.UTF-8).
-
-
-
-REPORTING BUGS
-       Report  bugs at http://bugs.hledger.org (or on the #hledger IRC channel
-       or hledger mail list)
-
-
-AUTHORS
-       Simon Michael <simon@joyful.com> and contributors
-
-
-COPYRIGHT
-       Copyright (C) 2007-2019 Simon Michael.
-       Released under GNU GPL v3 or later.
-
-
-SEE ALSO
-       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)
-
-       http://hledger.org
-
-
-
-hledger 1.16.2                   January 2020                       hledger(1)
+       hledger  is  a  reliable,  cross-platform  set of programs for tracking
+       money, time, or any other commodity, using double-entry accounting  and
+       a  simple,  editable  file  format.  hledger is inspired by and largely
+       compatible with ledger(1).
+
+       This is hledger's command-line interface (there are also  terminal  and
+       web  interfaces).   Its basic function is to read a plain text file de-
+       scribing financial transactions (in accounting terms, a  general  jour-
+       nal)  and  print  useful  reports on standard output, or export them as
+       CSV.  hledger can also read some other file formats such as CSV  files,
+       translating  them to journal format.  Additionally, hledger lists other
+       hledger-* executables found in the user's $PATH and can invoke them  as
+       subcommands.
+
+       hledger  reads  data  from  one or more files in hledger journal, time-
+       clock, timedot, or CSV format specified with -f,  or  $LEDGER_FILE,  or
+       $HOME/.hledger.journal           (on          windows,          perhaps
+       C:/Users/USER/.hledger.journal).  If using $LEDGER_FILE, note this must
+       be  a real environment variable, not a shell variable.  You can specify
+       standard input with -f-.
+
+       Transactions are dated movements of money between two (or  more)  named
+       accounts, and are recorded with journal entries like this:
+
+              2015/10/16 bought food
+               expenses:food          $10
+               assets:cash
+
+       For more about this format, see hledger_journal(5).
+
+       Most  users use a text editor to edit the journal, usually with an edi-
+       tor mode such as ledger-mode for added convenience.  hledger's interac-
+       tive  add  command  is another way to record new transactions.  hledger
+       never changes existing transactions.
+
+       To get started, you can either save some  entries  like  the  above  in
+       ~/.hledger.journal,  or  run  hledger add and follow the prompts.  Then
+       try some commands like hledger print or hledger balance.   Run  hledger
+       with no arguments for a list of commands.
+
+COMMON TASKS
+       Here  are  some  quick  examples  of  how  to  do some basic tasks with
+       hledger.  For more  details,  see  the  reference  section  below,  the
+       hledger_journal(5)    manual,   or   the   more   extensive   docs   at
+       https://hledger.org.
+
+   Getting help
+              $ hledger                 # show available commands
+              $ hledger --help          # show common options
+              $ hledger CMD --help      # show common and command options, and command help
+              $ hledger help            # show available manuals/topics
+              $ hledger help hledger    # show hledger manual as info/man/text (auto-chosen)
+              $ hledger help journal --man  # show the journal manual as a man page
+              $ hledger help --help     # show more detailed help for the help command
+
+       Find   more   docs,   chat,   mail   list,   reddit,   issue   tracker:
+       https://hledger.org#help-feedback
+
+   Constructing command lines
+       hledger  has  an  extensive  and  powerful  command line interface.  We
+       strive to keep it simple and ergonomic, but you may run into one of the
+       confusing real world details described in OPTIONS, below.  If that hap-
+       pens, here are some tips that may help:
+
+       o command-specific options must go after the command (it's fine to  put
+         all options there) (hledger CMD OPTS ARGS)
+
+       o running  add-on  executables directly simplifies command line parsing
+         (hledger-ui OPTS ARGS)
+
+       o enclose "problematic" args in single quotes
+
+       o if needed, also add a backslash to hide regular expression  metachar-
+         acters from the shell
+
+       o to see how a misbehaving command is being parsed, add --debug=2.
+
+   Starting a journal file
+       hledger   looks   for   your   accounting   data  in  a  journal  file,
+       $HOME/.hledger.journal by default:
+
+              $ hledger stats
+              The hledger journal file "/Users/simon/.hledger.journal" was not found.
+              Please create it first, eg with "hledger add" or a text editor.
+              Or, specify an existing journal file with -f or LEDGER_FILE.
+
+       You can override this by setting the LEDGER_FILE environment  variable.
+       It's a good practice to keep this important file under version control,
+       and to start a new file each year.  So  you  could  do  something  like
+       this:
+
+              $ mkdir ~/finance
+              $ cd ~/finance
+              $ git init
+              Initialized empty Git repository in /Users/simon/finance/.git/
+              $ touch 2020.journal
+              $ echo "export LEDGER_FILE=$HOME/finance/2020.journal" >> ~/.bashrc
+              $ source ~/.bashrc
+              $ hledger stats
+              Main file                : /Users/simon/finance/2020.journal
+              Included files           :
+              Transactions span        :  to  (0 days)
+              Last transaction         : none
+              Transactions             : 0 (0.0 per day)
+              Transactions last 30 days: 0 (0.0 per day)
+              Transactions last 7 days : 0 (0.0 per day)
+              Payees/descriptions      : 0
+              Accounts                 : 0 (depth 0)
+              Commodities              : 0 ()
+              Market prices            : 0 ()
+
+   Setting opening balances
+       Pick  a  starting  date  for which you can look up the balances of some
+       real-world assets (bank accounts,  wallet..)  and  liabilities  (credit
+       cards..).
+
+       To  avoid  a  lot of data entry, you may want to start with just one or
+       two accounts, like your checking account or cash wallet; and pick a re-
+       cent  starting  date, like today or the start of the week.  You can al-
+       ways come back later and add more accounts and older  transactions,  eg
+       going back to january 1st.
+
+       Add  an opening balances transaction to the journal, declaring the bal-
+       ances on this date.  Here are two ways to do it:
+
+       o The first way: open the journal in any text editor and save an  entry
+         like this:
+
+                2020-01-01 * opening balances
+                    assets:bank:checking                $1000   = $1000
+                    assets:bank:savings                 $2000   = $2000
+                    assets:cash                          $100   = $100
+                    liabilities:creditcard               $-50   = $-50
+                    equity:opening/closing balances
+
+         These  are  start-of-day  balances, ie whatever was in the account at
+         the end of the previous day.
+
+         The * after the date is an  optional  status  flag.   Here  it  means
+         "cleared & confirmed".
+
+         The  currency symbols are optional, but usually a good idea as you'll
+         be dealing with multiple currencies sooner or later.
+
+         The = amounts are optional balance assertions, providing extra  error
+         checking.
+
+       o The  second  way:  run hledger add and follow the prompts to record a
+         similar transaction:
+
+                $ hledger add
+                Adding transactions to journal file /Users/simon/finance/2020.journal
+                Any command line arguments will be used as defaults.
+                Use tab key to complete, readline keys to edit, enter to accept defaults.
+                An optional (CODE) may follow transaction dates.
+                An optional ; COMMENT may follow descriptions or amounts.
+                If you make a mistake, enter < at any prompt to go one step backward.
+                To end a transaction, enter . when prompted.
+                To quit, enter . at a date prompt or press control-d or control-c.
+                Date [2020-02-07]: 2020-01-01
+                Description: * opening balances
+                Account 1: assets:bank:checking
+                Amount  1: $1000
+                Account 2: assets:bank:savings
+                Amount  2 [$-1000]: $2000
+                Account 3: assets:cash
+                Amount  3 [$-3000]: $100
+                Account 4: liabilities:creditcard
+                Amount  4 [$-3100]: $-50
+                Account 5: equity:opening/closing balances
+                Amount  5 [$-3050]:
+                Account 6 (or . or enter to finish this transaction): .
+                2020-01-01 * opening balances
+                    assets:bank:checking                      $1000
+                    assets:bank:savings                       $2000
+                    assets:cash                                $100
+                    liabilities:creditcard                     $-50
+                    equity:opening/closing balances          $-3050
+
+                Save this transaction to the journal ? [y]:
+                Saved.
+                Starting the next transaction (. or ctrl-D/ctrl-C to quit)
+                Date [2020-01-01]: .
+
+       If you're using version control, this could be a good  time  to  commit
+       the journal.  Eg:
+
+              $ git commit -m 'initial balances' 2020.journal
+
+   Recording transactions
+       As  you spend or receive money, you can record these transactions using
+       one of the methods above (text editor, hledger add)  or  by  using  the
+       hledger-iadd  or hledger-web add-ons, or by using the import command to
+       convert CSV data downloaded from your bank.
+
+       Here are some simple transactions, see  the  hledger_journal(5)  manual
+       and hledger.org for more ideas:
+
+              2020/1/10 * gift received
+                assets:cash   $20
+                income:gifts
+
+              2020.1.12 * farmers market
+                expenses:food    $13
+                assets:cash
+
+              2020-01-15 paycheck
+                income:salary
+                assets:bank:checking    $1000
+
+   Reconciling
+       Periodically  you should reconcile - compare your hledger-reported bal-
+       ances against external sources of truth, like bank statements  or  your
+       bank's  website - to be sure that your ledger accurately represents the
+       real-world balances (and, that the  real-world  institutions  have  not
+       made  a  mistake!).   This gets easy and fast with (1) practice and (2)
+       frequency.  If you do it daily, it can take 2-10 minutes.  If  you  let
+       it  pile  up, expect it to take longer as you hunt down errors and dis-
+       crepancies.
+
+       A typical workflow:
+
+       1. Reconcile cash.  Count what's in your  wallet.   Compare  with  what
+          hledger  reports  (hledger bal cash).  If they are different, try to
+          remember the missing transaction, or look for the error in  the  al-
+          ready-recorded  transactions.   A  register  report  can  be helpful
+          (hledger reg cash).  If you can't find the error, add an  adjustment
+          transaction.  Eg if you have $105 after the above, and can't explain
+          the missing $2, it could be:
+
+                  2020-01-16 * adjust cash
+                      assets:cash    $-2 = $105
+                      expenses:misc
+
+       2. Reconcile checking.  Log in to your bank's website.  Compare today's
+          (cleared) balance with hledger's cleared balance (hledger bal check-
+          ing -C).  If they are different, track down the error or record  the
+          missing  transaction(s) or add an adjustment transaction, similar to
+          the above.  Unlike the cash case, you can usually compare the trans-
+          action  history  and running balance from your bank with the one re-
+          ported by hledger reg checking -C.  This will be easier if you  gen-
+          erally  record transaction dates quite similar to your bank's clear-
+          ing dates.
+
+       3. Repeat for other asset/liability accounts.
+
+       Tip: instead of the register command, use hledger-ui to see a  live-up-
+       dating register while you edit the journal: hledger-ui --watch --regis-
+       ter checking -C
+
+       After reconciling, it could be a  good  time  to  mark  the  reconciled
+       transactions'  status  as "cleared and confirmed", if you want to track
+       that, by adding the * marker.  Eg in the  paycheck  transaction  above,
+       insert * between 2020-01-15 and paycheck
+
+       If  you're using version control, this can be another good time to com-
+       mit:
+
+              $ git commit -m 'txns' 2020.journal
+
+   Reporting
+       Here are some basic reports.
+
+       Show all transactions:
+
+              $ hledger print
+              2020-01-01 * opening balances
+                  assets:bank:checking                      $1000
+                  assets:bank:savings                       $2000
+                  assets:cash                                $100
+                  liabilities:creditcard                     $-50
+                  equity:opening/closing balances          $-3050
+
+              2020-01-10 * gift received
+                  assets:cash              $20
+                  income:gifts
+
+              2020-01-12 * farmers market
+                  expenses:food             $13
+                  assets:cash
+
+              2020-01-15 * paycheck
+                  income:salary
+                  assets:bank:checking           $1000
+
+              2020-01-16 * adjust cash
+                  assets:cash               $-2 = $105
+                  expenses:misc
+
+       Show account names, and their hierarchy:
+
+              $ hledger accounts --tree
+              assets
+                bank
+                  checking
+                  savings
+                cash
+              equity
+                opening/closing balances
+              expenses
+                food
+                misc
+              income
+                gifts
+                salary
+              liabilities
+                creditcard
+
+       Show all account totals:
+
+              $ hledger balance
+                             $4105  assets
+                             $4000    bank
+                             $2000      checking
+                             $2000      savings
+                              $105    cash
+                            $-3050  equity:opening/closing balances
+                               $15  expenses
+                               $13    food
+                                $2    misc
+                            $-1020  income
+                              $-20    gifts
+                            $-1000    salary
+                              $-50  liabilities:creditcard
+              --------------------
+                                 0
+
+       Show only asset and liability balances, as  a  flat  list,  limited  to
+       depth 2:
+
+              $ hledger bal assets liabilities --flat -2
+                             $4000  assets:bank
+                              $105  assets:cash
+                              $-50  liabilities:creditcard
+              --------------------
+                             $4055
+
+       Show  the  same  thing  without negative numbers, formatted as a simple
+       balance sheet:
+
+              $ hledger bs --flat -2
+              Balance Sheet 2020-01-16
+
+                                      || 2020-01-16
+              ========================++============
+               Assets                 ||
+              ------------------------++------------
+               assets:bank            ||      $4000
+               assets:cash            ||       $105
+              ------------------------++------------
+                                      ||      $4105
+              ========================++============
+               Liabilities            ||
+              ------------------------++------------
+               liabilities:creditcard ||        $50
+              ------------------------++------------
+                                      ||        $50
+              ========================++============
+               Net:                   ||      $4055
+
+       The final total is your "net worth" on the end date.  (Or use bse for a
+       full balance sheet with equity.)
+
+       Show income and expense totals, formatted as an income statement:
+
+              hledger is
+              Income Statement 2020-01-01-2020-01-16
+
+                             || 2020-01-01-2020-01-16
+              ===============++=======================
+               Revenues      ||
+              ---------------++-----------------------
+               income:gifts  ||                   $20
+               income:salary ||                 $1000
+              ---------------++-----------------------
+                             ||                 $1020
+              ===============++=======================
+               Expenses      ||
+              ---------------++-----------------------
+               expenses:food ||                   $13
+               expenses:misc ||                    $2
+              ---------------++-----------------------
+                             ||                   $15
+              ===============++=======================
+               Net:          ||                 $1005
+
+       The final total is your net income during this period.
+
+       Show transactions affecting your wallet, with running total:
+
+              $ hledger register cash
+              2020-01-01 opening balances     assets:cash                   $100          $100
+              2020-01-10 gift received        assets:cash                    $20          $120
+              2020-01-12 farmers market       assets:cash                   $-13          $107
+              2020-01-16 adjust cash          assets:cash                    $-2          $105
+
+       Show weekly posting counts as a bar chart:
+
+              $ hledger activity -W
+              2019-12-30 *****
+              2020-01-06 ****
+              2020-01-13 ****
+
+   Migrating to a new file
+       At  the end of the year, you may want to continue your journal in a new
+       file, so that old transactions don't slow down or clutter your reports,
+       and  to  help ensure the integrity of your accounting history.  See the
+       close command.
+
+       If using version control, don't forget to git add the new file.
+
+OPTIONS
+   General options
+       To see general usage help, including general  options  which  are  sup-
+       ported by most hledger commands, run hledger -h.
+
+       General help options:
+
+       -h --help
+              show general usage (or after COMMAND, command usage)
+
+       --version
+              show version
+
+       --debug[=N]
+              show debug output (levels 1-9, default: 1)
+
+       General input options:
+
+       -f FILE --file=FILE
+              use  a  different  input  file.   For  stdin,  use  -  (default:
+              $LEDGER_FILE or $HOME/.hledger.journal)
+
+       --rules-file=RULESFILE
+              Conversion  rules  file  to  use  when  reading  CSV   (default:
+              FILE.rules)
+
+       --separator=CHAR
+              Field separator to expect when reading CSV (default: ',')
+
+       --alias=OLD=NEW
+              rename accounts named OLD to NEW
+
+       --anon anonymize accounts and payees
+
+       --pivot FIELDNAME
+              use some other field or tag for the account name
+
+       -I --ignore-assertions
+              disable balance assertion checks (note: does not disable balance
+              assignments)
+
+       General reporting options:
+
+       -b --begin=DATE
+              include postings/txns on or after this date
+
+       -e --end=DATE
+              include postings/txns before this date
+
+       -D --daily
+              multiperiod/multicolumn report by day
+
+       -W --weekly
+              multiperiod/multicolumn report by week
+
+       -M --monthly
+              multiperiod/multicolumn report by month
+
+       -Q --quarterly
+              multiperiod/multicolumn report by quarter
+
+       -Y --yearly
+              multiperiod/multicolumn report by year
+
+       -p --period=PERIODEXP
+              set start date, end date, and/or reporting interval all at  once
+              using period expressions syntax
+
+       --date2
+              match the secondary date instead (see command help for other ef-
+              fects)
+
+       -U --unmarked
+              include only unmarked postings/txns (can combine with -P or -C)
+
+       -P --pending
+              include only pending postings/txns
+
+       -C --cleared
+              include only cleared postings/txns
+
+       -R --real
+              include only non-virtual postings
+
+       -NUM --depth=NUM
+              hide/aggregate accounts or postings more than NUM levels deep
+
+       -E --empty
+              show items with zero amount, normally hidden (and vice-versa  in
+              hledger-ui/hledger-web)
+
+       -B --cost
+              convert  amounts  to  their  cost at transaction time (using the
+              transaction price, if any)
+
+       -V --value
+              convert amounts to their market value on  the  report  end  date
+              (using the most recent applicable market price, if any)
+
+       --auto apply automated posting rules to modify transactions.
+
+       --forecast
+              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.
+
+       When a reporting option appears more than once in the command line, the
+       last one takes precedence.
+
+       Some reporting options can also be written as query arguments.
+
+   Command options
+       To see options for a particular command, including command-specific op-
+       tions, run: hledger COMMAND -h.
+
+       Command-specific  options  must  be written after the command name, eg:
+       hledger print -x.
+
+       Additionally, if the command is an addon, you may need to put  its  op-
+       tions  after  a  double-hyphen, eg: hledger ui -- --watch.  Or, you can
+       run the addon executable directly: hledger-ui --watch.
+
+   Command arguments
+       Most hledger commands accept arguments after the  command  name,  which
+       are often a query, filtering the data in some way.
+
+       You  can  save  a  set of command line options/arguments in a file, and
+       then reuse them by writing @FILENAME as a command line  argument.   Eg:
+       hledger  bal  @foo.args.   (To prevent this, eg if you have an argument
+       that begins with a literal @, precede it with --, eg:  hledger  bal  --
+       @ARG).
+
+       Inside  the  argument file, each line should contain just one option or
+       argument.  Avoid the use of spaces, except inside quotes (or you'll see
+       a  confusing  error).  Between a flag and its argument, use = (or noth-
+       ing).  Bad:
+
+              assets depth:2
+              -X USD
+
+       Good:
+
+              assets
+              depth:2
+              -X=USD
+
+       For special characters (see below), use one less level of quoting  than
+       you would at the command prompt.  Bad:
+
+              -X"$"
+
+       Good:
+
+              -X$
+
+       See also: Save frequently used options.
+
+   Queries
+       One  of  hledger's strengths is being able to quickly report on precise
+       subsets of your data.  Most commands accept an optional  query  expres-
+       sion,  written  as arguments after the command name, to filter the data
+       by date, account name or other criteria.  The syntax is  similar  to  a
+       web search: one or more space-separated search terms, quotes to enclose
+       whitespace, prefixes to match specific fields, a not: prefix to  negate
+       the match.
+
+       We  do  not yet support arbitrary boolean combinations of search terms;
+       instead most commands show transactions/postings/accounts  which  match
+       (or negatively match):
+
+       o any of the description terms AND
+
+       o any of the account terms AND
+
+       o any of the status terms AND
+
+       o all the other terms.
+
+       The print command instead shows transactions which:
+
+       o match any of the description terms AND
+
+       o have any postings matching any of the positive account terms AND
+
+       o have no postings matching any of the negative account terms AND
+
+       o match all the other terms.
+
+       The  following  kinds  of search terms can be used.  Remember these can
+       also be prefixed with not:, eg to exclude a particular subaccount.
+
+       REGEX, acct:REGEX
+              match account names by this regular expression.  (With  no  pre-
+              fix, acct: is assumed.)  same as above
+
+       amt:N, amt:<N, amt:<=N, amt:>N, amt:>=N
+              match  postings with a single-commodity amount that is equal to,
+              less than, or greater than N.  (Multi-commodity amounts are  not
+              tested, and will always match.) The comparison has two modes: if
+              N is preceded by a + or - sign (or is 0), the two signed numbers
+              are  compared.  Otherwise, the absolute magnitudes are compared,
+              ignoring sign.
+
+       code:REGEX
+              match by transaction code (eg check number)
+
+       cur:REGEX
+              match postings or transactions including any amounts whose  cur-
+              rency/commodity  symbol  is fully matched by REGEX.  (For a par-
+              tial match, use .*REGEX.*).  Note, to match characters which are
+              regex-significant, like the dollar sign ($), you need to prepend
+              \.  And when using the command line you need  to  add  one  more
+              level  of  quoting  to hide it from the shell, so eg do: hledger
+              print cur:'\$' or hledger print cur:\\$.
+
+       desc:REGEX
+              match transaction descriptions.
+
+       date:PERIODEXPR
+              match dates within the specified period.  PERIODEXPR is a period
+              expression  (with  no  report  interval).   Examples: date:2016,
+              date:thismonth,  date:2000/2/1-2/15,  date:lastweek-.   If   the
+              --date2  command  line  flag  is present, this matches secondary
+              dates instead.
+
+       date2:PERIODEXPR
+              match secondary dates within the specified period.
+
+       depth:N
+              match (or display, depending on command) accounts  at  or  above
+              this depth
+
+       note:REGEX
+              match  transaction  notes  (part  of  description right of |, or
+              whole description when there's no |)
+
+       payee:REGEX
+              match transaction payee/payer names (part of description left of
+              |, or whole description when there's no |)
+
+       real:, real:0
+              match real or virtual postings respectively
+
+       status:, status:!, status:*
+              match unmarked, pending, or cleared transactions respectively
+
+       tag:REGEX[=REGEX]
+              match  by  tag  name,  and optionally also by tag value.  Note a
+              tag: query is considered to match a transaction  if  it  matches
+              any  of  the  postings.  Also remember that postings inherit the
+              tags of their parent transaction.
+
+       The following special search term is used automatically in hledger-web,
+       only:
+
+       inacct:ACCTNAME
+              tells  hledger-web to show the transaction register for this ac-
+              count.  Can be filtered further with acct etc.
+
+       Some of these can also be expressed as command-line options (eg depth:2
+       is  equivalent  to --depth 2).  Generally you can mix options and query
+       arguments, and the resulting query will be their intersection  (perhaps
+       excluding the -p/--period option).
+
+   Special characters in arguments and queries
+       In shell command lines, option and argument values which contain "prob-
+       lematic" characters, ie spaces, and also characters significant to your
+       shell  such as <, >, (, ), | and $, should be escaped by enclosing them
+       in quotes or by writing backslashes before the characters.  Eg:
+
+       hledger  register  -p  'last  year'   "accounts   receivable   (receiv-
+       able|payable)" amt:\>100.
+
+   More escaping
+       Characters significant both to the shell and in regular expressions may
+       need one extra level of escaping.  These include parentheses, the  pipe
+       symbol and the dollar sign.  Eg, to match the dollar symbol, bash users
+       should do:
+
+       hledger balance cur:'\$'
+
+       or:
+
+       hledger balance cur:\\$
+
+   Even more escaping
+       When hledger runs an addon executable (eg you type hledger ui,  hledger
+       runs  hledger-ui),  it  de-escapes  command-line  options and arguments
+       once, so you might need to triple-escape.  Eg in bash, running  the  ui
+       command and matching the dollar sign, it's:
+
+       hledger ui cur:'\\$'
+
+       or:
+
+       hledger ui cur:\\\\$
+
+       If you asked why four slashes above, this may help:
+
+       unescaped:        $
+       escaped:          \$
+       double-escaped:   \\$
+       triple-escaped:   \\\\$
+
+       (The number of backslashes in fish shell is left as an exercise for the
+       reader.)
+
+       You can always avoid the extra escaping for addons by running the addon
+       directly:
+
+       hledger-ui cur:\\$
+
+   Less escaping
+       Inside  an  argument  file,  or  in  the  search field of hledger-ui or
+       hledger-web, or at a GHCI prompt, you need one less level  of  escaping
+       than at the command line.  And backslashes may work better than quotes.
+       Eg:
+
+       ghci> :main balance cur:\$
+
+   Unicode characters
+       hledger is expected to handle non-ascii characters correctly:
+
+       o they should be parsed correctly in input files  and  on  the  command
+         line,  by all hledger tools (add, iadd, hledger-web's search/add/edit
+         forms, etc.)
+
+       o they should be displayed correctly by  all  hledger  tools,  and  on-
+         screen alignment should be preserved.
+
+       This requires a well-configured environment.  Here are some tips:
+
+       o A  system  locale must be configured, and it must be one that can de-
+         code the characters being used.  In bash, you can set a  locale  like
+         this:  export LANG=en_US.UTF-8.  There are some more details in Trou-
+         bleshooting.  This step is essential - without it, hledger will  quit
+         on  encountering a non-ascii character (as with all GHC-compiled pro-
+         grams).
+
+       o your terminal software (eg  Terminal.app,  iTerm,  CMD.exe,  xterm..)
+         must support unicode
+
+       o the terminal must be using a font which includes the required unicode
+         glyphs
+
+       o the terminal should be configured to display wide characters as  dou-
+         ble width (for report alignment)
+
+       o on  Windows, for best results you should run hledger in the same kind
+         of environment in which it was built.  Eg hledger built in the  stan-
+         dard  CMD.EXE  environment  (like  the binaries on our download page)
+         might show display problems when run in a cygwin  or  msys  terminal,
+         and vice versa.  (See eg #961).
+
+   Input files
+       hledger reads transactions from a data file (and the add command writes
+       to it).  By default this file is $HOME/.hledger.journal (or on Windows,
+       something  like C:/Users/USER/.hledger.journal).  You can override this
+       with the $LEDGER_FILE environment variable:
+
+              $ setenv LEDGER_FILE ~/finance/2016.journal
+              $ hledger stats
+
+       or with the -f/--file option:
+
+              $ hledger -f /some/file stats
+
+       The file name - (hyphen) means standard input:
+
+              $ 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:
+
+       Reader:    Reads:                            Used for file extensions:
+       -----------------------------------------------------------------------------
+       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)
+
+       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 -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:
+
+       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.
+
+   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:
+
+              $ hledger print > foo.txt
+
+       Some commands (print, register, stats, the balance commands) also  pro-
+       vide  the  -o/--output-file  option,  which does the same thing without
+       needing the shell.  Eg:
+
+              $ hledger print -o foo.txt
+              $ hledger print -o -        # write to stdout (the default)
+
+   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:
+
+              $ hledger print -O csv
+
+       or, by a file extension specified with -o/--output-file:
+
+              $ hledger balancesheet -o foo.html   # write HTML to foo.html
+
+       The -O option can be used to override the file extension if needed:
+
+              $ hledger balancesheet -o foo.txt -O html   # write HTML to foo.txt
+
+       Some notes about JSON output:
+
+       o This  feature  is  marked  experimental,  and  not yet much used; you
+         should expect our JSON to evolve.  Real-world feedback is welcome.
+
+       o Our JSON is rather large and verbose, as it is quite a faithful  rep-
+         resentation  of  hledger's  internal  data  types.  To understand the
+         JSON,  read  the  Haskell  type  definitions,  which  are  mostly  in
+         https://github.com/simonmichael/hledger/blob/master/hledger-
+         lib/Hledger/Data/Types.hs.
+
+       o The JSON output from hledger commands is essentially the same as  the
+         JSON served by hledger-web's JSON API, but pretty printed, using line
+         breaks and indentation.  Our pretty printer has the ability to  elide
+         data  in  certain  cases  -  rendering  non-strings  as  if they were
+         strings, or displaying "FOO.." instead of FOO's full  details.   This
+         should  never  happen in hledger's JSON output; if you see otherwise,
+         please report as a bug.
+
+       o hledger represents quantities as Decimal values  storing  up  to  255
+         significant  digits,  eg  for  repeating  decimals.  Such numbers can
+         arise in practice (from automatically-calculated transaction prices),
+         and  would break most JSON consumers.  So in JSON, we show quantities
+         as simple Numbers with at most 10 decimal places.  We don't limit the
+         number  of  integer  digits, but that part is under your control.  We
+         hope this approach will not cause problems in practice; if  you  find
+         otherwise, please let us know.  (Cf #1195)
+
+   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:
+         REGEX, desc:REGEX, cur:REGEX, tag:...=REGEX
+
+       o CSV rules conditional blocks: if REGEX ...
+
+       o account alias directives and options: alias  /REGEX/  =  REPLACEMENT,
+         --alias /REGEX/=REPLACEMENT
+
+       hledger's  regular  expressions  come  from the regex-tdfa library.  In
+       general they:
+
+       o are case insensitive
+
+       o are infix matching (do not need  to  match  the  entire  thing  being
+         matched)
+
+       o are POSIX extended regular expressions
+
+       o also support GNU word boundaries (\<, \>, \b, \B)
+
+       o and  parenthesised capturing groups and numeric backreferences in re-
+         placement strings
+
+       o do not support mode modifiers like (?s)
+
+       Some things to note:
+
+       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
+         with the dollar sign in hledger-web, write cur:\$.
+
+       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
+       omitted (defaulting to 1).
+
+       Examples:
+
+       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
+       10/1                       month and day in current year
+       21                         day in current month
+       october, oct               start of month in current year
+       yesterday, today, tomor-   -1, 0, 1 days from today
+       row
+       last/this/next             -1, 0, 1 periods from the current period
+       day/week/month/quar-
+       ter/year
+       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-
+       sults:
+
+       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
+                     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
+       journal data, by default.  So, the effective report start and end dates
+       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,
+       -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
+         after the last day you want to include.
+
+       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
+         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
+                         (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
+       date:-12/1
+       date:thismonth-
+       date:thismonth
+
+   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-
+       tervals can not be specified with a query.
+
+   Period expressions
+       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
+       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
+       "-".  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
+       also be written as:
+
+       -p "1/1 4/1"
+       -p "january-apr"
+       -p "this year to 4/1"
+
+       If you specify only one date, the missing start or end date will be the
+       earliest or latest transaction in your journal:
+
+       -p "from 2009/1/1"   everything  after  january
+                            1, 2009
+       -p "from 2009/1"     the same
+       -p "from 2009"       the same
+       -p "to 2009"         everything  before january
+                            1, 2009
+
+       A single date with no "from" or "to" defines both  the  start  and  end
+       date like so:
+
+       -p "2009"       the  year 2009; equivalent
+                       to "2009/1/1 to 2010/1/1"
+       -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
+                       to "2009/1/1 to 2009/1/2"
+
+       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
+       flags.  Between report interval and start/end dates (if any), the  word
+       in is optional.  Examples:
+
+       -p "weekly from 2009/1/1 to 2009/4/1"
+       -p "monthly in 2008"
+       -p "quarterly"
+
+       Note  that  weekly, monthly, quarterly and yearly intervals will always
+       start on the first day on week, month, quarter or year accordingly, and
+       will  end on the last day of same period, even if associated period ex-
+       pression specifies different explicit start and end date.
+
+       For example:
+
+       -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,
+       2009-05-05 to 2009-06-01"   which are first and last days of Q2 2009
+       -p      "yearly      from   starts on 2009/01/01, first day of 2009
+       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.
+
+       All of these will start on the first day of the  requested  period  and
+       end on the last one, as described above.
+
+       Examples:
+
+       -p "bimonthly from 2008"    periods  will have boundaries on 2008/01/01,
+                                   2008/03/01, ...
+       -p "every 2 weeks"          starts on closest preceding Monday
+       -p "every  5  month  from   periods  will have boundaries on 2009/03/01,
+       2009/03"                    2009/08/01, ...
+
+       If you want intervals that start on arbitrary day of your choosing  and
+       span a week, month or year, you need to use any of the following:
+
+       every Nth day of week, every <weekday>, every Nth day [of month], every
+       Nth weekday [of month], every MM/DD [of year], every Nth MMM [of year],
+       every MMM Nth [of year].
+
+       Examples:
+
+       -p  "every  2nd  day  of   periods will go from Tue to Tue
+       week"
+       -p "every Tue"             same
+       -p "every 15th day"        period boundaries will  be  on  15th  of  each
+                                  month
+       -p "every 2nd Monday"      period  boundaries will be on second Monday of
+                                  each month
+       -p "every 11/05"           yearly periods with boundaries on 5th of Nov
+       -p "every 5th Nov"         same
+       -p "every Nov 5th"         same
+
+       Show historical balances at end of 15th each month (N is exclusive  end
+       date):
+
+       hledger balance -H -p "every 16th day"
+
+       Group  postings  from  start  of wednesday to end of next tuesday (N is
+       start date and exclusive end date):
+
+       hledger register checking -p "every 3rd day of week"
+
+   Depth limiting
+       With the --depth N option (short form: -N), commands like account, bal-
+       ance  and register will show only the uppermost accounts in the account
+       tree, down to level N.  Use this when you want a summary with less  de-
+       tail.  This flag has the same effect as a depth: query argument (so -2,
+       --depth=2 or depth:2 are basically equivalent).
+
+   Pivoting
+       Normally hledger sums amounts, and organizes them in a hierarchy, based
+       on  account  name.  The --pivot FIELD option causes it to sum and orga-
+       nize hierarchy based on the value of some other field  instead.   FIELD
+       can be: code, description, payee, note, or the full name (case insensi-
+       tive) of any tag.  As with account names, values containing colon:sepa-
+       rated:parts will be displayed hierarchically in reports.
+
+       --pivot  is  a  general  option affecting all reports; you can think of
+       hledger transforming the journal before any other processing, replacing
+       every  posting's  account name with the value of the specified field on
+       that posting, inheriting it from the transaction or using a blank value
+       if it's not present.
+
+       An example:
+
+              2016/02/16 Member Fee Payment
+                  assets:bank account                    2 EUR
+                  income:member fees                    -2 EUR  ; member: John Doe
+
+       Normal balance report showing account names:
+
+              $ hledger balance
+                             2 EUR  assets:bank account
+                            -2 EUR  income:member fees
+              --------------------
+                                 0
+
+       Pivoted balance report, using member: tag values instead:
+
+              $ hledger balance --pivot member
+                             2 EUR
+                            -2 EUR  John Doe
+              --------------------
+                                 0
+
+       One  way  to show only amounts with a member: value (using a query, de-
+       scribed below):
+
+              $ hledger balance --pivot member tag:member=.
+                            -2 EUR  John Doe
+              --------------------
+                            -2 EUR
+
+       Another way (the acct:  query  matches  against  the  pivoted  "account
+       name"):
+
+              $ hledger balance --pivot member acct:.
+                            -2 EUR  John Doe
+              --------------------
+                            -2 EUR
+
+   Valuation
+   -B: Cost
+       The -B/--cost flag converts amounts to their cost (or selling price) at
+       transaction time, if they have a  transaction  price  specified.   This
+       flag is equivalent to --value=cost, described below.
+
+   -V: Market value
+       The -V/--market flag converts reported amounts to their market value in
+       a default valuation commodity, using the market prices in effect  on  a
+       default  valuation date.  For single period reports, the valuation date
+       is today (equivalent to --value=now); for multiperiod  reports,  it  is
+       the last day of each subperiod (equivalent to --value=end).
+
+       The default valuation commodity is the one referenced in the latest ap-
+       plicable market price dated on or before the valuation date.   If  most
+       of  your  P declarations lead to a single home currency, this will usu-
+       ally be what you want.  (To specify the commodity, see -X below.)
+
+       Note that in hledger, market prices are always declared explicitly with
+       P  directives;  we  do not infer them from transaction prices as Ledger
+       does.
+
+       Here's a quick example of -V:
+
+              ; one euro is worth this many dollars from nov 1
+              P 2016/11/01 EUR $1.10
+
+              ; purchase some euros on nov 3
+              2016/11/3
+                  assets:euros        EUR100
+                  assets:checking
+
+              ; the euro is worth fewer dollars by dec 21
+              P 2016/12/21 EUR $1.03
+
+       How many euros do I have ?
+
+              $ hledger -f t.j bal -N euros
+                              EUR100  assets:euros
+
+       What are they worth at end of nov 3 ?
+
+              $ hledger -f t.j bal -N euros -V -e 2016/11/4
+                           $110.00  assets:euros
+
+       What are they worth after 2016/12/21 ?  (no report end date  specified,
+       defaults to today)
+
+              $ hledger -f t.j bal -N euros -V
+                           $103.00  assets:euros
+
+   -X: Market value in specified commodity
+       The  -X/--exchange  option  is  like -V, except it specifies the target
+       commodity  you  would  like  to  convert  to.   It  is  equivalent   to
+       --value=now,COMM or --value=end,COMM.
+
+   --value: Flexible valuation
+       (experimental, added 201905)
+
+       -B, -V and -X are special cases of the more general --value option:
+
+               --value=TYPE[,COMM]  TYPE is cost, then, end, now or YYYY-MM-DD.
+                                    COMM is an optional commodity symbol.
+                                    Shows amounts converted to:
+                                    - cost commodity using transaction prices (then optionally to COMM using market prices at period end(s))
+                                    - default valuation commodity (or COMM) using market prices at posting dates
+                                    - default valuation commodity (or COMM) using market prices at period end(s)
+                                    - default valuation commodity (or COMM) using current market prices
+                                    - default valuation commodity (or COMM) using market prices at some date
+
+       The TYPE part basically selects either "cost", or "market value" plus a
+       valuation date:
+
+       --value=cost
+              Convert amounts to cost, using the prices recorded  in  transac-
+              tions.
+
+       --value=then
+              Convert amounts to their value in a default valuation commodity,
+              using market prices on each posting's date.  This  is  currently
+              supported only by the print and register commands.
+
+       --value=end
+              Convert amounts to their value in a default valuation commodity,
+              using market prices on the last day of the report period (or  if
+              unspecified, the journal's end date); or in multiperiod reports,
+              market prices on the last day of each subperiod.
+
+       --value=now
+              Convert amounts to their value in  default  valuation  commodity
+              using current market prices (as of when report is generated).
+
+       --value=YYYY-MM-DD
+              Convert  amounts  to  their value in default valuation commodity
+              using market prices on this date.
+
+       The default valuation commodity is the commodity mentioned in the  most
+       recent applicable market price declaration.  When all your price decla-
+       rations lead to a single home currency, this will usually do  what  you
+       want.
+
+       To select a different valuation commodity, add the optional ,COMM part:
+       a comma, then the  target  commodity's  symbol.   Eg:  --value=now,EUR.
+       hledger will do its best to convert amounts to this commodity, using:
+
+       o declared prices (from source commodity to valuation commodity)
+
+       o reverse  prices  (declared prices from valuation to source commodity,
+         inverted)
+
+       o indirect prices (prices calculated from the  shortest  chain  of  de-
+         clared or reverse prices from source to valuation commodity)
+
+       in that order.
+
+       Here  are  some  examples  showing  the  effect of --value as seen with
+       print:
+
+              P 2000-01-01 A  1 B
+              P 2000-02-01 A  2 B
+              P 2000-03-01 A  3 B
+              P 2000-04-01 A  4 B
+
+              2000-01-01
+                (a)      1 A @ 5 B
+
+              2000-02-01
+                (a)      1 A @ 6 B
+
+              2000-03-01
+                (a)      1 A @ 7 B
+
+       Show the cost of each posting:
+
+              $ hledger -f- print --value=cost
+              2000-01-01
+                  (a)             5 B
+
+              2000-02-01
+                  (a)             6 B
+
+              2000-03-01
+                  (a)             7 B
+
+       Show the value as of the last day of the report period (2000-02-29):
+
+              $ hledger -f- print --value=end date:2000/01-2000/03
+              2000-01-01
+                  (a)             2 B
+
+              2000-02-01
+                  (a)             2 B
+
+       With no report period specified, that shows the value as  of  the  last
+       day of the journal (2000-03-01):
+
+              $ hledger -f- print --value=end
+              2000-01-01
+                  (a)             3 B
+
+              2000-02-01
+                  (a)             3 B
+
+              2000-03-01
+                  (a)             3 B
+
+       Show the current value (the 2000-04-01 price is still in effect today):
+
+              $ hledger -f- print --value=now
+              2000-01-01
+                  (a)             4 B
+
+              2000-02-01
+                  (a)             4 B
+
+              2000-03-01
+                  (a)             4 B
+
+       Show the value on 2000/01/15:
+
+              $ hledger -f- print --value=2000-01-15
+              2000-01-01
+                  (a)             1 B
+
+              2000-02-01
+                  (a)             1 B
+
+              2000-03-01
+                  (a)             1 B
+
+       You  may  need  to explicitly set a commodity's display style, when re-
+       verse prices are used.  Eg this output might be surprising:
+
+              P 2000-01-01 A 2B
+
+              2000-01-01
+                a  1B
+                b
+
+              $ hledger print -x -X A
+              2000-01-01
+                  a               0
+                  b               0
+
+       Explanation: because there's no amount or commodity directive  specify-
+       ing  a display style for A, 0.5A gets the default style, which shows no
+       decimal digits.  Because the displayed amount looks like zero, the com-
+       modity  symbol  and minus sign are not displayed either.  Adding a com-
+       modity directive sets a more useful display style for A:
+
+              P 2000-01-01 A 2B
+              commodity 0.00A
+
+              2000-01-01
+                a  1B
+                b
+
+              $ hledger print -X A
+              2000-01-01
+                  a           0.50A
+                  b          -0.50A
+
+   Effect of --value on reports
+       Here is a reference for how --value  currently  affects  each  part  of
+       hledger's  reports.  It's work in progress, but may be useful for trou-
+       bleshooting or reporting bugs.  See also the definitions and notes  be-
+       low.   If  you find problems, please report them, ideally with a repro-
+       ducible example.  Related: #329, #1083.
+
+       Report type    -B,            -V, -X         --value=then    --value=end    --value=DATE,
+                      --value=cost                                                 --value=now
+       ------------------------------------------------------------------------------------------
+
+       print
+       posting        cost           value at re-   value      at   value at re-   value      at
+       amounts                       port end  or   posting date    port      or   DATE/today
+                                     today                          journal end
+       balance  as-   unchanged      unchanged      unchanged       unchanged      unchanged
+       sertions   /
+       assignments
+
+       register
+       starting       cost           value at day   not supported   value at day   value      at
+       balance                       before   re-                   before   re-   DATE/today
+       (with -H)                     port      or                   port      or
+                                     journal                        journal
+                                     start                          start
+       posting        cost           value at re-   value      at   value at re-   value      at
+       amounts  (no                  port end  or   posting date    port      or   DATE/today
+       report   in-                  today                          journal end
+       terval)
+       summary        summarised     value at pe-   sum  of post-   value at pe-   value      at
+       posting        cost           riod ends      ings  in  in-   riod ends      DATE/today
+       amounts                                      terval,  val-
+       (with report                                 ued at inter-
+       interval)                                    val start
+       running  to-   sum/average    sum/average    sum/average     sum/average    sum/average
+       tal/average    of displayed   of displayed   of  displayed   of displayed   of  displayed
+                      values         values         values          values         values
+
+       balance (bs,
+       bse,     cf,
+       is..)
+       balances (no   sums      of   value at re-   not supported   value at re-   value      at
+       report   in-   costs          port end  or                   port      or   DATE/today of
+       terval)                       today     of                   journal  end   sums of post-
+                                     sums      of                   of  sums  of   ings
+                                     postings                       postings
+       balances       sums      of   value at pe-   not supported   value at pe-   value      at
+       (with report   costs          riod ends of                   riod ends of   DATE/today of
+       interval)                     sums      of                   sums      of   sums of post-
+                                     postings                       postings       ings
+       starting       sums      of   sums      of   not supported   sums      of   sums of post-
+       balances       costs     of   postings be-                   postings be-   ings   before
+       (with report   postings be-   fore  report                   fore  report   report start
+       interval and   fore  report   start                          start
+       -H)            start
+       budget         like    bal-   like    bal-   not supported   like    bal-   like balances
+       amounts with   ances          ances                          ances
+       --budget
+       grand  total   sum  of dis-   sum  of dis-   not supported   sum  of dis-   sum  of  dis-
+       (no   report   played  val-   played  val-                   played  val-   played values
+       interval)      ues            ues                            ues
+       row      to-   sums/aver-     sums/aver-     not supported   sums/aver-     sums/averages
+       tals/aver-     ages of dis-   ages of dis-                   ages of dis-   of  displayed
+       ages   (with   played  val-   played  val-                   played  val-   values
+       report   in-   ues            ues                            ues
+       terval)
+       column   to-   sums of dis-   sums of dis-   not supported   sums of dis-   sums of  dis-
+       tals           played  val-   played  val-                   played  val-   played values
+                      ues            ues                            ues
+       grand    to-   sum/average    sum/average    not supported   sum/average    sum/average
+       tal/average    of    column   of    column                   of    column   of column to-
+                      totals         totals                         totals         tals
+
+
+       Additional notes
+
+       cost   calculated using price(s) recorded in the transaction(s).
+
+       value  market value using available market price declarations,  or  the
+              unchanged amount if no conversion rate can be found.
+
+       report start
+              the  first  day  of the report period specified with -b or -p or
+              date:, otherwise today.
+
+       report or journal start
+              the first day of the report period specified with -b  or  -p  or
+              date:,  otherwise  the earliest transaction date in the journal,
+              otherwise today.
+
+       report end
+              the last day of the report period specified with  -e  or  -p  or
+              date:, otherwise today.
+
+       report or journal end
+              the  last  day  of  the report period specified with -e or -p or
+              date:, otherwise the latest transaction  date  in  the  journal,
+              otherwise today.
+
+       report interval
+              a  flag (-D/-W/-M/-Q/-Y) or period expression that activates the
+              report's multi-period mode (whether showing one or many subperi-
+              ods).
+
+   Combining -B, -V, -X, --value
+       The rightmost of these flags wins.
+
+COMMANDS
+       hledger  provides  a  number  of subcommands; hledger with no arguments
+       shows a list.
+
+       If you install additional hledger-* packages, or if you put programs or
+       scripts  named  hledger-NAME in your PATH, these will also be listed as
+       subcommands.
+
+       Run a subcommand by writing its name as first argument (eg hledger  in-
+       comestatement).   You  can also write one of the standard short aliases
+       displayed in parentheses in the command list (hledger b),  or  any  any
+       unambiguous prefix of a command name (hledger inc).
+
+       Here  are  all  the  builtin  commands in alphabetical order.  See also
+       hledger for a more organised command list, and hledger CMD -h  for  de-
+       tailed command help.
+
+   accounts
+       accounts, a
+       Show account names.
+
+       This  command  lists account names, either declared with account direc-
+       tives (--declared), posted to (--used), or both  (the  default).   With
+       query  arguments,  only  matched account names and account names refer-
+       enced by matched postings are shown.  It shows a flat list by  default.
+       With  --tree,  it  uses  indentation to show the account hierarchy.  In
+       flat mode you can add --drop N to omit the first few account name  com-
+       ponents.   Account names can be depth-clipped with depth:N or --depth N
+       or -N.
+
+       Examples:
+
+              $ hledger accounts
+              assets:bank:checking
+              assets:bank:saving
+              assets:cash
+              expenses:food
+              expenses:supplies
+              income:gifts
+              income:salary
+              liabilities:debts
+
+   activity
+       activity
+       Show an ascii barchart of posting counts per interval.
+
+       The activity command displays an ascii  histogram  showing  transaction
+       counts  by  day, week, month or other reporting interval (by day is the
+       default).  With query arguments, it counts only matched transactions.
+
+       Examples:
+
+              $ hledger activity --quarterly
+              2008-01-01 **
+              2008-04-01 *******
+              2008-07-01
+              2008-10-01 **
+
+   add
+       add
+       Prompt for transactions and add them to the journal.
+
+       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.
+
+       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
+       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
+         template.
+
+       o You can also set the initial defaults with command line arguments.
+
+       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
+         empty, it will insert the default value.
+
+       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.
+
+       o Comments and tags may be entered following a description or amount.
+
+       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
+         supports it.
+
+       Example (see the tutorial for a detailed explanation):
+
+              $ hledger add
+              Adding transactions to journal file /src/hledger/examples/sample.journal
+              Any command line arguments will be used as defaults.
+              Use tab key to complete, readline keys to edit, enter to accept defaults.
+              An optional (CODE) may follow transaction dates.
+              An optional ; COMMENT may follow descriptions or amounts.
+              If you make a mistake, enter < at any prompt to go one step backward.
+              To end a transaction, enter . when prompted.
+              To quit, enter . at a date prompt or press control-d or control-c.
+              Date [2015/05/22]:
+              Description: supermarket
+              Account 1: expenses:food
+              Amount  1: $10
+              Account 2: assets:checking
+              Amount  2 [$-10.0]:
+              Account 3 (or . or enter to finish this transaction): .
+              2015/05/22 supermarket
+                  expenses:food             $10
+                  assets:checking        $-10.0
+
+              Save this transaction to the journal ? [y]:
+              Saved.
+              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).
+
+   balance
+       balance, bal, b
+       Show accounts and their balances.
+
+       The balance command is hledger's most versatile command.  Note, despite
+       the  name,  it  is  not always used for showing real-world account bal-
+       ances; the more accounting-aware balancesheet and  incomestatement  may
+       be more convenient for that.
+
+       By default, it displays all accounts, and each account's change in bal-
+       ance during the entire period of the journal.  Balance changes are cal-
+       culated  by  adding up the postings in each account.  You can limit the
+       postings matched, by a query, to see fewer  accounts,  changes  over  a
+       different time period, changes from only cleared transactions, etc.
+
+       If you include an account's complete history of postings in the report,
+       the balance change is equivalent to the account's current  ending  bal-
+       ance.   For a real-world account, typically you won't have all transac-
+       tions in the journal; instead you'll have all transactions after a cer-
+       tain  date,  and  an "opening balances" transaction setting the correct
+       starting balance on that date.  Then  the  balance  command  will  show
+       real-world account balances.  In some cases the -H/--historical flag is
+       used to ensure this (more below).
+
+       The balance command can produce several styles of report:
+
+   Classic balance report
+       This is the original balance report, as found in  Ledger.   It  usually
+       looks like this:
+
+              $ hledger balance
+                               $-1  assets
+                                $1    bank:saving
+                               $-2    cash
+                                $2  expenses
+                                $1    food
+                                $1    supplies
+                               $-2  income
+                               $-1    gifts
+                               $-1    salary
+                                $1  liabilities:debts
+              --------------------
+                                 0
+
+       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.
+
+       "Boring" accounts, which contain a single interesting subaccount and no
+       balance  of their own, are elided into the following line for more com-
+       pact output.  (Eg above, the "liabilities" account.) Use --no-elide  to
+       prevent this.
+
+       Account  balances  are  "inclusive"  - they include the balances of any
+       subaccounts.
+
+       Accounts which have zero balance  (and  no  non-zero  subaccounts)  are
+       omitted.  Use -E/--empty to show them.
+
+       A  final  total  is displayed by default; use -N/--no-total to suppress
+       it, eg:
+
+              $ hledger balance -p 2008/6 expenses --no-total
+                                $2  expenses
+                                $1    food
+                                $1    supplies
+
+   Customising the classic balance report
+       You can customise the layout of classic balance reports  with  --format
+       FMT:
+
+              $ hledger balance --format "%20(account) %12(total)"
+                            assets          $-1
+                       bank:saving           $1
+                              cash          $-2
+                          expenses           $2
+                              food           $1
+                          supplies           $1
+                            income          $-2
+                             gifts          $-1
+                            salary          $-1
+                 liabilities:debts           $1
+              ---------------------------------
+                                              0
+
+       The FMT format string (plus a newline) specifies the formatting applied
+       to each account/balance pair.  It may contain any suitable  text,  with
+       data fields interpolated like so:
+
+       %[MIN][.MAX](FIELDNAME)
+
+       o MIN pads with spaces to at least this width (optional)
+
+       o MAX truncates at this width (optional)
+
+       o FIELDNAME must be enclosed in parentheses, and can be one of:
+
+         o depth_spacer  - a number of spaces equal to the account's depth, or
+           if MIN is specified, MIN * depth spaces.
+
+         o account - the account's name
+
+         o total - the account's balance/posted total, right justified
+
+       Also, FMT can begin with an optional prefix to control  how  multi-com-
+       modity amounts are rendered:
+
+       o %_ - render on multiple lines, bottom-aligned (the default)
+
+       o %^ - render on multiple lines, top-aligned
+
+       o %, - render on one line, comma-separated
+
+       There are some quirks.  Eg in one-line mode, %(depth_spacer) has no ef-
+       fect, instead %(account) has indentation built in.  Experimentation may
+       be needed to get pleasing results.
+
+       Some example formats:
+
+       o %(total) - the account's total
+
+       o %-20.20(account)  -  the account's name, left justified, padded to 20
+         characters and clipped at 20 characters
+
+       o %,%-50(account)  %25(total) - account name padded to  50  characters,
+         total  padded to 20 characters, with multiple commodities rendered on
+         one line
+
+       o %20(total)  %2(depth_spacer)%-(account) - the default format for  the
+         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
+
+   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
+       this mode, you can also use --drop N to omit the first few account name
+       components.
+
+              $ hledger balance -p 2008/6 expenses -N --flat --drop 1
+                                $1  food
+                                $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
+       a complex set of accounts and get an overview.
+
+              $ hledger balance -N -1
+                               $-1  assets
+                                $2  expenses
+                               $-2  income
+                                $1  liabilities
+
+       Flat-mode balance reports, which normally show exclusive balances, show
+       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
+       obtain an overview of expenses:
+
+              $ hledger balance expenses -%
+                           100.0 %  expenses
+                            50.0 %    food
+                            50.0 %    supplies
+              --------------------
+                           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-
+       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
+       (eg hledger balance -B) all percentage values will be zero.
+
+       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-
+       terval.
+
+       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
+          for a monthly income statement:
+
+                  $ hledger balance --quarterly income expenses -E
+                  Balance changes in 2008:
+
+                                     ||  2008q1  2008q2  2008q3  2008q4
+                  ===================++=================================
+                   expenses:food     ||       0      $1       0       0
+                   expenses:supplies ||       0      $1       0       0
+                   income:gifts      ||       0     $-1       0       0
+                   income:salary     ||     $-1       0       0       0
+                  -------------------++---------------------------------
+                                     ||     $-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
+          the report start date:
+
+                  $ hledger balance --quarterly income expenses -E --cumulative
+                  Ending balances (cumulative) in 2008:
+
+                                     ||  2008/03/31  2008/06/30  2008/09/30  2008/12/31
+                  ===================++=================================================
+                   expenses:food     ||           0          $1          $1          $1
+                   expenses:supplies ||           0          $1          $1          $1
+                   income:gifts      ||           0         $-1         $-1         $-1
+                   income:salary     ||         $-1         $-1         $-1         $-1
+                  -------------------++-------------------------------------------------
+                                     ||         $-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
+          useful eg for a multi-period balance sheet, and when you are showing
+          only the data after a certain start date:
+
+                  $ hledger balance ^assets ^liabilities --quarterly --historical --begin 2008/4/1
+                  Ending balances (historical) in 2008/04/01-2008/12/31:
+
+                                        ||  2008/06/30  2008/09/30  2008/12/31
+                  ======================++=====================================
+                   assets:bank:checking ||          $1          $1           0
+                   assets:bank:saving   ||          $1          $1          $1
+                   assets:cash          ||         $-2         $-2         $-2
+                   liabilities:debts    ||           0           0          $1
+                  ----------------------++-------------------------------------
+                                        ||           0           0           0
+
+       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;
+       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
+       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:
+       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
+       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
+       row.
+
+       Here's an example of all three:
+
+              $ hledger balance -Q income expenses --tree -ETA
+              Balance changes in 2008:
+
+                          ||  2008q1  2008q2  2008q3  2008q4    Total  Average
+              ============++===================================================
+               expenses   ||       0      $2       0       0       $2       $1
+                 food     ||       0      $1       0       0       $1        0
+                 supplies ||       0      $1       0       0       $1        0
+               income     ||     $-1     $-1       0       0      $-2      $-1
+                 gifts    ||       0     $-1       0       0      $-1        0
+                 salary   ||     $-1       0       0       0      $-1        0
+              ------------++---------------------------------------------------
+                          ||     $-1      $1       0       0        0        0
+
+              (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.
+
+   Budget report
+       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
+       a report interval.
+
+       For example, you can take average monthly expenses in  the  common  ex-
+       pense categories to construct a minimal monthly budget:
+
+              ;; Budget
+              ~ monthly
+                income  $2000
+                expenses:food    $400
+                expenses:bus     $50
+                expenses:movies  $30
+                assets:bank:checking
+
+              ;; Two months worth of expenses
+              2017-11-01
+                income  $1950
+                expenses:food    $396
+                expenses:bus     $49
+                expenses:movies  $30
+                expenses:supplies  $20
+                assets:bank:checking
+
+              2017-12-01
+                income  $2100
+                expenses:food    $412
+                expenses:bus     $53
+                expenses:gifts   $100
+                assets:bank:checking
+
+       You can now see a monthly budget report:
+
+              $ hledger balance -M --budget
+              Budget performance in 2017/11/01-2017/12/31:
+
+                                    ||                      Nov                       Dec
+              ======================++====================================================
+               assets               || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480]
+               assets:bank          || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480]
+               assets:bank:checking || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480]
+               expenses             ||   $495 [ 103% of   $480]    $565 [ 118% of   $480]
+               expenses:bus         ||    $49 [  98% of    $50]     $53 [ 106% of    $50]
+               expenses:food        ||   $396 [  99% of   $400]    $412 [ 103% of   $400]
+               expenses:movies      ||    $30 [ 100% of    $30]       0 [   0% of    $30]
+               income               ||  $1950 [  98% of  $2000]   $2100 [ 105% of  $2000]
+              ----------------------++----------------------------------------------------
+                                    ||      0 [              0]       0 [              0]
+
+       Note this is different from a normal balance report in several ways:
+
+       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,  budgeted
+         amounts are shown, along with the percentage of budget used.
+
+       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
+         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
+       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
+       ones, giving the full picture.  Eg:
+
+              $ hledger balance -M --budget --empty
+              Budget performance in 2017/11/01-2017/12/31:
+
+                                    ||                      Nov                       Dec
+              ======================++====================================================
+               assets               || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480]
+               assets:bank          || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480]
+               assets:bank:checking || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480]
+               expenses             ||   $495 [ 103% of   $480]    $565 [ 118% of   $480]
+               expenses:bus         ||    $49 [  98% of    $50]     $53 [ 106% of    $50]
+               expenses:food        ||   $396 [  99% of   $400]    $412 [ 103% of   $400]
+               expenses:gifts       ||      0                      $100
+               expenses:movies      ||    $30 [ 100% of    $30]       0 [   0% of    $30]
+               expenses:supplies    ||    $20                         0
+               income               ||  $1950 [  98% of  $2000]   $2100 [ 105% of  $2000]
+              ----------------------++----------------------------------------------------
+                                    ||      0 [              0]       0 [              0]
+
+       You can roll over unspent budgets to next period with --cumulative:
+
+              $ hledger balance -M --budget --cumulative
+              Budget performance in 2017/11/01-2017/12/31:
+
+                                    ||                      Nov                       Dec
+              ======================++====================================================
+               assets               || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960]
+               assets:bank          || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960]
+               assets:bank:checking || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960]
+               expenses             ||   $495 [ 103% of   $480]   $1060 [ 110% of   $960]
+               expenses:bus         ||    $49 [  98% of    $50]    $102 [ 102% of   $100]
+               expenses:food        ||   $396 [  99% of   $400]    $808 [ 101% of   $800]
+               expenses:movies      ||    $30 [ 100% of    $30]     $30 [  50% of    $60]
+               income               ||  $1950 [  98% of  $2000]   $4050 [ 101% of  $4000]
+              ----------------------++----------------------------------------------------
+                                    ||      0 [              0]       0 [              0]
+
+       For more examples, see Budgeting and Forecasting.
+
+   Nested budgets
+       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
+       parent, much like account balances behave.
+
+       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:
+
+              ~ monthly from 2019/01
+                  expenses:personal             $1,000.00
+                  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
+       means that budget for both expenses:personal and expenses is $1100.
+
+       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
+       only towards the budget of expenses:personal.
+
+       For example, let's consider these transactions:
+
+              ~ monthly from 2019/01
+                  expenses:personal             $1,000.00
+                  expenses:personal:electronics    $100.00
+                  liabilities
+
+              2019/01/01 Google home hub
+                  expenses:personal:electronics          $90.00
+                  liabilities                           $-90.00
+
+              2019/01/02 Phone screen protector
+                  expenses:personal:electronics:upgrades          $10.00
+                  liabilities
+
+              2019/01/02 Weekly train ticket
+                  expenses:personal:train tickets       $153.00
+                  liabilities
+
+              2019/01/03 Flowers
+                  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-
+       tions would be counted towards budgets of expenses:personal:electronics
+       and expenses:personal accordingly:
+
+              $ hledger balance --budget -M
+              Budget performance in 2019/01:
+
+                                             ||                           Jan
+              ===============================++===============================
+               expenses                      ||  $283.00 [  26% of  $1100.00]
+               expenses:personal             ||  $283.00 [  26% of  $1100.00]
+               expenses:personal:electronics ||  $100.00 [ 100% of   $100.00]
+               liabilities                   || $-283.00 [  26% of $-1100.00]
+              -------------------------------++-------------------------------
+                                             ||        0 [                 0]
+
+       And  with --empty, we can get a better picture of budget allocation and
+       consumption:
+
+              $ hledger balance --budget -M --empty
+              Budget performance in 2019/01:
+
+                                                      ||                           Jan
+              ========================================++===============================
+               expenses                               ||  $283.00 [  26% of  $1100.00]
+               expenses:personal                      ||  $283.00 [  26% of  $1100.00]
+               expenses:personal:electronics          ||  $100.00 [ 100% of   $100.00]
+               expenses:personal:electronics:upgrades ||   $10.00
+               expenses:personal:train tickets        ||  $153.00
+               liabilities                            || $-283.00 [  26% of $-1100.00]
+              ----------------------------------------++-------------------------------
+                                                      ||        0 [                 0]
+
+   Output format
+       This command also supports the output destination and output format op-
+       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).
+
+       Note  this  report shows all account balances with normal positive sign
+       (like conventional financial statements, unlike balance/print/register)
+       (experimental).
+
+       Example:
+
+              $ hledger balancesheet
+              Balance Sheet
+
+              Assets:
+                               $-1  assets
+                                $1    bank:saving
+                               $-2    cash
+              --------------------
+                               $-1
+
+              Liabilities:
+                                $1  liabilities:debts
+              --------------------
+                                $1
+
+              Total:
+              --------------------
+                                 0
+
+       With a reporting interval, multiple columns will be shown, one for each
+       report period.  As with multicolumn balance reports, you can alter  the
+       report  mode  with  --change/--cumulative/--historical.   Normally bal-
+       ancesheet shows historical ending balances, which is what you need  for
+       a  balance  sheet;  note  this means it ignores report begin dates (and
+       -T/--row-total, since summing end  balances  generally  does  not  make
+       sense).   Instead  of absolute 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-
+       tal) json.
+
+   balancesheetequity
+       balancesheetequity, bse
+       Just like balancesheet, but also reports Equity (which  it  assumes  is
+       under a top-level equity account).
+
+       Example:
+
+              $ hledger balancesheetequity
+              Balance Sheet With Equity
+
+              Assets:
+                               $-2  assets
+                                $1    bank:saving
+                               $-3    cash
+              --------------------
+                               $-2
+
+              Liabilities:
+                                $1  liabilities:debts
+              --------------------
+                                $1
+
+              Equity:
+                        $1  equity:owner
+              --------------------
+                        $1
+
+              Total:
+              --------------------
+                                 0
+
+       This command also supports the output destination and output format op-
+       tions The output formats supported are txt, csv, html, and  (experimen-
+       tal) json.
+
+   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).
+
+       Example:
+
+              $ hledger cashflow
+              Cashflow Statement
+
+              Cash flows:
+                               $-1  assets
+                                $1    bank:saving
+                               $-2    cash
+              --------------------
+                               $-1
+
+              Total:
+              --------------------
+                               $-1
+
+       With a reporting interval, multiple columns will be shown, one for each
+       report  period.   Normally cashflow shows changes in assets per period,
+       though as with multicolumn balance reports you  can  alter  the  report
+       mode with --change/--cumulative/--historical.  Instead of absolute val-
+       ues 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-
+       tal) json.
+
+   check-dates
+       check-dates
+       Check that transactions are sorted by increasing date.   With  --date2,
+       checks  secondary  dates  instead.   With  --strict, dates must also be
+       unique.  With a query, only matched transactions'  dates  are  checked.
+       Reads the default journal file, or another specified with -f.
+
+   check-dupes
+       check-dupes
+       Reports  account names having the same leaf but different prefixes.  In
+       other words, two or  more  leaves  that  are  categorized  differently.
+       Reads the default journal file, or another specified as an argument.
+
+       An example: http://stefanorodighiero.net/software/hledger-dupes.html
+
+   close
+       close, equity
+       Prints  a  "closing  balances"  transaction  and  an "opening balances"
+       transaction that bring account balances to and from zero, respectively.
+       These can be added to your journal file(s), eg to bring asset/liability
+       balances forward into a new journal file, or to close out  revenues/ex-
+       penses to retained earnings at the end of a period.
+
+       You  can  print  just one of these transactions by using the --close or
+       --open flag.  You can customise their descriptions  with  the  --close-
+       desc and --open-desc options.
+
+       One amountless posting to "equity:opening/closing balances" is added to
+       balance the transactions, by default.  You can customise  this  account
+       name  with  --close-acct  and  --open-acct;  if you specify only one of
+       these, it will be used for both.
+
+       With --x/--explicit, the equity posting's amount will be shown.  And if
+       it  involves multiple commodities, a posting for each commodity will be
+       shown, as with the print command.
+
+       With --interleaved, the equity postings are shown next to the  postings
+       they balance, which makes troubleshooting easier.
+
+       By default, transaction prices in the journal are ignored when generat-
+       ing the closing/opening transactions.  With --show-costs, this cost in-
+       formation  is preserved (balance -B reports will be unchanged after the
+       transition).  Separate postings are generated for  each  cost  in  each
+       commodity.   Note  this can generate very large journal entries, if you
+       have many foreign currency or investment transactions.
+
+   close usage
+       If you split your journal files by time (eg yearly), you will typically
+       run  this command at the end of the year, and save the closing transac-
+       tion as last entry of the old file, and the opening transaction as  the
+       first  entry  of the new file.  This makes the files self contained, so
+       that correct balances are reported no matter which of them are  loaded.
+       Ie,  if you load just one file, the balances are initialised correctly;
+       or if you load several files, the  redundant  closing/opening  transac-
+       tions  cancel  each other out.  (They will show up in print or register
+       reports; you can  exclude  them  with  a  query  like  not:desc:'(open-
+       ing|closing) balances'.)
+
+       If you're running a business, you might also use this command to "close
+       the books" at the end of  an  accounting  period,  transferring  income
+       statement  account  balances  to  retained  earnings.  (You may want to
+       change the equity account name to something like "equity:retained earn-
+       ings".)
+
+       By  default,  the  closing transaction is dated yesterday, the balances
+       are calculated as of end of yesterday, and the opening  transaction  is
+       dated  today.  To close on some other date, use: hledger close -e OPEN-
+       INGDATE.  Eg, to close/open on the 2018/2019  boundary,  use  -e  2019.
+       You can also use -p or date:PERIOD (any starting date is ignored).
+
+       Both  transactions  will  include balance assertions for the closed/re-
+       opened accounts.  You probably shouldn't use status or realness filters
+       (like  -C or -R or status:) with this command, or the generated balance
+       assertions will depend on these flags.  Likewise, if you run this  com-
+       mand  with  --auto, the balance assertions will probably always require
+       --auto.
+
+       Examples:
+
+       Carrying asset/liability balances into a new file for 2019:
+
+              $ hledger close -f 2018.journal -e 2019 assets liabilities --open
+                  # (copy/paste the output to the start of your 2019 journal file)
+              $ hledger close -f 2018.journal -e 2019 assets liabilities --close
+                  # (copy/paste the output to the end of your 2018 journal file)
+
+       Now:
+
+              $ hledger bs -f 2019.journal                   # one file - balances are correct
+              $ hledger bs -f 2018.journal -f 2019.journal   # two files - balances still correct
+              $ hledger bs -f 2018.journal not:desc:closing  # to see year-end balances, must exclude closing txn
+
+       Transactions spanning the closing date can complicate matters, breaking
+       balance assertions:
+
+              2018/12/30 a purchase made in 2018, clearing the following year
+                  expenses:food          5
+                  assets:bank:checking  -5  ; [2019/1/2]
+
+       Here's one way to resolve that:
+
+              ; in 2018.journal:
+              2018/12/30 a purchase made in 2018, clearing the following year
+                  expenses:food          5
+                  liabilities:pending
+
+              ; in 2019.journal:
+              2019/1/2 clearance of last year's pending transactions
+                  liabilities:pending    5 = 0
+                  assets:checking
+
+   commodities
+       commodities
+       List all commodity/currency symbols used or declared in the journal.
+
+   descriptions
+       descriptions Show descriptions.
+
+       This command lists all descriptions that appear in transactions.
+
+       Examples:
+
+              $ hledger descriptions
+              Store Name
+              Gas Station | Petrol
+              Person A
+
+   diff
+       diff
+       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.)
+       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
+       the account balance, you can compare the bank data with your journal to
+       find out the cause.
+
+       Examples:
+
+              $ hledger diff -f $LEDGER_FILE -f bank.csv assets:bank:giro
+              These transactions are in the first file only:
+
+              2014/01/01 Opening Balances
+                  assets:bank:giro              EUR ...
+                  ...
+                  equity:opening balances       EUR -...
+
+              These transactions are in the second file only:
+
+   files
+       files
+       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
+       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
+       force a particular viewer with the --info, --man, --pager, --cat flags.
+
+       Examples:
+
+              $ hledger help
+              Please choose a manual by typing "hledger help MANUAL" (a substring is ok).
+              Manuals: hledger hledger-ui hledger-web journal csv timeclock timedot
+
+              $ hledger help h --man
+
+              hledger(1)                    hledger User Manuals                    hledger(1)
+
+              NAME
+                     hledger - a command-line accounting tool
+
+              SYNOPSIS
+                     hledger [-f FILE] COMMAND [OPTIONS] [ARGS]
+                     hledger [-f FILE] ADDONCMD -- [OPTIONS] [ARGS]
+                     hledger
+
+              DESCRIPTION
+                     hledger  is  a  cross-platform  program  for tracking money, time, or any
+              ...
+
+   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
+       FILEs' transactions as imported, without actually importing any.
+
+       The input files are specified as arguments - no need to write -f before
+       each one.  So eg to add new transactions from all CSV files to the main
+       journal, it's just: hledger import *.csv
+
+       New transactions are detected in the same way as print --new: by assum-
+       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
+       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
+       balance assignments (eg from an institution that provides only balances
+       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,
+       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 a simple income statement.  It currently  assumes
+       that  you have top-level accounts named income (or revenue) and expense
+       (plural forms also allowed.)
+
+              $ hledger incomestatement
+              Income Statement
+
+              Revenues:
+                               $-2  income
+                               $-1    gifts
+                               $-1    salary
+              --------------------
+                               $-2
+
+              Expenses:
+                                $2  expenses
+                                $1    food
+                                $1    supplies
+              --------------------
+                                $2
+
+              Total:
+              --------------------
+                                 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-
+       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-
+       tal) json.
+
+   notes
+       notes Show notes.
+
+       This command lists all notes that appear in transactions.
+
+       Examples:
+
+              $ hledger notes
+              Petrol
+              Snacks
+
+   payees
+       payees Show payee names.
+
+       This command lists all payee names that appear in transactions.
+
+       Examples:
+
+              $ hledger payees
+              Store Name
+              Gas Station
+              Person A
+
+   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.
+       Price amounts are always displayed with their full precision.
+
+   print
+       print, txns, p
+       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-
+       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-
+       rectives or inter-transaction comments
+
+              $ hledger print
+              2008/01/01 income
+                  assets:bank:checking            $1
+                  income:salary                  $-1
+
+              2008/06/01 gift
+                  assets:bank:checking            $1
+                  income:gifts                   $-1
+
+              2008/06/02 save
+                  assets:bank:saving              $1
+                  assets:bank:checking           $-1
+
+              2008/06/03 * eat & shop
+                  expenses:food                $1
+                  expenses:supplies            $1
+                  assets:cash                 $-2
+
+              2008/12/31 * pay off
+                  liabilities:debts               $1
+                  assets:bank:checking           $-1
+
+       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
+       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
+       the output parseable.
+
+       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
+       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
+       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-
+       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.
+
+       Here's an example of print's CSV output:
+
+              $ hledger print -Ocsv
+              "txnidx","date","date2","status","code","description","comment","account","amount","commodity","credit","debit","posting-status","posting-comment"
+              "1","2008/01/01","","","","income","","assets:bank:checking","1","$","","1","",""
+              "1","2008/01/01","","","","income","","income:salary","-1","$","1","","",""
+              "2","2008/06/01","","","","gift","","assets:bank:checking","1","$","","1","",""
+              "2","2008/06/01","","","","gift","","income:gifts","-1","$","1","","",""
+              "3","2008/06/02","","","","save","","assets:bank:saving","1","$","","1","",""
+              "3","2008/06/02","","","","save","","assets:bank:checking","-1","$","1","","",""
+              "4","2008/06/03","","*","","eat & shop","","expenses:food","1","$","","1","",""
+              "4","2008/06/03","","*","","eat & shop","","expenses:supplies","1","$","","1","",""
+              "4","2008/06/03","","*","","eat & shop","","assets:cash","-2","$","2","","",""
+              "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
+         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
+         order, etc.)
+
+       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
+         greater amounts under debit.)
+
+   print-unique
+       print-unique
+       Print transactions which do not reuse an already-seen description.
+
+       Example:
+
+              $ cat unique.journal
+              1/1 test
+               (acct:one)  1
+              2/2 test
+               (acct:two)  2
+              $ LEDGER_FILE=unique.journal hledger print-unique
+              (-f option not supported)
+              2015/01/01 test
+                  (acct:one)             1
+
+   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:
+
+              $ hledger register checking
+              2008/01/01 income               assets:bank:checking            $1           $1
+              2008/06/01 gift                 assets:bank:checking            $1           $2
+              2008/06/02 save                 assets:bank:checking           $-1           $1
+              2008/12/31 pay off              assets:bank:checking           $-1            0
+
+       With --date2, it shows and sorts by secondary date instead.
+
+       The  --historical/-H  flag  adds the balance from any undisplayed prior
+       postings to the running total.  This is useful when  you  want  to  see
+       only recent activity, with a historically accurate running balance:
+
+              $ hledger register checking -b 2008/6 --historical
+              2008/06/01 gift                 assets:bank:checking            $1           $2
+              2008/06/02 save                 assets:bank:checking           $-1           $1
+              2008/12/31 pay off              assets:bank:checking           $-1            0
+
+       The --depth option limits the amount of sub-account detail displayed.
+
+       The  --average/-A flag shows the running average posting amount instead
+       of the running total (so, the final number displayed is the average for
+       the  whole  report period).  This flag implies --empty (see below).  It
+       is affected by --historical.  It works best when showing just  one  ac-
+       count and one commodity.
+
+       The  --related/-r  flag shows the other postings in the transactions of
+       the postings which would normally be shown.
+
+       The --invert flag negates all amounts.  For example, it can be used  on
+       an income account where amounts are normally displayed as negative num-
+       bers.  It's also useful to show postings on the  checking  account  to-
+       gether with the related account:
+
+              $ hledger register --related --invert assets:checking
+
+       With a reporting interval, register shows summary postings, one per in-
+       terval, aggregating the postings to each account:
+
+              $ hledger register --monthly income
+              2008/01                 income:salary                          $-1          $-1
+              2008/06                 income:gifts                           $-1          $-2
+
+       Periods with no activity, and summary postings with a zero amount,  are
+       not shown by default; use the --empty/-E flag to see them:
+
+              $ hledger register --monthly income -E
+              2008/01                 income:salary                          $-1          $-1
+              2008/02                                                          0          $-1
+              2008/03                                                          0          $-1
+              2008/04                                                          0          $-1
+              2008/05                                                          0          $-1
+              2008/06                 income:gifts                           $-1          $-2
+              2008/07                                                          0          $-2
+              2008/08                                                          0          $-2
+              2008/09                                                          0          $-2
+              2008/10                                                          0          $-2
+              2008/11                                                          0          $-2
+              2008/12                                                          0          $-2
+
+       Often,  you'll want to see just one line per interval.  The --depth op-
+       tion helps with this, causing subaccounts to be aggregated:
+
+              $ hledger register --monthly assets --depth 1h
+              2008/01                 assets                                  $1           $1
+              2008/06                 assets                                 $-1            0
+              2008/12                 assets                                 $-1          $-1
+
+       Note when using report intervals, if you specify start/end dates  these
+       will  be adjusted outward if necessary to contain a whole number of in-
+       tervals.  This ensures that the  first  and  last  intervals  are  full
+       length and comparable to the others in the report.
+
+   Custom register output
+       register  uses  the  full terminal width by default, except on windows.
+       You can override this by setting the COLUMNS environment variable  (not
+       a bash shell variable) or by using the --width/-w option.
+
+       The  description  and  account columns normally share the space equally
+       (about half of (width - 40) each).  You can adjust this by adding a de-
+       scription width as part of --width's argument, comma-separated: --width
+       W,D .  Here's a diagram (won't display correctly in --help):
+
+              <--------------------------------- width (W) ---------------------------------->
+              date (10)  description (D)       account (W-41-D)     amount (12)   balance (12)
+              DDDDDDDDDD dddddddddddddddddddd  aaaaaaaaaaaaaaaaaaa  AAAAAAAAAAAA  AAAAAAAAAAAA
+
+       and some examples:
+
+              $ hledger reg                     # use terminal width (or 80 on windows)
+              $ hledger reg -w 100              # use width 100
+              $ COLUMNS=100 hledger reg         # set with one-time environment variable
+              $ export COLUMNS=100; hledger reg # set till session end (or window resize)
+              $ hledger reg -w 100,40           # set overall width 100, description width 40
+              $ hledger reg -w $COLUMNS,40      # use terminal width, & description width 40
+
+       This command also supports the output destination and output format op-
+       tions  The  output  formats  supported are txt, csv, and (experimental)
+       json.
+
+   register-match
+       register-match
+       Print the one posting whose transaction description is closest to DESC,
+       in  the  style  of the register command.  If there are multiple equally
+       good matches, it shows the most recent.  Query  options  (options,  not
+       arguments)  can be used to restrict the search space.  Helps ledger-au-
+       tosync detect already-seen transactions when importing.
+
+   rewrite
+       rewrite
+       Print all transactions, rewriting the postings of matched transactions.
+       For  now  the only rewrite available is adding new postings, like print
+       --auto.
+
+       This is a start at a generic rewriter of transaction entries.  It reads
+       the  default  journal and prints the transactions, like print, but adds
+       one or more specified postings to any transactions matching QUERY.  The
+       posting  amounts can be fixed, or a multiplier of the existing transac-
+       tion's first posting amount.
+
+       Examples:
+
+              $ hledger-rewrite.hs ^income --add-posting '(liabilities:tax)  *.33  ; income tax' --add-posting '(reserve:gifts)  $100'
+              $ hledger-rewrite.hs expenses:gifts --add-posting '(reserve:gifts)  *-1"'
+              $ hledger-rewrite.hs -f rewrites.hledger
+
+       rewrites.hledger may consist of entries like:
+
+              = ^income amt:<0 date:2017
+                (liabilities:tax)  *0.33  ; tax on income
+                (reserve:grocery)  *0.25  ; reserve 25% for grocery
+                (reserve:)  *0.25  ; reserve 25% for grocery
+
+       Note the single quotes to protect the dollar sign from  bash,  and  the
+       two spaces between account and amount.
+
+       More:
+
+              $ hledger rewrite -- [QUERY]        --add-posting "ACCT  AMTEXPR" ...
+              $ hledger rewrite -- ^income        --add-posting '(liabilities:tax)  *.33'
+              $ hledger rewrite -- expenses:gifts --add-posting '(budget:gifts)  *-1"'
+              $ hledger rewrite -- ^income        --add-posting '(budget:foreign currency)  *0.25 JPY; diversify'
+
+       Argument  for  --add-posting  option  is a usual posting of transaction
+       with an exception for amount specification.  More  precisely,  you  can
+       use '*' (star symbol) before the amount to indicate that that this is a
+       factor for an amount of original matched posting.  If  the  amount  in-
+       cludes a commodity name, the new posting amount will be in the new com-
+       modity; otherwise, it will be in the matched posting  amount's  commod-
+       ity.
+
+   Re-write rules in a file
+       During  the  run  this  tool will execute so called "Automated Transac-
+       tions" found in any journal it process.  I.e instead of specifying this
+       operations in command line you can put them in a journal file.
+
+              $ rewrite-rules.journal
+
+       Make contents look like this:
+
+              = ^income
+                  (liabilities:tax)  *.33
+
+              = expenses:gifts
+                  budget:gifts  *-1
+                  assets:budget  *1
+
+       Note  that '=' (equality symbol) that is used instead of date in trans-
+       actions you usually write.  It indicates the query by which you want to
+       match the posting to add new ones.
+
+              $ hledger rewrite -- -f input.journal -f rewrite-rules.journal > rewritten-tidy-output.journal
+
+       This is something similar to the commands pipeline:
+
+              $ hledger rewrite -- -f input.journal '^income' --add-posting '(liabilities:tax)  *.33' \
+                | hledger rewrite -- -f - expenses:gifts      --add-posting 'budget:gifts  *-1'       \
+                                                              --add-posting 'assets:budget  *1'       \
+                > rewritten-tidy-output.journal
+
+       It  is  important  to understand that relative order of such entries in
+       journal is important.  You can re-use result of previously added  post-
+       ings.
+
+   Diff output format
+       To  use  this tool for batch modification of your journal files you may
+       find useful output in form of unified diff.
+
+              $ hledger rewrite -- --diff -f examples/sample.journal '^income' --add-posting '(liabilities:tax)  *.33'
+
+       Output might look like:
+
+              --- /tmp/examples/sample.journal
+              +++ /tmp/examples/sample.journal
+              @@ -18,3 +18,4 @@
+               2008/01/01 income
+              -    assets:bank:checking  $1
+              +    assets:bank:checking            $1
+                   income:salary
+              +    (liabilities:tax)                0
+              @@ -22,3 +23,4 @@
+               2008/06/01 gift
+              -    assets:bank:checking  $1
+              +    assets:bank:checking            $1
+                   income:gifts
+              +    (liabilities:tax)                0
+
+       If you'll pass this through patch tool you'll get transactions contain-
+       ing the posting that matches your query be updated.  Note that multiple
+       files might be update according to list of input  files  specified  via
+       --file options and include directives inside of these files.
+
+       Be  careful.  Whole transaction being re-formatted in a style of output
+       from hledger print.
+
+       See also:
+
+       https://github.com/simonmichael/hledger/issues/99
+
+   rewrite vs. print --auto
+       This command predates print --auto, and currently does  much  the  same
+       thing, but with these differences:
+
+       o with  multiple files, rewrite lets rules in any file affect all other
+         files.  print --auto uses standard directive  scoping;  rules  affect
+         only child files.
+
+       o rewrite's  query  limits which transactions can be rewritten; all are
+         printed.  print --auto's query limits which transactions are printed.
+
+       o rewrite applies rules specified on command line or  in  the  journal.
+         print --auto applies rules specified in the journal.
+
+   roi
+       roi
+       Shows  the  time-weighted (TWR) and money-weighted (IRR) rate of return
+       on your investments.
+
+       This command assumes that you have account(s)  that  hold  nothing  but
+       your investments and whenever you record current appraisal/valuation of
+       these investments you offset unrealized profit and loss into account(s)
+       that, again, hold nothing but unrealized profit and loss.
+
+       Any  transactions  affecting  balance  of investment account(s) and not
+       originating from unrealized profit and loss account(s) are  assumed  to
+       be your investments or withdrawals.
+
+       At  a  minimum,  you need to supply a query (which could be just an ac-
+       count name) to select your investments with --inv, and another query to
+       identify your profit and loss transactions with --pnl.
+
+       It  will  compute and display the internalized rate of return (IRR) and
+       time-weighted rate of return (TWR) for your investments  for  the  time
+       period  requested.  Both rates of return are annualized before display,
+       regardless of the length of reporting interval.
+
+   stats
+       stats
+       Show some journal statistics.
+
+       The stats command displays summary information for the  whole  journal,
+       or  a matched part of it.  With a reporting interval, it shows a report
+       for each report period.
+
+       Example:
+
+              $ hledger stats
+              Main journal file        : /src/hledger/examples/sample.journal
+              Included journal files   :
+              Transactions span        : 2008-01-01 to 2009-01-01 (366 days)
+              Last transaction         : 2008-12-31 (2333 days ago)
+              Transactions             : 5 (0.0 per day)
+              Transactions last 30 days: 0 (0.0 per day)
+              Transactions last 7 days : 0 (0.0 per day)
+              Payees/descriptions      : 5
+              Accounts                 : 8 (depth 3)
+              Commodities              : 1 ($)
+              Market prices            : 12 ($)
+
+       This command also supports output destination and output format  selec-
+       tion.
+
+   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.
+
+   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
+       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
+       as a bug!
+
+       This command also accepts tasty test runner options, written after a --
+       (double hyphen).  Eg to run only the tests in Hledger.Data.Amount, with
+       ANSI colour codes disabled:
+
+              $ hledger test -- -pData.Amount --color=never
+
+       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
+       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-
+       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
+       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
+         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;
+         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
+       options, journal parsing, reporting, etc.
+
+       Two  important  add-ons  are the hledger-ui and hledger-web user inter-
+       faces.  These are maintained and released along with hledger:
+
+   ui
+       hledger-ui provides an efficient terminal interface.
+
+   web
+       hledger-web provides a simple web interface.
+
+       Third party add-ons, maintained separately from hledger, include:
+
+   iadd
+       hledger-iadd is a more interactive, terminal UI replacement for the add
+       command.
+
+   interest
+       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/
+       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).
+
+       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
+       (say, an Emacs dock icon).  Eg on MacOS Catalina I have a ~/.MacOSX/en-
+       vironment.plist file containing
+
+              {
+                "LEDGER_FILE" : "~/finance/current.journal"
+              }
+
+       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
+       C:/Users/USER/.hledger.journal).
+
+LIMITATIONS
+       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
+       must be configured (or there will be an unhelpful error).  Eg on POSIX,
+       set LANG to something other than C.
+
+       In a Microsoft Windows CMD window, non-ascii characters and colours are
+       not supported.
+
+       On Windows, non-ascii characters may not display correctly when running
+       a hledger built in CMD in MSYS/CYGWIN, or vice-versa.
+
+       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
+       differences.
+
+       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
+       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,
+       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
+       need to use export.  Here's an explanation.
+
+       "Illegal byte sequence" or "Invalid or  incomplete  multibyte  or  wide
+       character" errors
+       In order to handle non-ascii letters and symbols (like ), hledger needs
+       an appropriate locale.  This is usually configured system-wide; you can
+       also configure it temporarily.  The locale may need to be one that sup-
+       ports UTF-8, if you built hledger with GHC < 7.2 (or  possibly  always,
+       I'm not sure yet).
+
+       Here's  an  example  of  setting  the  locale  temporarily,  on  ubuntu
+       gnu/linux:
+
+              $ file my.journal
+              my.journal: UTF-8 Unicode text                 # <- the file is UTF8-encoded
+              $ locale -a
+              C
+              en_US.utf8                             # <- a UTF8-aware locale is available
+              POSIX
+              $ LANG=en_US.utf8 hledger -f my.journal print   # <- use it for this command
+
+       Here's one way to set it permanently, there are probably better ways:
+
+              $ echo "export LANG=en_US.UTF-8" >>~/.bash_profile
+              $ bash --login
+
+       If we preferred to use eg fr_FR.utf8, we might  have  to  install  that
+       first:
+
+              $ apt-get install language-pack-fr
+              $ locale -a
+              C
+              en_US.utf8
+              fr_BE.utf8
+              fr_CA.utf8
+              fr_CH.utf8
+              fr_FR.utf8
+              fr_LU.utf8
+              POSIX
+              $ LANG=fr_FR.utf8 hledger -f my.journal print
+
+       Note some platforms allow variant locale spellings, but not all (ubuntu
+       accepts fr_FR.UTF8, mac osx requires exactly fr_FR.UTF-8).
+
+
+
+REPORTING BUGS
+       Report bugs at http://bugs.hledger.org (or on the #hledger IRC  channel
+       or hledger mail list)
+
+
+AUTHORS
+       Simon Michael <simon@joyful.com> and contributors
+
+
+COPYRIGHT
+       Copyright (C) 2007-2019 Simon Michael.
+       Released under GNU GPL v3 or later.
+
+
+SEE ALSO
+       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)
+
+       http://hledger.org
+
+
+
+hledger 1.17                      March 2020                        hledger(1)
diff --git a/embeddedfiles/hledger_csv.5 b/embeddedfiles/hledger_csv.5
--- a/embeddedfiles/hledger_csv.5
+++ b/embeddedfiles/hledger_csv.5
@@ -1,6 +1,6 @@
 .\"t
 
-.TH "hledger_csv" "5" "January 2020" "hledger 1.16.2" "hledger User Manuals"
+.TH "hledger_csv" "5" "March 2020" "hledger 1.17" "hledger User Manuals"
 
 
 
@@ -9,9 +9,9 @@
 CSV - how hledger reads CSV data, and the CSV rules file format
 .SH DESCRIPTION
 .PP
-hledger can read CSV (comma-separated value, or character-separated
-value) files as if they were journal files, automatically converting
-each CSV record into a transaction.
+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 \f[I]writing\f[R] CSV, see CSV output.)
 .PP
 We describe each CSV file\[aq]s format with a corresponding \f[I]rules
@@ -52,6 +52,11 @@
 assign a value to one hledger field, with interpolation
 T}
 T{
+\f[B]\f[CB]separator\f[B]\f[R]
+T}@T{
+a custom field separator
+T}
+T{
 \f[B]\f[CB]if\f[B]\f[R]
 T}@T{
 apply some rules to matched CSV records
@@ -78,7 +83,11 @@
 T}
 .TE
 .PP
-There\[aq]s also a Convert CSV files tutorial on hledger.org.
+Note, for best error messages when reading CSV files, use a
+\f[C].csv\f[R], \f[C].tsv\f[R] or \f[C].ssv\f[R] file extension or file
+prefix - see File Extension below.
+.PP
+There\[aq]s an introductory Convert CSV files tutorial on hledger.org.
 .SH EXAMPLES
 .PP
 Here are some sample hledger CSV rules files.
@@ -113,7 +122,7 @@
 .nf
 \f[C]
 $ hledger print -f basic.csv
-2019/11/12 Foo
+2019-11-12 Foo
     expenses:unknown           10.23
     income:unknown            -10.23
 \f[R]
@@ -147,7 +156,7 @@
 # We generate balance assertions by assigning to \[dq]balance\[dq]
 # above, but you may sometimes need to remove these because:
 #
-# - the CSV balance differs from the true balance, 
+# - the CSV balance differs from the true balance,
 #   by up to 0.0000000000005 in my experience
 #
 # - it is sometimes calculated based on non-chronological ordering,
@@ -167,11 +176,11 @@
 .nf
 \f[C]
 $ hledger -f bankofireland-checking.csv print
-2012/12/07 LODGMENT       529898
+2012-12-07 LODGMENT       529898
     assets:bank:boi:checking         EUR10.0 = EUR131.2
     income:unknown                  EUR-10.0
 
-2012/12/07 PAYMENT
+2012-12-07 PAYMENT
     assets:bank:boi:checking         EUR-5.0 = EUR126.0
     expenses:unknown                  EUR5.0
 \f[R]
@@ -227,10 +236,7 @@
 #include categorisation.rules
 
 # add a third posting for fees, but only if they are non-zero.
-# Commas in the data makes counting fields hard, so count from the right instead.
-# (Regex translation: \[dq]a field containing a non-zero dollar amount, 
-# immediately before the 1 right-most fields\[dq])
-if ,\[rs]$[1-9][.0-9]+(,[\[ha],]*){1}$
+if %fees [1-9]
  account3    expenses:fees
  amount3     %fees
 \f[R]
@@ -239,11 +245,11 @@
 .nf
 \f[C]
 $ hledger -f amazon-orders.csv print
-2012/07/29 (16000000000000DGLNJPI1P9B8DKPVHL) To Foo.  ; status:Completed
+2012-07-29 (16000000000000DGLNJPI1P9B8DKPVHL) To Foo.  ; status:Completed
     assets:amazon
     expenses:misc          $20.00
 
-2012/07/30 (17LA58JSKRD4HDGLNJPI1P9B8DKPVHL) To Adapteva, Inc.  ; status:Completed
+2012-07-30 (17LA58JSKRD4HDGLNJPI1P9B8DKPVHL) To Adapteva, Inc.  ; status:Completed
     assets:amazon
     expenses:misc          $25.00
     expenses:fees           $1.00
@@ -289,23 +295,21 @@
 if
 In Progress
 Temporary Hold
-Update to 
+Update to
  skip
 
 # add more fields to the description
-description %description_ %itemtitle 
+description %description_ %itemtitle
 
 # save some other fields as tags
 comment  itemid:%itemid, fromemail:%fromemail, toemail:%toemail, time:%time, type:%type, status:%status_
 
 # convert to short currency symbols
-# Note: in conditional block regexps, the line of csv being matched is
-# a synthetic one: the unquoted field values, with commas between them.
-if ,USD,
+if %currency USD
  currency $
-if ,EUR,
+if %currency EUR
  currency E
-if ,GBP,
+if %currency GBP
  currency P
 
 # generate postings
@@ -319,9 +323,8 @@
 # (account2 is set below)
 amount2  -%grossamount
 
-# if there\[aq]s a fee (9th field), add a third posting for the money taken by paypal.
-# TODO: This regexp fails when fields contain a comma (generates a third posting with zero amount)
-if \[ha]([\[ha],]+,){8}[\[ha]0]
+# if there\[aq]s a fee, add a third posting for the money taken by paypal.
+if %feeamount [1-9]
  account3 expenses:banking:paypal
  amount3  -%feeamount
  comment3 business:
@@ -329,11 +332,11 @@
 # choose an account for the second posting
 
 # override the default account names:
-# if amount (8th field) is positive, it\[aq]s income (a debit)
-if \[ha]([\[ha],]+,){7}[0-9]
+# if the amount is positive, it\[aq]s income (a debit)
+if %grossamount \[ha][\[ha]-]
  account2 income:unknown
 # if negative, it\[aq]s an expense (a credit)
-if \[ha]([\[ha],]+,){7}-
+if %grossamount \[ha]-
  account2 expenses:unknown
 
 # apply common rules for setting account2 & other tweaks
@@ -341,9 +344,9 @@
 
 # apply some overrides specific to this csv
 
-# Transfers from/to bank. These are usually marked Pending, 
+# Transfers from/to bank. These are usually marked Pending,
 # which can be disregarded in this case.
-if 
+if
 Bank Account
 Bank Deposit to PP Account
  description %type for %referencetxnid %itemtitle
@@ -386,32 +389,32 @@
 .nf
 \f[C]
 $ hledger -f paypal-custom.csv  print
-2019/10/01 (60P57143A8206782E) Calm Radio MONTHLY - $1 for the first 2 Months: Me - Order 99309. Item total: $1.00 USD first 2 months, then $6.99 / Month  ; itemid:, fromemail:simon\[at]joyful.com, toemail:memberships\[at]calmradio.com, time:03:46:20, type:Subscription Payment, status:Completed
+2019-10-01 (60P57143A8206782E) Calm Radio MONTHLY - $1 for the first 2 Months: Me - Order 99309. Item total: $1.00 USD first 2 months, then $6.99 / Month  ; itemid:, fromemail:simon\[at]joyful.com, toemail:memberships\[at]calmradio.com, time:03:46:20, type:Subscription Payment, status:Completed
     assets:online:paypal          $-6.99 = $-6.99
     expenses:online:apps           $6.99
 
-2019/10/01 (0TU1544T080463733) Bank Deposit to PP Account for 60P57143A8206782E  ; itemid:, fromemail:, toemail:simon\[at]joyful.com, time:03:46:20, type:Bank Deposit to PP Account, status:Pending
+2019-10-01 (0TU1544T080463733) Bank Deposit to PP Account for 60P57143A8206782E  ; itemid:, fromemail:, toemail:simon\[at]joyful.com, time:03:46:20, type:Bank Deposit to PP Account, status:Pending
     assets:online:paypal               $6.99 = $0.00
     assets:bank:wf:pchecking          $-6.99
 
-2019/10/01 (2722394R5F586712G) Patreon Patreon* Membership  ; itemid:, fromemail:simon\[at]joyful.com, toemail:support\[at]patreon.com, time:08:57:01, type:PreApproved Payment Bill User Payment, status:Completed
+2019-10-01 (2722394R5F586712G) Patreon Patreon* Membership  ; itemid:, fromemail:simon\[at]joyful.com, toemail:support\[at]patreon.com, time:08:57:01, type:PreApproved Payment Bill User Payment, status:Completed
     assets:online:paypal          $-7.00 = $-7.00
     expenses:dues                  $7.00
 
-2019/10/01 (71854087RG994194F) Bank Deposit to PP Account for 2722394R5F586712G Patreon* Membership  ; itemid:, fromemail:, toemail:simon\[at]joyful.com, time:08:57:01, type:Bank Deposit to PP Account, status:Pending
+2019-10-01 (71854087RG994194F) Bank Deposit to PP Account for 2722394R5F586712G Patreon* Membership  ; itemid:, fromemail:, toemail:simon\[at]joyful.com, time:08:57:01, type:Bank Deposit to PP Account, status:Pending
     assets:online:paypal               $7.00 = $0.00
     assets:bank:wf:pchecking          $-7.00
 
-2019/10/19 (K9U43044RY432050M) Wikimedia Foundation, Inc. Monthly donation to the Wikimedia Foundation  ; itemid:, fromemail:simon\[at]joyful.com, toemail:tle\[at]wikimedia.org, time:03:02:12, type:Subscription Payment, status:Completed
+2019-10-19 (K9U43044RY432050M) Wikimedia Foundation, Inc. Monthly donation to the Wikimedia Foundation  ; itemid:, fromemail:simon\[at]joyful.com, toemail:tle\[at]wikimedia.org, time:03:02:12, type:Subscription Payment, status:Completed
     assets:online:paypal             $-2.00 = $-2.00
     expenses:dues                     $2.00
     expenses:banking:paypal      ; business:
 
-2019/10/19 (3XJ107139A851061F) Bank Deposit to PP Account for K9U43044RY432050M  ; itemid:, fromemail:, toemail:simon\[at]joyful.com, time:03:02:12, type:Bank Deposit to PP Account, status:Pending
+2019-10-19 (3XJ107139A851061F) Bank Deposit to PP Account for K9U43044RY432050M  ; itemid:, fromemail:, toemail:simon\[at]joyful.com, time:03:02:12, type:Bank Deposit to PP Account, status:Pending
     assets:online:paypal               $2.00 = $0.00
     assets:bank:wf:pchecking          $-2.00
 
-2019/10/22 (6L8L1662YP1334033) Noble Benefactor Joyful Systems  ; itemid:, fromemail:noble\[at]bene.fac.tor, toemail:simon\[at]joyful.com, time:05:07:06, type:Subscription Payment, status:Completed
+2019-10-22 (6L8L1662YP1334033) Noble Benefactor Joyful Systems  ; itemid:, fromemail:noble\[at]bene.fac.tor, toemail:simon\[at]joyful.com, time:05:07:06, type:Subscription Payment, status:Completed
     assets:online:paypal                       $9.41 = $9.41
     revenues:foss donations:darcshub         $-10.00  ; business:
     expenses:banking:paypal                    $0.59  ; business:
@@ -472,6 +475,9 @@
 Currently there must be least two items (there must be at least one
 comma).
 .PP
+Note, always use comma in the fields list, even if your CSV uses another
+separator character.
+.PP
 Here are the standard hledger field/pseudo-field names.
 For more about the transaction parts they refer to, see the manual for
 hledger\[aq]s journal format.
@@ -544,17 +550,42 @@
 Interpolation strips outer whitespace (so a CSV value like
 \f[C]\[dq] 1 \[dq]\f[R] becomes \f[C]1\f[R] when interpolated) (#1051).
 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
+character-separated data.
+Eg to read SSV (Semicolon Separated Values), use:
+.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:
+.IP
+.nf
+\f[C]
+separator TAB
+\f[R]
+.fi
+.PP
+See also: File Extension.
 .SS \f[C]if\f[R]
 .IP
 .nf
 \f[C]
-if PATTERN
+if MATCHER
  RULE
 
 if
-PATTERN
-PATTERN
-PATTERN
+MATCHER
+MATCHER
+MATCHER
  RULE
  RULE
 \f[R]
@@ -565,28 +596,40 @@
 They are often used for customising account names based on transaction
 descriptions.
 .PP
-A single pattern can be written on the same line as the \[dq]if\[dq]; or
-multiple patterns can be written on the following lines, non-indented.
-Multiple patterns are OR\[aq]d (any one of them can match).
-Patterns are case-insensitive regular expressions which try to match
-anywhere within the whole CSV record (POSIX extended regular expressions
-with some additions, see
-https://hledger.org/hledger.html#regular-expressions).
-Note the CSV record they see is close to, but not identical to, the one
-in the CSV file; enclosing double quotes will be removed, and the
-separator character is always comma.
+Each MATCHER can be a record matcher, which looks like this:
+.IP
+.nf
+\f[C]
+REGEX
+\f[R]
+.fi
 .PP
-It\[aq]s not yet easy to match within a specific field.
-If the data does not contain commas, you can hack it with a regular
-expression like:
+REGEX is a case-insensitive regular expression which tries to match
+anywhere within the CSV record.
+It is a POSIX extended regular expressions with some additions (see
+Regular expressions in the hledger manual).
+Note: the \[dq]CSV record\[dq] it is matched against is not the original
+record, but a synthetic one, with enclosing double quotes or whitespace
+removed, and always comma-separated.
+(Eg, an SSV record \f[C]2020-01-01; \[dq]Acme, Inc.\[dq]; 1,000\f[R]
+appears to REGEX as \f[C]2020-01-01,Acme, Inc.,1,000\f[R]).
+.PP
+Or, MATCHER can be a field matcher, like this:
 .IP
 .nf
 \f[C]
-# match \[dq]foo\[dq] in the fourth field
-if \[ha]([\[ha],]*,){3}foo
+%CSVFIELD REGEX
 \f[R]
 .fi
 .PP
+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].
+.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).
+.PP
 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:
@@ -763,6 +806,23 @@
 \f[R]
 .fi
 .SH TIPS
+.SS Rapid feedback
+.PP
+It\[aq]s a good idea to get rapid feedback while
+creating/troubleshooting CSV rules.
+Here\[aq]s a good way, using entr from http://eradman.com/entrproject :
+.IP
+.nf
+\f[C]
+$ ls foo.csv* | entr bash -c \[aq]echo ----; hledger -f foo.csv print desc:SOMEDESC\[aq]
+\f[R]
+.fi
+.PP
+A desc: query (eg) is used to select just one, or a few, transactions of
+interest.
+\[dq]bash -c\[dq] 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.
 .SS Valid CSV
 .PP
 hledger accepts CSV conforming to RFC 4180.
@@ -771,19 +831,32 @@
 they must be double quotes (not single quotes)
 .IP \[bu] 2
 spaces outside the quotes are not allowed
-.SS Other separator characters
+.SS File Extension
 .PP
-With the \f[C]--separator \[aq]CHAR\[aq]\f[R] option (experimental),
-hledger will expect the separator to be CHAR instead of a comma.
-Ie it will read other \[dq]Character Separated Values\[dq] formats, such
-as TSV (Tab Separated Values).
-Note: on the command line, use a real tab character in quotes, not Eg:
+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:
 .IP
 .nf
 \f[C]
-$ hledger -f foo.tsv --separator \[aq]  \[aq] print
+$ hledger -f foo.ssv print
 \f[R]
 .fi
+.PP
+or:
+.IP
+.nf
+\f[C]
+$ cat foo | hledger -f ssv:- foo
+\f[R]
+.fi
+.PP
+More about this: 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
diff --git a/embeddedfiles/hledger_csv.info b/embeddedfiles/hledger_csv.info
--- a/embeddedfiles/hledger_csv.info
+++ b/embeddedfiles/hledger_csv.info
@@ -3,11 +3,13 @@
 
 File: hledger_csv.info,  Node: Top,  Next: EXAMPLES,  Up: (dir)
 
-hledger_csv(5) hledger 1.16.2
-*****************************
+hledger_csv(5) hledger 1.17
+***************************
 
-hledger can read CSV (comma-separated value, or character-separated
-value) files as if they were journal files, automatically converting
+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.)
 
@@ -30,14 +32,19 @@
 *'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
 
-   There's also a Convert CSV files tutorial on hledger.org.
+   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.
+
 * Menu:
 
 * EXAMPLES::
@@ -80,7 +87,7 @@
 date-format  %d/%m/%Y
 
 $ hledger print -f basic.csv
-2019/11/12 Foo
+2019-11-12 Foo
     expenses:unknown           10.23
     income:unknown            -10.23
 
@@ -111,7 +118,7 @@
 # We generate balance assertions by assigning to "balance"
 # above, but you may sometimes need to remove these because:
 #
-# - the CSV balance differs from the true balance, 
+# - the CSV balance differs from the true balance,
 #   by up to 0.0000000000005 in my experience
 #
 # - it is sometimes calculated based on non-chronological ordering,
@@ -127,11 +134,11 @@
 account1  assets:bank:boi:checking
 
 $ hledger -f bankofireland-checking.csv print
-2012/12/07 LODGMENT       529898
+2012-12-07 LODGMENT       529898
     assets:bank:boi:checking         EUR10.0 = EUR131.2
     income:unknown                  EUR-10.0
 
-2012/12/07 PAYMENT
+2012-12-07 PAYMENT
     assets:bank:boi:checking         EUR-5.0 = EUR126.0
     expenses:unknown                  EUR5.0
 
@@ -183,19 +190,16 @@
 #include categorisation.rules
 
 # add a third posting for fees, but only if they are non-zero.
-# Commas in the data makes counting fields hard, so count from the right instead.
-# (Regex translation: "a field containing a non-zero dollar amount, 
-# immediately before the 1 right-most fields")
-if ,\$[1-9][.0-9]+(,[^,]*){1}$
+if %fees [1-9]
  account3    expenses:fees
  amount3     %fees
 
 $ hledger -f amazon-orders.csv print
-2012/07/29 (16000000000000DGLNJPI1P9B8DKPVHL) To Foo.  ; status:Completed
+2012-07-29 (16000000000000DGLNJPI1P9B8DKPVHL) To Foo.  ; status:Completed
     assets:amazon
     expenses:misc          $20.00
 
-2012/07/30 (17LA58JSKRD4HDGLNJPI1P9B8DKPVHL) To Adapteva, Inc.  ; status:Completed
+2012-07-30 (17LA58JSKRD4HDGLNJPI1P9B8DKPVHL) To Adapteva, Inc.  ; status:Completed
     assets:amazon
     expenses:misc          $25.00
     expenses:fees           $1.00
@@ -238,23 +242,21 @@
 if
 In Progress
 Temporary Hold
-Update to 
+Update to
  skip
 
 # add more fields to the description
-description %description_ %itemtitle 
+description %description_ %itemtitle
 
 # save some other fields as tags
 comment  itemid:%itemid, fromemail:%fromemail, toemail:%toemail, time:%time, type:%type, status:%status_
 
 # convert to short currency symbols
-# Note: in conditional block regexps, the line of csv being matched is
-# a synthetic one: the unquoted field values, with commas between them.
-if ,USD,
+if %currency USD
  currency $
-if ,EUR,
+if %currency EUR
  currency E
-if ,GBP,
+if %currency GBP
  currency P
 
 # generate postings
@@ -268,9 +270,8 @@
 # (account2 is set below)
 amount2  -%grossamount
 
-# if there's a fee (9th field), add a third posting for the money taken by paypal.
-# TODO: This regexp fails when fields contain a comma (generates a third posting with zero amount)
-if ^([^,]+,){8}[^0]
+# if there's a fee, add a third posting for the money taken by paypal.
+if %feeamount [1-9]
  account3 expenses:banking:paypal
  amount3  -%feeamount
  comment3 business:
@@ -278,11 +279,11 @@
 # choose an account for the second posting
 
 # override the default account names:
-# if amount (8th field) is positive, it's income (a debit)
-if ^([^,]+,){7}[0-9]
+# if the amount is positive, it's income (a debit)
+if %grossamount ^[^-]
  account2 income:unknown
 # if negative, it's an expense (a credit)
-if ^([^,]+,){7}-
+if %grossamount ^-
  account2 expenses:unknown
 
 # apply common rules for setting account2 & other tweaks
@@ -290,9 +291,9 @@
 
 # apply some overrides specific to this csv
 
-# Transfers from/to bank. These are usually marked Pending, 
+# Transfers from/to bank. These are usually marked Pending,
 # which can be disregarded in this case.
-if 
+if
 Bank Account
 Bank Deposit to PP Account
  description %type for %referencetxnid %itemtitle
@@ -327,32 +328,32 @@
  description google | music
 
 $ hledger -f paypal-custom.csv  print
-2019/10/01 (60P57143A8206782E) Calm Radio MONTHLY - $1 for the first 2 Months: Me - Order 99309. Item total: $1.00 USD first 2 months, then $6.99 / Month  ; itemid:, fromemail:simon@joyful.com, toemail:memberships@calmradio.com, time:03:46:20, type:Subscription Payment, status:Completed
+2019-10-01 (60P57143A8206782E) Calm Radio MONTHLY - $1 for the first 2 Months: Me - Order 99309. Item total: $1.00 USD first 2 months, then $6.99 / Month  ; itemid:, fromemail:simon@joyful.com, toemail:memberships@calmradio.com, time:03:46:20, type:Subscription Payment, status:Completed
     assets:online:paypal          $-6.99 = $-6.99
     expenses:online:apps           $6.99
 
-2019/10/01 (0TU1544T080463733) Bank Deposit to PP Account for 60P57143A8206782E  ; itemid:, fromemail:, toemail:simon@joyful.com, time:03:46:20, type:Bank Deposit to PP Account, status:Pending
+2019-10-01 (0TU1544T080463733) Bank Deposit to PP Account for 60P57143A8206782E  ; itemid:, fromemail:, toemail:simon@joyful.com, time:03:46:20, type:Bank Deposit to PP Account, status:Pending
     assets:online:paypal               $6.99 = $0.00
     assets:bank:wf:pchecking          $-6.99
 
-2019/10/01 (2722394R5F586712G) Patreon Patreon* Membership  ; itemid:, fromemail:simon@joyful.com, toemail:support@patreon.com, time:08:57:01, type:PreApproved Payment Bill User Payment, status:Completed
+2019-10-01 (2722394R5F586712G) Patreon Patreon* Membership  ; itemid:, fromemail:simon@joyful.com, toemail:support@patreon.com, time:08:57:01, type:PreApproved Payment Bill User Payment, status:Completed
     assets:online:paypal          $-7.00 = $-7.00
     expenses:dues                  $7.00
 
-2019/10/01 (71854087RG994194F) Bank Deposit to PP Account for 2722394R5F586712G Patreon* Membership  ; itemid:, fromemail:, toemail:simon@joyful.com, time:08:57:01, type:Bank Deposit to PP Account, status:Pending
+2019-10-01 (71854087RG994194F) Bank Deposit to PP Account for 2722394R5F586712G Patreon* Membership  ; itemid:, fromemail:, toemail:simon@joyful.com, time:08:57:01, type:Bank Deposit to PP Account, status:Pending
     assets:online:paypal               $7.00 = $0.00
     assets:bank:wf:pchecking          $-7.00
 
-2019/10/19 (K9U43044RY432050M) Wikimedia Foundation, Inc. Monthly donation to the Wikimedia Foundation  ; itemid:, fromemail:simon@joyful.com, toemail:tle@wikimedia.org, time:03:02:12, type:Subscription Payment, status:Completed
+2019-10-19 (K9U43044RY432050M) Wikimedia Foundation, Inc. Monthly donation to the Wikimedia Foundation  ; itemid:, fromemail:simon@joyful.com, toemail:tle@wikimedia.org, time:03:02:12, type:Subscription Payment, status:Completed
     assets:online:paypal             $-2.00 = $-2.00
     expenses:dues                     $2.00
     expenses:banking:paypal      ; business:
 
-2019/10/19 (3XJ107139A851061F) Bank Deposit to PP Account for K9U43044RY432050M  ; itemid:, fromemail:, toemail:simon@joyful.com, time:03:02:12, type:Bank Deposit to PP Account, status:Pending
+2019-10-19 (3XJ107139A851061F) Bank Deposit to PP Account for K9U43044RY432050M  ; itemid:, fromemail:, toemail:simon@joyful.com, time:03:02:12, type:Bank Deposit to PP Account, status:Pending
     assets:online:paypal               $2.00 = $0.00
     assets:bank:wf:pchecking          $-2.00
 
-2019/10/22 (6L8L1662YP1334033) Noble Benefactor Joyful Systems  ; itemid:, fromemail:noble@bene.fac.tor, toemail:simon@joyful.com, time:05:07:06, type:Subscription Payment, status:Completed
+2019-10-22 (6L8L1662YP1334033) Noble Benefactor Joyful Systems  ; itemid:, fromemail:noble@bene.fac.tor, toemail:simon@joyful.com, time:05:07:06, type:Subscription Payment, status:Completed
     assets:online:paypal                       $9.41 = $9.41
     revenues:foss donations:darcshub         $-10.00  ; business:
     expenses:banking:paypal                    $0.59  ; business:
@@ -371,6 +372,7 @@
 * skip::
 * fields::
 * field assignment::
+* separator::
 * if::
 * end::
 * date-format::
@@ -422,6 +424,9 @@
 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
+another separator character.
+
    Here are the standard hledger field/pseudo-field names.  For more
 about the transaction parts they refer to, see the manual for hledger's
 journal format.
@@ -476,7 +481,7 @@
    See TIPS below for more about setting amounts and currency.
 
 
-File: hledger_csv.info,  Node: field assignment,  Next: if,  Prev: fields,  Up: CSV RULES
+File: hledger_csv.info,  Node: field assignment,  Next: separator,  Prev: fields,  Up: CSV RULES
 
 2.3 field assignment
 ====================
@@ -501,18 +506,38 @@
 referencing other fields.
 
 
-File: hledger_csv.info,  Node: if,  Next: end,  Prev: field assignment,  Up: CSV RULES
+File: hledger_csv.info,  Node: separator,  Next: if,  Prev: field assignment,  Up: CSV RULES
 
-2.4 'if'
+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:
+
+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:
+
+separator TAB
+
+   See also: File Extension.
+
+
+File: hledger_csv.info,  Node: if,  Next: end,  Prev: separator,  Up: CSV RULES
+
+2.5 'if'
 ========
 
-if PATTERN
+if MATCHER
  RULE
 
 if
-PATTERN
-PATTERN
-PATTERN
+MATCHER
+MATCHER
+MATCHER
  RULE
  RULE
 
@@ -521,22 +546,31 @@
 often used for customising account names based on transaction
 descriptions.
 
-   A single pattern can be written on the same line as the "if"; or
-multiple patterns can be written on the following lines, non-indented.
-Multiple patterns are OR'd (any one of them can match).  Patterns are
-case-insensitive regular expressions which try to match anywhere within
-the whole CSV record (POSIX extended regular expressions with some
-additions, see https://hledger.org/hledger.html#regular-expressions).
-Note the CSV record they see is close to, but not identical to, the one
-in the CSV file; enclosing double quotes will be removed, and the
-separator character is always comma.
+   Each MATCHER can be a record matcher, which looks like this:
 
-   It's not yet easy to match within a specific field.  If the data does
-not contain commas, you can hack it with a regular expression like:
+REGEX
 
-# match "foo" in the fourth field
-if ^([^,]*,){3}foo
+   REGEX is a case-insensitive regular expression which tries to match
+anywhere within the CSV record.  It is a POSIX extended regular
+expressions with some additions (see Regular expressions in the hledger
+manual).  Note: the "CSV record" it is matched against is not the
+original record, but a synthetic one, with enclosing double quotes or
+whitespace removed, and always comma-separated.  (Eg, an SSV record
+'2020-01-01; "Acme, Inc."; 1,000' appears to REGEX as '2020-01-01,Acme,
+Inc.,1,000').
 
+   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
+multiple matchers can be written on the following lines, non-indented.
+Multiple matchers are OR'd (any one of them can 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:
@@ -562,7 +596,7 @@
 
 File: hledger_csv.info,  Node: end,  Next: date-format,  Prev: if,  Up: CSV RULES
 
-2.5 'end'
+2.6 'end'
 =========
 
 This rule can be used inside if blocks (only), to make hledger stop
@@ -576,7 +610,7 @@
 
 File: hledger_csv.info,  Node: date-format,  Next: newest-first,  Prev: end,  Up: CSV RULES
 
-2.6 'date-format'
+2.7 'date-format'
 =================
 
 date-format DATEFMT
@@ -607,7 +641,7 @@
 
 File: hledger_csv.info,  Node: newest-first,  Next: include,  Prev: date-format,  Up: CSV RULES
 
-2.7 'newest-first'
+2.8 'newest-first'
 ==================
 
 hledger always sorts the generated transactions by date.  Transactions
@@ -629,7 +663,7 @@
 
 File: hledger_csv.info,  Node: include,  Next: balance-type,  Prev: newest-first,  Up: CSV RULES
 
-2.8 'include'
+2.9 'include'
 =============
 
 include RULESFILE
@@ -652,8 +686,8 @@
 
 File: hledger_csv.info,  Node: balance-type,  Prev: include,  Up: CSV RULES
 
-2.9 'balance-type'
-==================
+2.10 'balance-type'
+===================
 
 Balance assertions generated by assigning to balanceN are of the simple
 '=' type by default, which is a single-commodity, subaccount-excluding
@@ -680,8 +714,9 @@
 
 * Menu:
 
+* Rapid feedback::
 * Valid CSV::
-* Other separator characters::
+* File Extension::
 * Reading multiple CSV files::
 * Valid transactions::
 * Deduplicating importing::
@@ -691,9 +726,26 @@
 * How CSV rules are evaluated::
 
 
-File: hledger_csv.info,  Node: Valid CSV,  Next: Other separator characters,  Up: TIPS
+File: hledger_csv.info,  Node: Rapid feedback,  Next: Valid CSV,  Up: TIPS
 
-3.1 Valid CSV
+3.1 Rapid feedback
+==================
+
+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/entrproject :
+
+$ 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 read the
+output.
+
+
+File: hledger_csv.info,  Node: Valid CSV,  Next: File Extension,  Prev: Rapid feedback,  Up: TIPS
+
+3.2 Valid CSV
 =============
 
 hledger accepts CSV conforming to RFC 4180.  When CSV values are
@@ -703,23 +755,29 @@
    * spaces outside the quotes are not allowed
 
 
-File: hledger_csv.info,  Node: Other separator characters,  Next: Reading multiple CSV files,  Prev: Valid CSV,  Up: TIPS
+File: hledger_csv.info,  Node: File Extension,  Next: Reading multiple CSV files,  Prev: Valid CSV,  Up: TIPS
 
-3.2 Other separator characters
-==============================
+3.3 File Extension
+==================
 
-With the '--separator 'CHAR'' option (experimental), hledger will expect
-the separator to be CHAR instead of a comma.  Ie it will read other
-"Character Separated Values" formats, such as TSV (Tab Separated
-Values).  Note: on the command line, use a real tab character in quotes,
-not
+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:
 
-$ hledger -f foo.tsv --separator '  ' print
+$ hledger -f foo.ssv print
 
+   or:
+
+$ cat foo | hledger -f ssv:- foo
+
+   More about this: Input files in the hledger manual.
+
 
-File: hledger_csv.info,  Node: Reading multiple CSV files,  Next: Valid transactions,  Prev: Other separator characters,  Up: TIPS
+File: hledger_csv.info,  Node: Reading multiple CSV files,  Next: Valid transactions,  Prev: File Extension,  Up: TIPS
 
-3.3 Reading multiple CSV files
+3.4 Reading multiple CSV files
 ==============================
 
 If you use multiple '-f' options to read multiple CSV files at once,
@@ -730,7 +788,7 @@
 
 File: hledger_csv.info,  Node: Valid transactions,  Next: Deduplicating importing,  Prev: Reading multiple CSV files,  Up: TIPS
 
-3.4 Valid transactions
+3.5 Valid transactions
 ======================
 
 After reading a CSV file, hledger post-processes and validates the
@@ -749,7 +807,7 @@
 
 File: hledger_csv.info,  Node: Deduplicating importing,  Next: Setting amounts,  Prev: Valid transactions,  Up: TIPS
 
-3.5 Deduplicating, importing
+3.6 Deduplicating, importing
 ============================
 
 When you download a CSV file periodically, eg to get your latest bank
@@ -779,7 +837,7 @@
 
 File: hledger_csv.info,  Node: Setting amounts,  Next: Setting currency/commodity,  Prev: Deduplicating importing,  Up: TIPS
 
-3.6 Setting amounts
+3.7 Setting amounts
 ===================
 
 A posting amount can be set in one of these ways:
@@ -808,7 +866,7 @@
 
 File: hledger_csv.info,  Node: Setting currency/commodity,  Next: Referencing other fields,  Prev: Setting amounts,  Up: TIPS
 
-3.7 Setting currency/commodity
+3.8 Setting currency/commodity
 ==============================
 
 If the currency/commodity symbol is included in the CSV's amount
@@ -835,7 +893,7 @@
 
 File: hledger_csv.info,  Node: Referencing other fields,  Next: How CSV rules are evaluated,  Prev: Setting currency/commodity,  Up: TIPS
 
-3.8 Referencing other fields
+3.9 Referencing other fields
 ============================
 
 In field assignments, you can interpolate only CSV fields, not hledger
@@ -872,8 +930,8 @@
 
 File: hledger_csv.info,  Node: How CSV rules are evaluated,  Prev: Referencing other fields,  Up: TIPS
 
-3.9 How CSV rules are evaluated
-===============================
+3.10 How CSV rules are evaluated
+================================
 
 Here's how to think of CSV rules being evaluated (if you really need
 to).  First,
@@ -913,60 +971,64 @@
 
 Tag Table:
 Node: Top72
-Node: EXAMPLES1833
-Ref: #examples1939
-Node: Basic2147
-Ref: #basic2247
-Node: Bank of Ireland2789
-Ref: #bank-of-ireland2924
-Node: Amazon4387
-Ref: #amazon4505
-Node: Paypal6438
-Ref: #paypal6532
-Node: CSV RULES14415
-Ref: #csv-rules14524
-Node: skip14786
-Ref: #skip14879
-Node: fields15254
-Ref: #fields15376
-Node: Transaction field names16443
-Ref: #transaction-field-names16603
-Node: Posting field names16714
-Ref: #posting-field-names16866
-Node: field assignment18157
-Ref: #field-assignment18293
-Node: if19111
-Ref: #if19220
-Node: end20936
-Ref: #end21042
-Node: date-format21266
-Ref: #date-format21398
-Node: newest-first22147
-Ref: #newest-first22285
-Node: include22968
-Ref: #include23097
-Node: balance-type23541
-Ref: #balance-type23659
-Node: TIPS24359
-Ref: #tips24441
-Node: Valid CSV24690
-Ref: #valid-csv24809
-Node: Other separator characters25001
-Ref: #other-separator-characters25189
-Node: Reading multiple CSV files25518
-Ref: #reading-multiple-csv-files25715
-Node: Valid transactions25956
-Ref: #valid-transactions26134
-Node: Deduplicating importing26762
-Ref: #deduplicating-importing26941
-Node: Setting amounts27974
-Ref: #setting-amounts28143
-Node: Setting currency/commodity29129
-Ref: #setting-currencycommodity29321
-Node: Referencing other fields30124
-Ref: #referencing-other-fields30324
-Node: How CSV rules are evaluated31221
-Ref: #how-csv-rules-are-evaluated31392
+Node: EXAMPLES2093
+Ref: #examples2199
+Node: Basic2407
+Ref: #basic2507
+Node: Bank of Ireland3049
+Ref: #bank-of-ireland3184
+Node: Amazon4646
+Ref: #amazon4764
+Node: Paypal6483
+Ref: #paypal6577
+Node: CSV RULES14221
+Ref: #csv-rules14330
+Node: skip14606
+Ref: #skip14699
+Node: fields15074
+Ref: #fields15196
+Node: Transaction field names16361
+Ref: #transaction-field-names16521
+Node: Posting field names16632
+Ref: #posting-field-names16784
+Node: field assignment18075
+Ref: #field-assignment18218
+Node: separator19036
+Ref: #separator19165
+Node: if19576
+Ref: #if19678
+Node: end21597
+Ref: #end21703
+Node: date-format21927
+Ref: #date-format22059
+Node: newest-first22808
+Ref: #newest-first22946
+Node: include23629
+Ref: #include23758
+Node: balance-type24202
+Ref: #balance-type24322
+Node: TIPS25022
+Ref: #tips25104
+Node: Rapid feedback25360
+Ref: #rapid-feedback25477
+Node: Valid CSV25937
+Ref: #valid-csv26067
+Node: File Extension26259
+Ref: #file-extension26411
+Node: Reading multiple CSV files26821
+Ref: #reading-multiple-csv-files27006
+Node: Valid transactions27247
+Ref: #valid-transactions27425
+Node: Deduplicating importing28053
+Ref: #deduplicating-importing28232
+Node: Setting amounts29265
+Ref: #setting-amounts29434
+Node: Setting currency/commodity30420
+Ref: #setting-currencycommodity30612
+Node: Referencing other fields31415
+Ref: #referencing-other-fields31615
+Node: How CSV rules are evaluated32512
+Ref: #how-csv-rules-are-evaluated32685
 
 End Tag Table
 
diff --git a/embeddedfiles/hledger_csv.txt b/embeddedfiles/hledger_csv.txt
--- a/embeddedfiles/hledger_csv.txt
+++ b/embeddedfiles/hledger_csv.txt
@@ -7,10 +7,10 @@
        CSV - how hledger reads CSV data, and the CSV rules file format
 
 DESCRIPTION
-       hledger  can  read  CSV  (comma-separated value, or 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 (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.)
 
        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.
@@ -34,6 +34,7 @@
        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
@@ -45,16 +46,19 @@
        include            inline  another  CSV rules
                           file
 
-       There's also a Convert CSV files tutorial on hledger.org.
+       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
@@ -66,15 +70,15 @@
               date-format  %d/%m/%Y
 
               $ hledger print -f basic.csv
-              2019/11/12 Foo
+              2019-11-12 Foo
                   expenses:unknown           10.23
                   income:unknown            -10.23
 
        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
@@ -108,21 +112,21 @@
               account1  assets:bank:boi:checking
 
               $ hledger -f bankofireland-checking.csv print
-              2012/12/07 LODGMENT       529898
+              2012-12-07 LODGMENT       529898
                   assets:bank:boi:checking         EUR10.0 = EUR131.2
                   income:unknown                  EUR-10.0
 
-              2012/12/07 PAYMENT
+              2012-12-07 PAYMENT
                   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"
@@ -159,25 +163,22 @@
               #include categorisation.rules
 
               # add a third posting for fees, but only if they are non-zero.
-              # Commas in the data makes counting fields hard, so count from the right instead.
-              # (Regex translation: "a field containing a non-zero dollar amount,
-              # immediately before the 1 right-most fields")
-              if ,\$[1-9][.0-9]+(,[^,]*){1}$
+              if %fees [1-9]
                account3    expenses:fees
                amount3     %fees
 
               $ hledger -f amazon-orders.csv print
-              2012/07/29 (16000000000000DGLNJPI1P9B8DKPVHL) To Foo.  ; status:Completed
+              2012-07-29 (16000000000000DGLNJPI1P9B8DKPVHL) To Foo.  ; status:Completed
                   assets:amazon
                   expenses:misc          $20.00
 
-              2012/07/30 (17LA58JSKRD4HDGLNJPI1P9B8DKPVHL) To Adapteva, Inc.  ; status:Completed
+              2012-07-30 (17LA58JSKRD4HDGLNJPI1P9B8DKPVHL) To Adapteva, Inc.  ; status:Completed
                   assets:amazon
                   expenses:misc          $25.00
                   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"
@@ -219,13 +220,11 @@
               comment  itemid:%itemid, fromemail:%fromemail, toemail:%toemail, time:%time, type:%type, status:%status_
 
               # convert to short currency symbols
-              # Note: in conditional block regexps, the line of csv being matched is
-              # a synthetic one: the unquoted field values, with commas between them.
-              if ,USD,
+              if %currency USD
                currency $
-              if ,EUR,
+              if %currency EUR
                currency E
-              if ,GBP,
+              if %currency GBP
                currency P
 
               # generate postings
@@ -239,9 +238,8 @@
               # (account2 is set below)
               amount2  -%grossamount
 
-              # if there's a fee (9th field), add a third posting for the money taken by paypal.
-              # TODO: This regexp fails when fields contain a comma (generates a third posting with zero amount)
-              if ^([^,]+,){8}[^0]
+              # if there's a fee, add a third posting for the money taken by paypal.
+              if %feeamount [1-9]
                account3 expenses:banking:paypal
                amount3  -%feeamount
                comment3 business:
@@ -249,11 +247,11 @@
               # choose an account for the second posting
 
               # override the default account names:
-              # if amount (8th field) is positive, it's income (a debit)
-              if ^([^,]+,){7}[0-9]
+              # if the amount is positive, it's income (a debit)
+              if %grossamount ^[^-]
                account2 income:unknown
               # if negative, it's an expense (a credit)
-              if ^([^,]+,){7}-
+              if %grossamount ^-
                account2 expenses:unknown
 
               # apply common rules for setting account2 & other tweaks
@@ -298,32 +296,32 @@
                description google | music
 
               $ hledger -f paypal-custom.csv  print
-              2019/10/01 (60P57143A8206782E) Calm Radio MONTHLY - $1 for the first 2 Months: Me - Order 99309. Item total: $1.00 USD first 2 months, then $6.99 / Month  ; itemid:, fromemail:simon@joyful.com, toemail:memberships@calmradio.com, time:03:46:20, type:Subscription Payment, status:Completed
+              2019-10-01 (60P57143A8206782E) Calm Radio MONTHLY - $1 for the first 2 Months: Me - Order 99309. Item total: $1.00 USD first 2 months, then $6.99 / Month  ; itemid:, fromemail:simon@joyful.com, toemail:memberships@calmradio.com, time:03:46:20, type:Subscription Payment, status:Completed
                   assets:online:paypal          $-6.99 = $-6.99
                   expenses:online:apps           $6.99
 
-              2019/10/01 (0TU1544T080463733) Bank Deposit to PP Account for 60P57143A8206782E  ; itemid:, fromemail:, toemail:simon@joyful.com, time:03:46:20, type:Bank Deposit to PP Account, status:Pending
+              2019-10-01 (0TU1544T080463733) Bank Deposit to PP Account for 60P57143A8206782E  ; itemid:, fromemail:, toemail:simon@joyful.com, time:03:46:20, type:Bank Deposit to PP Account, status:Pending
                   assets:online:paypal               $6.99 = $0.00
                   assets:bank:wf:pchecking          $-6.99
 
-              2019/10/01 (2722394R5F586712G) Patreon Patreon* Membership  ; itemid:, fromemail:simon@joyful.com, toemail:support@patreon.com, time:08:57:01, type:PreApproved Payment Bill User Payment, status:Completed
+              2019-10-01 (2722394R5F586712G) Patreon Patreon* Membership  ; itemid:, fromemail:simon@joyful.com, toemail:support@patreon.com, time:08:57:01, type:PreApproved Payment Bill User Payment, status:Completed
                   assets:online:paypal          $-7.00 = $-7.00
                   expenses:dues                  $7.00
 
-              2019/10/01 (71854087RG994194F) Bank Deposit to PP Account for 2722394R5F586712G Patreon* Membership  ; itemid:, fromemail:, toemail:simon@joyful.com, time:08:57:01, type:Bank Deposit to PP Account, status:Pending
+              2019-10-01 (71854087RG994194F) Bank Deposit to PP Account for 2722394R5F586712G Patreon* Membership  ; itemid:, fromemail:, toemail:simon@joyful.com, time:08:57:01, type:Bank Deposit to PP Account, status:Pending
                   assets:online:paypal               $7.00 = $0.00
                   assets:bank:wf:pchecking          $-7.00
 
-              2019/10/19 (K9U43044RY432050M) Wikimedia Foundation, Inc. Monthly donation to the Wikimedia Foundation  ; itemid:, fromemail:simon@joyful.com, toemail:tle@wikimedia.org, time:03:02:12, type:Subscription Payment, status:Completed
+              2019-10-19 (K9U43044RY432050M) Wikimedia Foundation, Inc. Monthly donation to the Wikimedia Foundation  ; itemid:, fromemail:simon@joyful.com, toemail:tle@wikimedia.org, time:03:02:12, type:Subscription Payment, status:Completed
                   assets:online:paypal             $-2.00 = $-2.00
                   expenses:dues                     $2.00
                   expenses:banking:paypal      ; business:
 
-              2019/10/19 (3XJ107139A851061F) Bank Deposit to PP Account for K9U43044RY432050M  ; itemid:, fromemail:, toemail:simon@joyful.com, time:03:02:12, type:Bank Deposit to PP Account, status:Pending
+              2019-10-19 (3XJ107139A851061F) Bank Deposit to PP Account for K9U43044RY432050M  ; itemid:, fromemail:, toemail:simon@joyful.com, time:03:02:12, type:Bank Deposit to PP Account, status:Pending
                   assets:online:paypal               $2.00 = $0.00
                   assets:bank:wf:pchecking          $-2.00
 
-              2019/10/22 (6L8L1662YP1334033) Noble Benefactor Joyful Systems  ; itemid:, fromemail:noble@bene.fac.tor, toemail:simon@joyful.com, time:05:07:06, type:Subscription Payment, status:Completed
+              2019-10-22 (6L8L1662YP1334033) Noble Benefactor Joyful Systems  ; itemid:, fromemail:noble@bene.fac.tor, toemail:simon@joyful.com, time:05:07:06, type:Subscription Payment, status:Completed
                   assets:online:paypal                       $9.41 = $9.41
                   revenues:foss donations:darcshub         $-10.00  ; business:
                   expenses:banking:paypal                    $0.59  ; business:
@@ -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,26 +344,29 @@
    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-
+       other separator character.
+
        Here are the standard hledger field/pseudo-field names.  For more about
        the transaction parts they refer to, see the manual for hledger's jour-
        nal format.
@@ -424,37 +425,59 @@
        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:
+
+              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:
+
+              separator TAB
+
+       See also: File Extension.
+
    if
-              if PATTERN
+              if MATCHER
                RULE
 
               if
-              PATTERN
-              PATTERN
-              PATTERN
+              MATCHER
+              MATCHER
+              MATCHER
                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.
 
-       A single pattern can be written on the same line as the "if"; or multi-
-       ple patterns can be written on the following lines, non-indented.  Mul-
-       tiple patterns are OR'd (any one of  them  can  match).   Patterns  are
-       case-insensitive regular expressions which try to match anywhere within
-       the whole CSV record (POSIX extended regular expressions with some  ad-
-       ditions,   see   https://hledger.org/hledger.html#regular-expressions).
-       Note the CSV record they see is close to, but not identical to, the one
-       in the CSV file; enclosing double quotes will be removed, and the sepa-
-       rator character is always comma.
+       Each MATCHER can be a record matcher, which looks like this:
 
-       It's not yet easy to match within a specific field.  If the  data  does
-       not contain commas, you can hack it with a regular expression like:
+              REGEX
 
-              # match "foo" in the fourth field
-              if ^([^,]*,){3}foo
+       REGEX  is  a  case-insensitive  regular expression which tries to match
+       anywhere within the CSV record.  It is a POSIX extended regular expres-
+       sions  with some additions (see Regular expressions in the hledger man-
+       ual).  Note: the "CSV record" it is matched against is not the original
+       record, but a synthetic one, with enclosing double quotes or whitespace
+       removed, and always comma-separated.  (Eg, an  SSV  record  2020-01-01;
+       "Acme, Inc."; 1,000 appears to REGEX as 2020-01-01,Acme, Inc.,1,000).
 
+       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 multi-
+       ple matchers can be written on the following lines, non-indented.  Mul-
+       tiple matchers are OR'd (any one of them can 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:
@@ -571,23 +594,40 @@
               ==*  multi commodity,  include subaccounts
 
 TIPS
+   Rapid feedback
+       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
+       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)
 
        o spaces outside the quotes are not allowed
 
-   Other separator characters
-       With the --separator 'CHAR' option (experimental), hledger will  expect
-       the  separator  to  be  CHAR instead of a comma.  Ie it will read other
-       "Character Separated Values" formats, such as TSV (Tab  Separated  Val-
-       ues).   Note:  on the command line, use a real tab character in quotes,
-       not Eg:
+   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:
 
-              $ hledger -f foo.tsv --separator '  ' print
+              $ hledger -f foo.ssv print
 
+       or:
+
+              $ cat foo | hledger -f ssv:- foo
+
+       More about this: Input files in the hledger manual.
+
    Reading multiple CSV files
        If you use multiple -f options to read  multiple  CSV  files  at  once,
        hledger  will  look for a correspondingly-named rules file for each CSV
@@ -779,4 +819,4 @@
 
 
 
-hledger 1.16.2                   January 2020                   hledger_csv(5)
+hledger 1.17                      March 2020                    hledger_csv(5)
diff --git a/embeddedfiles/hledger_journal.5 b/embeddedfiles/hledger_journal.5
--- a/embeddedfiles/hledger_journal.5
+++ b/embeddedfiles/hledger_journal.5
@@ -1,6 +1,6 @@
 .\"t
 
-.TH "hledger_journal" "5" "January 2020" "hledger 1.16.2" "hledger User Manuals"
+.TH "hledger_journal" "5" "March 2020" "hledger 1.17" "hledger User Manuals"
 
 
 
@@ -26,124 +26,92 @@
 same journal file, eg to validate the results you\[aq]re getting.
 .PP
 You can use hledger without learning any more about this file; just use
-the add or web commands to create and update it.
-Many users, though, also edit the journal file directly with a text
-editor, perhaps assisted by the helper modes for emacs or vim.
+the add or web or import commands to create and update it.
 .PP
-Here\[aq]s an example:
-.IP
-.nf
-\f[C]
-; A sample journal file. This is a comment.
-
-2008/01/01 income             ; <- transaction\[aq]s first line starts in column 0, contains date and description
-    assets:bank:checking  $1  ; <- posting lines start with whitespace, each contains an account name
-    income:salary        $-1  ;    followed by at least two spaces and an amount
-
-2008/06/01 gift
-    assets:bank:checking  $1  ; <- at least two postings in a transaction
-    income:gifts         $-1  ; <- their amounts must balance to 0
-
-2008/06/02 save
-    assets:bank:saving    $1
-    assets:bank:checking      ; <- one amount may be omitted; here $-1 is inferred
-
-2008/06/03 eat & shop         ; <- description can be anything
-    expenses:food         $1
-    expenses:supplies     $1  ; <- this transaction debits two expense accounts
-    assets:cash               ; <- $-2 inferred
-
-2008/10/01 take a loan
-    assets:bank:checking  $1
-    liabilities:debts    $-1
-
-2008/12/31 * pay off          ; <- an optional * or ! after the date means \[dq]cleared\[dq] (or anything you want)
-    liabilities:debts     $1
-    assets:bank:checking
-\f[R]
-.fi
+Many users, though, edit the journal file with a text editor, and track
+changes with a version control system such as git.
+Editor addons such as ledger-mode or hledger-mode for Emacs, vim-ledger
+for Vim, and hledger-vscode for Visual Studio Code, make this easier,
+adding colour, formatting, tab completion, and useful commands.
+See Editor configuration at hledger.org for the full list.
 .SH FILE FORMAT
+.PP
+Here\[aq]s a description of each part of the file format (and
+hledger\[aq]s data model).
+These are mostly in the order you\[aq]ll use them, but in some cases
+related concepts have been grouped together for easy reference, or
+linked before they are introduced, so feel free to skip over anything
+that looks unnecessary right now.
 .SS Transactions
 .PP
-Transactions are movements of some quantity of commodities between named
-accounts.
-Each transaction is represented by a journal entry beginning with a
-simple date in column 0.
-This can be followed by any of the following, separated by spaces:
-.IP \[bu] 2
-(optional) a status character (empty, \f[C]!\f[R], or \f[C]*\f[R])
-.IP \[bu] 2
-(optional) a transaction code (any short number or text, enclosed in
-parentheses)
+Transactions are the main unit of information in a journal file.
+They represent events, typically a movement of some quantity of
+commodities between two or more named accounts.
+.PP
+Each transaction is recorded as a journal entry, beginning with a simple
+date in column 0.
+This can be followed by any of the following optional fields, separated
+by spaces:
 .IP \[bu] 2
-(optional) a transaction description (any remaining text until end of
-line or a semicolon)
+a status character (empty, \f[C]!\f[R], or \f[C]*\f[R])
 .IP \[bu] 2
-(optional) a transaction comment (any remaining text following a
-semicolon until end of line)
-.PP
-Then comes zero or more (but usually at least 2) indented lines
-representing...
-.SS Postings
-.PP
-A posting is an addition of some amount to, or removal of some amount
-from, an account.
-Each posting line begins with at least one space or tab (2 or 4 spaces
-is common), followed by:
+a code (any short number or text, enclosed in parentheses)
 .IP \[bu] 2
-(optional) a status character (empty, \f[C]!\f[R], or \f[C]*\f[R]),
-followed by a space
+a description (any remaining text until end of line or a semicolon)
 .IP \[bu] 2
-(required) an account name (any text, optionally containing \f[B]single
-spaces\f[R], until end of line or a double space)
+a comment (any remaining text following a semicolon until end of line,
+and any following indented lines beginning with a semicolon)
 .IP \[bu] 2
-(optional) \f[B]two or more spaces\f[R] or tabs followed by an amount.
-.PP
-Positive amounts are being added to the account, negative amounts are
-being removed.
-.PP
-The amounts within a transaction must always sum up to zero.
-As a convenience, one amount may be left blank; it will be inferred so
-as to balance the transaction.
+0 or more indented \f[I]posting\f[R] lines, describing what was
+transferred and the accounts involved.
 .PP
-Be sure to note the unusual two-space delimiter between account name and
-amount.
-This makes it easy to write account names containing spaces.
-But if you accidentally leave only one space (or tab) before the amount,
-the amount will be considered part of the account name.
+Here\[aq]s a simple journal file containing one transaction:
+.IP
+.nf
+\f[C]
+2008/01/01 income
+  assets:bank:checking   $1
+  income:salary         $-1
+\f[R]
+.fi
 .SS Dates
 .SS Simple dates
 .PP
-Within a journal file, transaction dates use Y/M/D (or Y-M-D or Y.M.D)
-Leading zeros are optional.
+Dates in the journal file use \f[I]simple dates\f[R] format:
+\f[C]YYYY-MM-DD\f[R] or \f[C]YYYY/MM/DD\f[R] or \f[C]YYYY.MM.DD\f[R],
+with leading zeros optional.
 The year may be omitted, in which case it will be inferred from the
-context - the current transaction, the default year set with a default
+context: the current transaction, the default year set with a default
 year directive, or the current date when the command is run.
-Some examples: \f[C]2010/01/31\f[R], \f[C]1/31\f[R],
-\f[C]2010-01-31\f[R], \f[C]2010.1.31\f[R].
+Some examples: \f[C]2010-01-31\f[R], \f[C]2010/01/31\f[R],
+\f[C]2010.1.31\f[R], \f[C]1/31\f[R].
+.PP
+(The UI also accepts simple dates, as well as the more flexible smart
+dates documented in the hledger manual.)
 .SS Secondary dates
 .PP
 Real-life transactions sometimes involve more than one date - eg the
 date you write a cheque, and the date it clears in your bank.
-When you want to model this, eg for more accurate balances, you can
-specify individual posting dates, which I recommend.
-Or, you can use the secondary dates (aka auxiliary/effective dates)
-feature, supported for compatibility with Ledger.
+When you want to model this, for more accurate daily balances, you can
+specify individual posting dates.
 .PP
-A secondary date can be written after the primary date, separated by an
-equals sign.
-The primary date, on the left, is used by default; the secondary date,
-on the right, is used when the \f[C]--date2\f[R] flag is specified
-(\f[C]--aux-date\f[R] or \f[C]--effective\f[R] also work).
+Or, you can use the older \f[I]secondary date\f[R] feature (Ledger calls
+it auxiliary date or effective date).
+Note: we support this for compatibility, but I usually recommend
+avoiding this feature; posting dates are almost always clearer and
+simpler.
 .PP
+A secondary date is written after the primary date, following an equals
+sign.
+If the year is omitted, the primary date\[aq]s year is assumed.
+When running reports, the primary (left) date is used by default, but
+with the \f[C]--date2\f[R] flag (or \f[C]--aux-date\f[R] or
+\f[C]--effective\f[R]), the secondary (right) date will be used instead.
+.PP
 The meaning of secondary dates is up to you, but it\[aq]s best to follow
 a consistent rule.
-Eg write the bank\[aq]s clearing date as primary, and when needed, the
-date the transaction was initiated as secondary.
-.PP
-Here\[aq]s an example.
-Note that a secondary date will use the year of the primary date if
-unspecified.
+Eg \[dq]primary = the bank\[aq]s clearing date, secondary = date the
+transaction was initiated, if different\[dq], as shown here:
 .IP
 .nf
 \f[C]
@@ -156,22 +124,16 @@
 .nf
 \f[C]
 $ hledger register checking
-2010/02/23 movie ticket         assets:checking                $-10         $-10
+2010-02-23 movie ticket         assets:checking                $-10         $-10
 \f[R]
 .fi
 .IP
 .nf
 \f[C]
 $ hledger register checking --date2
-2010/02/19 movie ticket         assets:checking                $-10         $-10
+2010-02-19 movie ticket         assets:checking                $-10         $-10
 \f[R]
 .fi
-.PP
-Secondary dates require some effort; you must use them consistently in
-your journal entries and remember whether to use or not use the
-\f[C]--date2\f[R] flag for your reports.
-They are included in hledger for Ledger compatibility, but posting dates
-are a more powerful and less confusing alternative.
 .SS Posting dates
 .PP
 You can give individual postings a different date from their parent
@@ -193,14 +155,14 @@
 .nf
 \f[C]
 $ hledger -f t.j register food
-2015/05/30                      expenses:food                  $10           $10
+2015-05-30                      expenses:food                  $10           $10
 \f[R]
 .fi
 .IP
 .nf
 \f[C]
 $ hledger -f t.j register checking
-2015/06/01                      assets:checking               $-10          $-10
+2015-06-01                      assets:checking               $-10          $-10
 \f[R]
 .fi
 .PP
@@ -277,7 +239,7 @@
 .PP
 .TS
 tab(@);
-lw(9.9n) lw(60.1n).
+lw(9.7n) lw(60.3n).
 T{
 status
 T}@T{
@@ -320,6 +282,177 @@
 additional note field on the right (after the first \f[C]|\f[R]).
 This may be worthwhile if you need to do more precise querying and
 pivoting by payee or by note.
+.SS Comments
+.PP
+Lines in the journal beginning with a semicolon (\f[C];\f[R]) or hash
+(\f[C]#\f[R]) or star (\f[C]*\f[R]) are comments, and will be ignored.
+(Star comments cause org-mode nodes to be ignored, allowing emacs users
+to fold and navigate their journals with org-mode or orgstruct-mode.)
+.PP
+You can attach comments to a transaction by writing them after the
+description and/or indented on the following lines (before the
+postings).
+Similarly, you can attach comments to an individual posting by writing
+them after the amount and/or indented on the following lines.
+Transaction and posting comments must begin with a semicolon
+(\f[C];\f[R]).
+.PP
+Some examples:
+.IP
+.nf
+\f[C]
+# a file comment
+; another file comment
+* also a file comment, useful in org/orgstruct mode
+
+comment
+A multiline file comment, which continues
+until a line containing just \[dq]end comment\[dq]
+(or end of file).
+end comment
+
+2012/5/14 something  ; a transaction comment
+    ; the transaction comment, continued
+    posting1  1  ; a comment for posting 1
+    posting2
+    ; a comment for posting 2
+    ; another comment line for posting 2
+; a file comment (because not indented)
+\f[R]
+.fi
+.PP
+You can also comment larger regions of a file using \f[C]comment\f[R]
+and \f[C]end comment\f[R] directives.
+.SS Tags
+.PP
+Tags are a way to add extra labels or labelled data to postings and
+transactions, which you can then search or pivot on.
+.PP
+A simple tag is a word (which may contain hyphens) followed by a full
+colon, written inside a transaction or posting comment line:
+.IP
+.nf
+\f[C]
+2017/1/16 bought groceries  ; sometag:
+\f[R]
+.fi
+.PP
+Tags can have a value, which is the text after the colon, up to the next
+comma or end of line, with leading/trailing whitespace removed:
+.IP
+.nf
+\f[C]
+    expenses:food    $10 ; a-posting-tag: the tag value
+\f[R]
+.fi
+.PP
+Note this means hledger\[aq]s tag values can not contain commas or
+newlines.
+Ending at commas means you can write multiple short tags on one line,
+comma separated:
+.IP
+.nf
+\f[C]
+    assets:checking  ; a comment containing tag1:, tag2: some value ...
+\f[R]
+.fi
+.PP
+Here,
+.IP \[bu] 2
+\[dq]\f[C]a comment containing\f[R]\[dq] is just comment text, not a tag
+.IP \[bu] 2
+\[dq]\f[C]tag1\f[R]\[dq] is a tag with no value
+.IP \[bu] 2
+\[dq]\f[C]tag2\f[R]\[dq] is another tag, whose value is
+\[dq]\f[C]some value ...\f[R]\[dq]
+.PP
+Tags in a transaction comment affect the transaction and all of its
+postings, while tags in a posting comment affect only that posting.
+For example, the following transaction has three tags (\f[C]A\f[R],
+\f[C]TAG2\f[R], \f[C]third-tag\f[R]) and the posting has four (those
+plus \f[C]posting-tag\f[R]):
+.IP
+.nf
+\f[C]
+1/1 a transaction  ; A:, TAG2:
+    ; third-tag: a third transaction tag, <- with a value
+    (a)  $1  ; posting-tag:
+\f[R]
+.fi
+.PP
+Tags are like Ledger\[aq]s metadata feature, except hledger\[aq]s tag
+values are simple strings.
+.SS Postings
+.PP
+A posting is an addition of some amount to, or removal of some amount
+from, an account.
+Each posting line begins with at least one space or tab (2 or 4 spaces
+is common), followed by:
+.IP \[bu] 2
+(optional) a status character (empty, \f[C]!\f[R], or \f[C]*\f[R]),
+followed by a space
+.IP \[bu] 2
+(required) an account name (any text, optionally containing \f[B]single
+spaces\f[R], until end of line or a double space)
+.IP \[bu] 2
+(optional) \f[B]two or more spaces\f[R] or tabs followed by an amount.
+.PP
+Positive amounts are being added to the account, negative amounts are
+being removed.
+.PP
+The amounts within a transaction must always sum up to zero.
+As a convenience, one amount may be left blank; it will be inferred so
+as to balance the transaction.
+.PP
+Be sure to note the unusual two-space delimiter between account name and
+amount.
+This makes it easy to write account names containing spaces.
+But if you accidentally leave only one space (or tab) before the amount,
+the amount will be considered part of the account name.
+.SS Virtual Postings
+.PP
+A posting with a parenthesised account name is called a \f[I]virtual
+posting\f[R] or \f[I]unbalanced posting\f[R], which means it is exempt
+from the usual rule that a transaction\[aq]s postings must balance add
+up to zero.
+.PP
+This is not part of double entry accounting, so you might choose to
+avoid this feature.
+Or you can use it sparingly for certain special cases where it can be
+convenient.
+Eg, you could set opening balances without using a balancing equity
+account:
+.IP
+.nf
+\f[C]
+1/1 opening balances
+  (assets:checking)   $1000
+  (assets:savings)    $2000
+\f[R]
+.fi
+.PP
+A posting with a bracketed account name is called a \f[I]balanced
+virtual posting\f[R].
+The balanced virtual postings in a transaction must add up to zero
+(separately from other postings).
+Eg:
+.IP
+.nf
+\f[C]
+1/1 buy food with cash, update budget envelope subaccounts, & something else
+  assets:cash                    $-10 ; <- these balance
+  expenses:food                    $7 ; <-
+  expenses:food                    $3 ; <-
+  [assets:checking:budget:food]  $-10    ; <- and these balance
+  [assets:checking:available]     $10    ; <-
+  (something:else)                 $5       ; <- not required to balance
+\f[R]
+.fi
+.PP
+Ordinary non-parenthesised, non-bracketed postings are called \f[I]real
+postings\f[R].
+You can exclude virtual postings from reports with the
+\f[C]-R/--real\f[R] flag or \f[C]real:1\f[R] query.
 .SS Account names
 .PP
 Account names typically have several parts separated by a full colon,
@@ -440,15 +573,15 @@
 commodity       1 000 000.9455
 \f[R]
 .fi
-.SS Amount display format
+.SS Amount display style
 .PP
 For each commodity, hledger chooses a consistent format to use when
 displaying amounts.
 (Except price amounts, which are always displayed as written).
-The display format is chosen as follows:
+The display style is chosen as follows:
 .IP \[bu] 2
-If there is a commodity directive for the commodity, that format is used
-(see examples above).
+If there is a commodity directive (or default commodity directive) for
+the commodity, that format is used (see examples above).
 .IP \[bu] 2
 Otherwise the format of the first posting amount in that commodity seen
 in the journal is used.
@@ -458,54 +591,109 @@
 Or if there are no such amounts in the journal, a default format is used
 (like \f[C]$1000.00\f[R]).
 .PP
-Price amounts, and amounts in \f[C]D\f[R] directives don\[aq]t affect
-the amount display format directly, but occasionally they can do so
-indirectly.
-(Eg when D\[aq]s default commodity is applied to a commodity-less
-amount, or when an amountless posting is balanced using a price\[aq]s
-commodity, or when -V is used.) If you find this causing problems, use a
-commodity directive to set the display format.
-.SS Virtual Postings
+Transaction prices don\[aq]t affect the amount display style directly,
+but occasionally they can do so indirectly (eg when an posting\[aq]s
+amount is inferred using a transaction price).
+If you find this causing problems, use a commodity directive to fix the
+display style.
 .PP
-When you parenthesise the account name in a posting, we call that a
-\f[I]virtual posting\f[R], which means:
-.IP \[bu] 2
-it is ignored when checking that the transaction is balanced
-.IP \[bu] 2
-it is excluded from reports when the \f[C]--real/-R\f[R] flag is used,
-or the \f[C]real:1\f[R] query.
+In summary: amounts will be displayed much as they appear in your
+journal, with the max observed number of decimal places.
+If you want to see fewer decimal places in reports, use a commodity
+directive to override that.
+.SS Transaction prices
 .PP
-You could use this, eg, to set an account\[aq]s opening balance without
-needing to use the \f[C]equity:opening balances\f[R] account:
+Within a transaction, you can note an amount\[aq]s price in another
+commodity.
+This can be used to document the cost (in a purchase) or selling price
+(in a sale).
+For example, transaction prices are useful to record purchases of a
+foreign currency.
+Note transaction prices are fixed at the time of the transaction, and do
+not change over time.
+See also market prices, which represent prevailing exchange rates on a
+certain date.
+.PP
+There are several ways to record a transaction price:
+.IP "1." 3
+Write the price per unit, as \f[C]\[at] UNITPRICE\f[R] after the amount:
+.RS 4
 .IP
 .nf
 \f[C]
-1/1 special unbalanced posting to set initial balance
-  (assets:checking)   $1000
+2009/1/1
+  assets:euros     \[Eu]100 \[at] $1.35  ; one hundred euros purchased at $1.35 each
+  assets:dollars                 ; balancing amount is -$135.00
 \f[R]
 .fi
+.RE
+.IP "2." 3
+Write the total price, as \f[C]\[at]\[at] TOTALPRICE\f[R] after the
+amount:
+.RS 4
+.IP
+.nf
+\f[C]
+2009/1/1
+  assets:euros     \[Eu]100 \[at]\[at] $135  ; one hundred euros purchased at $135 for the lot
+  assets:dollars
+\f[R]
+.fi
+.RE
+.IP "3." 3
+Specify amounts for all postings, using exactly two commodities, and let
+hledger infer the price that balances the transaction:
+.RS 4
+.IP
+.nf
+\f[C]
+2009/1/1
+  assets:euros     \[Eu]100          ; one hundred euros purchased
+  assets:dollars  $-135          ; for $135
+\f[R]
+.fi
+.RE
 .PP
-When the account name is bracketed, we call it a \f[I]balanced virtual
-posting\f[R].
-This is like an ordinary virtual posting except the balanced virtual
-postings in a transaction must balance to 0, like the real postings (but
-separately from them).
-Balanced virtual postings are also excluded by \f[C]--real/-R\f[R] or
-\f[C]real:1\f[R].
+(Ledger users: Ledger uses a different syntax for fixed prices,
+\f[C]{=UNITPRICE}\f[R], which hledger currently ignores).
+.PP
+Use the \f[C]-B/--cost\f[R] flag to convert amounts to their transaction
+price\[aq]s commodity, if any.
+(mnemonic: \[dq]B\[dq] is from \[dq]cost Basis\[dq], as in Ledger).
+Eg here is how -B affects the balance report for the example above:
 .IP
 .nf
 \f[C]
-1/1 buy food with cash, and update some budget-tracking subaccounts elsewhere
-  expenses:food                   $10
-  assets:cash                    $-10
-  [assets:checking:available]     $10
-  [assets:checking:budget:food]  $-10
+$ hledger bal -N --flat
+               $-135  assets:dollars
+                \[Eu]100  assets:euros
+$ hledger bal -N --flat -B
+               $-135  assets:dollars
+                $135  assets:euros    # <- the euros\[aq] cost
 \f[R]
 .fi
 .PP
-Virtual postings have some legitimate uses, but those are few.
-You can usually find an equivalent journal entry using real postings,
-which is more correct and provides better error checking.
+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\[aq]s postings are reversed, while the transaction is
+equivalent, -B shows something different:
+.IP
+.nf
+\f[C]
+2009/1/1
+  assets:dollars  $-135              ; 135 dollars sold
+  assets:euros     \[Eu]100              ; for 100 euros
+\f[R]
+.fi
+.IP
+.nf
+\f[C]
+$ hledger bal -N --flat -B
+               \[Eu]-100  assets:dollars  # <- the dollars\[aq] selling price
+                \[Eu]100  assets:euros
+\f[R]
+.fi
 .SS Balance Assertions
 .PP
 hledger supports Ledger-style balance assertions in journal files.
@@ -533,6 +721,7 @@
 You can disable them temporarily with the
 \f[C]-I/--ignore-assertions\f[R] flag, which can be useful for
 troubleshooting or for reading Ledger files.
+(Note: this flag currently does not disable balance assignments, below).
 .SS Assertions and ordering
 .PP
 hledger sorts an account\[aq]s postings and assertions first by date and
@@ -567,9 +756,6 @@
 The asserted balance must be a simple single-commodity amount, and in
 fact the assertion checks only this commodity\[aq]s balance within the
 (possibly multi-commodity) account balance.
-.PD 0
-.P
-.PD
 This is how assertions work in Ledger also.
 We could call this a \[dq]partial\[dq] balance assertion.
 .PP
@@ -675,7 +861,7 @@
 .IP
 .nf
 \f[C]
-; starting a new journal, set asset account balances 
+; starting a new journal, set asset account balances
 2016/1/1 opening balances
   assets:checking            = $409.32
   assets:savings             = $735.24
@@ -717,204 +903,10 @@
 .nf
 \f[C]
 $ hledger print --explicit
-2019/01/01
+2019-01-01
     (a)         $1 \[at] \[Eu]2 = $1 \[at] \[Eu]2
 \f[R]
 .fi
-.SS Transaction prices
-.PP
-Within a transaction, you can note an amount\[aq]s price in another
-commodity.
-This can be used to document the cost (in a purchase) or selling price
-(in a sale).
-For example, transaction prices are useful to record purchases of a
-foreign currency.
-Note transaction prices are fixed at the time of the transaction, and do
-not change over time.
-See also market prices, which represent prevailing exchange rates on a
-certain date.
-.PP
-There are several ways to record a transaction price:
-.IP "1." 3
-Write the price per unit, as \f[C]\[at] UNITPRICE\f[R] after the amount:
-.RS 4
-.IP
-.nf
-\f[C]
-2009/1/1
-  assets:euros     \[Eu]100 \[at] $1.35  ; one hundred euros purchased at $1.35 each
-  assets:dollars                 ; balancing amount is -$135.00
-\f[R]
-.fi
-.RE
-.IP "2." 3
-Write the total price, as \f[C]\[at]\[at] TOTALPRICE\f[R] after the
-amount:
-.RS 4
-.IP
-.nf
-\f[C]
-2009/1/1
-  assets:euros     \[Eu]100 \[at]\[at] $135  ; one hundred euros purchased at $135 for the lot
-  assets:dollars
-\f[R]
-.fi
-.RE
-.IP "3." 3
-Specify amounts for all postings, using exactly two commodities, and let
-hledger infer the price that balances the transaction:
-.RS 4
-.IP
-.nf
-\f[C]
-2009/1/1
-  assets:euros     \[Eu]100          ; one hundred euros purchased
-  assets:dollars  $-135          ; for $135
-\f[R]
-.fi
-.RE
-.PP
-(Ledger users: Ledger uses a different syntax for fixed prices,
-\f[C]{=UNITPRICE}\f[R], which hledger currently ignores).
-.PP
-Use the \f[C]-B/--cost\f[R] flag to convert amounts to their transaction
-price\[aq]s commodity, if any.
-(mnemonic: \[dq]B\[dq] is from \[dq]cost Basis\[dq], as in Ledger).
-Eg here is how -B affects the balance report for the example above:
-.IP
-.nf
-\f[C]
-$ hledger bal -N --flat
-               $-135  assets:dollars
-                \[Eu]100  assets:euros
-$ hledger bal -N --flat -B
-               $-135  assets:dollars
-                $135  assets:euros    # <- the euros\[aq] cost
-\f[R]
-.fi
-.PP
-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\[aq]s postings are reversed, while the transaction is
-equivalent, -B shows something different:
-.IP
-.nf
-\f[C]
-2009/1/1
-  assets:dollars  $-135              ; 135 dollars sold
-  assets:euros     \[Eu]100              ; for 100 euros
-\f[R]
-.fi
-.IP
-.nf
-\f[C]
-$ hledger bal -N --flat -B
-               \[Eu]-100  assets:dollars  # <- the dollars\[aq] selling price
-                \[Eu]100  assets:euros
-\f[R]
-.fi
-.SS Comments
-.PP
-Lines in the journal beginning with a semicolon (\f[C];\f[R]) or hash
-(\f[C]#\f[R]) or star (\f[C]*\f[R]) are comments, and will be ignored.
-(Star comments cause org-mode nodes to be ignored, allowing emacs users
-to fold and navigate their journals with org-mode or orgstruct-mode.)
-.PP
-You can attach comments to a transaction by writing them after the
-description and/or indented on the following lines (before the
-postings).
-Similarly, you can attach comments to an individual posting by writing
-them after the amount and/or indented on the following lines.
-Transaction and posting comments must begin with a semicolon
-(\f[C];\f[R]).
-.PP
-Some examples:
-.IP
-.nf
-\f[C]
-# a file comment
-
-; also a file comment
-
-comment
-This is a multiline file comment,
-which continues until a line
-where the \[dq]end comment\[dq] string
-appears on its own (or end of file).
-end comment
-
-2012/5/14 something  ; a transaction comment
-    ; the transaction comment, continued
-    posting1  1  ; a comment for posting 1
-    posting2
-    ; a comment for posting 2
-    ; another comment line for posting 2
-; a file comment (because not indented)
-\f[R]
-.fi
-.PP
-You can also comment larger regions of a file using \f[C]comment\f[R]
-and \f[C]end comment\f[R] directives.
-.SS Tags
-.PP
-Tags are a way to add extra labels or labelled data to postings and
-transactions, which you can then search or pivot on.
-.PP
-A simple tag is a word (which may contain hyphens) followed by a full
-colon, written inside a transaction or posting comment line:
-.IP
-.nf
-\f[C]
-2017/1/16 bought groceries  ; sometag:
-\f[R]
-.fi
-.PP
-Tags can have a value, which is the text after the colon, up to the next
-comma or end of line, with leading/trailing whitespace removed:
-.IP
-.nf
-\f[C]
-    expenses:food    $10 ; a-posting-tag: the tag value
-\f[R]
-.fi
-.PP
-Note this means hledger\[aq]s tag values can not contain commas or
-newlines.
-Ending at commas means you can write multiple short tags on one line,
-comma separated:
-.IP
-.nf
-\f[C]
-    assets:checking  ; a comment containing tag1:, tag2: some value ...
-\f[R]
-.fi
-.PP
-Here,
-.IP \[bu] 2
-\[dq]\f[C]a comment containing\f[R]\[dq] is just comment text, not a tag
-.IP \[bu] 2
-\[dq]\f[C]tag1\f[R]\[dq] is a tag with no value
-.IP \[bu] 2
-\[dq]\f[C]tag2\f[R]\[dq] is another tag, whose value is
-\[dq]\f[C]some value ...\f[R]\[dq]
-.PP
-Tags in a transaction comment affect the transaction and all of its
-postings, while tags in a posting comment affect only that posting.
-For example, the following transaction has three tags (\f[C]A\f[R],
-\f[C]TAG2\f[R], \f[C]third-tag\f[R]) and the posting has four (those
-plus \f[C]posting-tag\f[R]):
-.IP
-.nf
-\f[C]
-1/1 a transaction  ; A:, TAG2:
-    ; third-tag: a third transaction tag, <- with a value
-    (a)  $1  ; posting-tag:
-\f[R]
-.fi
-.PP
-Tags are like Ledger\[aq]s metadata feature, except hledger\[aq]s tag
-values are simple strings.
 .SS Directives
 .PP
 A directive is a line in the journal beginning with a special keyword,
@@ -1001,12 +993,12 @@
 T}@T{
 T}@T{
 T}@T{
-declare a commodity, number notation & display style for commodityless
-amounts
+declare a commodity to be used for commodityless amounts, and its number
+notation & display style
 T}@T{
-commodity: all commodityless entries in all files; number notation:
-following commodityless entries and entries in that commodity in all
-files; display style: amounts of that commodity in reports
+default commodity: following commodityless entries until end of current
+file; number notation: following entries in that commodity until end of
+current file; display style: amounts of that commodity in reports
 T}
 T{
 \f[C]include\f[R]
@@ -1041,7 +1033,7 @@
 .PP
 .TS
 tab(@);
-lw(8.9n) lw(61.1n).
+lw(6.0n) lw(64.0n).
 T{
 subdirective
 T}@T{
@@ -1138,12 +1130,13 @@
 It declares commodities which may be used in the journal.
 This is currently not enforced, but can serve as documentation.
 .IP "2." 3
-It declares what decimal mark character to expect when parsing input -
-useful to disambiguate international number formats in your data.
+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 \f[C]1,000\f[R] and
 \f[C]1.000\f[R] as 1).
 .IP "3." 3
-It declares the amount display format to use in output - decimal and
+It declares the amount display style to use in output - decimal and
 digit group marks, number of decimal places, symbol placement etc.
 .PP
 You are likely to run into one of the problems solved by commodity
@@ -1188,26 +1181,34 @@
 followed by 0 or more decimal digits.
 .SS Default commodity
 .PP
-The \f[C]D\f[R] directive sets a default commodity (and display format),
-to be used for amounts without a commodity symbol (ie, plain numbers).
-(Note this differs from Ledger\[aq]s default commodity directive.) The
-commodity and display format will be applied to all subsequent
-commodity-less amounts, or until the next \f[C]D\f[R] directive.
+The \f[C]D\f[R] directive sets a default commodity, to be used for
+amounts without a commodity symbol (ie, plain numbers).
+This commodity will be applied to all subsequent commodity-less amounts,
+or until the next \f[C]D\f[R] directive.
+(Note, this is different from Ledger\[aq]s \f[C]D\f[R].)
+.PP
+For compatibility/historical reasons, \f[C]D\f[R] also acts like a
+\f[C]commodity\f[R] directive, setting the commodity\[aq]s display style
+(for output) and decimal mark (for parsing input).
+As with \f[C]commodity\f[R], the amount must always be written with a
+decimal mark (period or comma).
+If both directives are used, \f[C]commodity\f[R]\[aq]s style takes
+precedence.
+.PP
+The syntax is \f[C]D AMOUNT\f[R].
+Eg:
 .IP
 .nf
 \f[C]
 ; commodity-less amounts should be treated as dollars
-; (and displayed with symbol on the left, thousands separators and two decimal places)
+; (and displayed with the dollar sign on the left, thousands separators and two decimal places)
 D $1,000.00
 
 1/1
-  a     5  ; <- commodity-less amount, becomes $1
+  a     5  ; <- commodity-less amount, parsed as $5 and displayed as $5.00
   b
 \f[R]
 .fi
-.PP
-As with the \f[C]commodity\f[R] directive, the amount must always be
-written with a decimal point.
 .SS Market prices
 .PP
 The \f[C]P\f[R] directive declares a market price, which is an exchange
@@ -1274,21 +1275,24 @@
 .fi
 .SS Account comments
 .PP
-Comments, beginning with a semicolon, optionally including tags, can be
-written after the account name, and/or on following lines.
-Eg:
+Comments, beginning with a semicolon, can be added:
+.IP \[bu] 2
+on the same line, \f[B]after two or more spaces\f[R] (because ; is
+allowed in account names)
+.IP \[bu] 2
+on the next lines, indented
+.PP
+An example of both:
 .IP
 .nf
 \f[C]
-account assets:bank:checking  ; a comment
-  ; another comment
-  ; acctno:12345, a tag
+account assets:bank:checking  ; same-line comment, note 2+ spaces before ;
+  ; next-line comment
+  ; another with tag, acctno:12345 (not used yet)
 \f[R]
 .fi
 .PP
-Tip: comments on the same line require hledger 1.12+.
-If you need your journal to be compatible with older hledger versions,
-write comments on the next line instead.
+Same-line comments are not supported by Ledger, or hledger <1.13.
 .SS Account subdirectives
 .PP
 We also allow (and ignore) Ledger-style indented subdirectives, just for
@@ -1336,7 +1340,7 @@
 account liabilities  ; type:Liability
 account equity       ; type:Equity
 account revenues     ; type:Revenue
-account expenses     ; type:Expenses
+account expenses     ; type:Expense
 \f[R]
 .fi
 .SS Account types declared with account type codes
@@ -1365,8 +1369,8 @@
 ; 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 
+; we need to ensure some other account has the liability type,
+; otherwise balancesheet would still show \[dq]liabilities\[dq] under Liabilities
 account -            ; type:L
 \f[R]
 .fi
@@ -1417,11 +1421,14 @@
 would influence the position of \f[C]zoo\f[R] among
 \f[C]other\f[R]\[aq]s subaccounts, but not the position of
 \f[C]other\f[R] among the top-level accounts.
-This means: - you will sometimes declare parent accounts (eg
-\f[C]account other\f[R] above) that you don\[aq]t intend to post to,
-just to customize their display order - sibling accounts stay together
-(you couldn\[aq]t display \f[C]x:y\f[R] in between \f[C]a:b\f[R] and
-\f[C]a:c\f[R]).
+This means:
+.IP \[bu] 2
+you will sometimes declare parent accounts (eg \f[C]account other\f[R]
+above) that you don\[aq]t intend to post to, just to customize their
+display order
+.IP \[bu] 2
+sibling accounts stay together (you couldn\[aq]t display \f[C]x:y\f[R]
+in between \f[C]a:b\f[R] and \f[C]a:c\f[R]).
 .SS Rewriting accounts
 .PP
 You can define account alias rules which rewrite your account names, or
@@ -1442,7 +1449,7 @@
 They do not affect account names being entered via hledger add or
 hledger-web.
 .PP
-See also Cookbook: Rewrite account names.
+See also Rewrite account names.
 .SS Basic aliases
 .PP
 To set an account alias, use the \f[C]alias\f[R] directive in your
@@ -1769,8 +1776,8 @@
 .nf
 \f[C]
 = QUERY
-    ACCT  AMT
-    ACCT  [AMT]
+    ACCOUNT  AMOUNT
+    ACCOUNT  [AMOUNT]
     ...
 \f[R]
 .fi
@@ -1794,6 +1801,17 @@
 The matched posting\[aq]s amount will be multiplied by N, and its
 commodity symbol will be replaced with S.
 .PP
+A 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:
+.IP
+.nf
+\f[C]
+= expenses:groceries \[aq]expenses:dining out\[aq]
+    (budget:funds:dining out)                 *-1
+\f[R]
+.fi
+.PP
 These rules have global effect - a rule appearing anywhere in your data
 can potentially affect any transaction, including transactions recorded
 above it or in another file.
@@ -1824,12 +1842,12 @@
 .nf
 \f[C]
 $ hledger print --auto
-2017/12/01
+2017-12-01
     expenses:food              $10
     assets:checking
     (liabilities:charity)      $-1
 
-2017/12/14
+2017-12-14
     expenses:gifts             $20
     assets:checking
     assets:checking:gifts     -$20
@@ -1872,15 +1890,6 @@
 .IP \[bu] 2
 \f[C]_modified:\f[R] - a hidden tag not appearing in the comment; this
 transaction was modified \[dq]just now\[dq].
-.SH EDITOR SUPPORT
-.PP
-Helper modes exist for popular text editors, which make working with
-journal files easier.
-They add colour, formatting, tab completion, and helpful commands, and
-are quite recommended if you edit your journal with a text editor.
-They include ledger-mode or hledger-mode for Emacs, vim-ledger for Vim,
-hledger-vscode for Visual Studio Code, and others.
-See the [[Cookbook]] at hledger.org for the latest information.
 
 
 .SH "REPORTING BUGS"
diff --git a/embeddedfiles/hledger_journal.info b/embeddedfiles/hledger_journal.info
--- a/embeddedfiles/hledger_journal.info
+++ b/embeddedfiles/hledger_journal.info
@@ -2,1865 +2,1849 @@
 stdin.
 
 
-File: hledger_journal.info,  Node: Top,  Next: FILE FORMAT,  Up: (dir)
-
-hledger_journal(5) hledger 1.16.2
-*********************************
-
-hledger's usual data source is a plain text file containing journal
-entries in hledger journal format.  This file represents a standard
-accounting general journal.  I use file names ending in '.journal', but
-that's not required.  The journal file contains a number of transaction
-entries, each describing a transfer of money (or any commodity) between
-two or more named accounts, in a simple format readable by both hledger
-and humans.
-
-   hledger's journal format is a compatible subset, mostly, of ledger's
-journal format, so hledger can work with compatible ledger journal files
-as well.  It's safe, and encouraged, to run both hledger and ledger on
-the same journal file, eg to validate the results you're getting.
-
-   You can use hledger without learning any more about this file; just
-use the add or web commands to create and update it.  Many users,
-though, also edit the journal file directly with a text editor, perhaps
-assisted by the helper modes for emacs or vim.
-
-   Here's an example:
-
-; A sample journal file. This is a comment.
-
-2008/01/01 income             ; <- transaction's first line starts in column 0, contains date and description
-    assets:bank:checking  $1  ; <- posting lines start with whitespace, each contains an account name
-    income:salary        $-1  ;    followed by at least two spaces and an amount
-
-2008/06/01 gift
-    assets:bank:checking  $1  ; <- at least two postings in a transaction
-    income:gifts         $-1  ; <- their amounts must balance to 0
-
-2008/06/02 save
-    assets:bank:saving    $1
-    assets:bank:checking      ; <- one amount may be omitted; here $-1 is inferred
-
-2008/06/03 eat & shop         ; <- description can be anything
-    expenses:food         $1
-    expenses:supplies     $1  ; <- this transaction debits two expense accounts
-    assets:cash               ; <- $-2 inferred
-
-2008/10/01 take a loan
-    assets:bank:checking  $1
-    liabilities:debts    $-1
-
-2008/12/31 * pay off          ; <- an optional * or ! after the date means "cleared" (or anything you want)
-    liabilities:debts     $1
-    assets:bank:checking
-
-* Menu:
-
-* FILE FORMAT::
-* EDITOR SUPPORT::
-
-
-File: hledger_journal.info,  Node: FILE FORMAT,  Next: EDITOR SUPPORT,  Prev: Top,  Up: Top
-
-1 FILE FORMAT
-*************
-
-* Menu:
-
-* Transactions::
-* Postings::
-* Dates::
-* Status::
-* Description::
-* Account names::
-* Amounts::
-* Virtual Postings::
-* Balance Assertions::
-* Balance Assignments::
-* Transaction prices::
-* Comments::
-* Tags::
-* Directives::
-* Periodic transactions::
-* Auto postings / transaction modifiers::
-
-
-File: hledger_journal.info,  Node: Transactions,  Next: Postings,  Up: FILE FORMAT
-
-1.1 Transactions
-================
-
-Transactions are movements of some quantity of commodities between named
-accounts.  Each transaction is represented by a journal entry beginning
-with a simple date in column 0.  This can be followed by any of the
-following, separated by spaces:
-
-   * (optional) a status character (empty, '!', or '*')
-   * (optional) a transaction code (any short number or text, enclosed
-     in parentheses)
-   * (optional) a transaction description (any remaining text until end
-     of line or a semicolon)
-   * (optional) a transaction comment (any remaining text following a
-     semicolon until end of line)
-
-   Then comes zero or more (but usually at least 2) indented lines
-representing...
-
-
-File: hledger_journal.info,  Node: Postings,  Next: Dates,  Prev: Transactions,  Up: FILE FORMAT
-
-1.2 Postings
-============
-
-A posting is an addition of some amount to, or removal of some amount
-from, an account.  Each posting line begins with at least one space or
-tab (2 or 4 spaces is common), followed by:
-
-   * (optional) a status character (empty, '!', or '*'), followed by a
-     space
-   * (required) an account name (any text, optionally containing *single
-     spaces*, until end of line or a double space)
-   * (optional) *two or more spaces* or tabs followed by an amount.
-
-   Positive amounts are being added to the account, negative amounts are
-being removed.
-
-   The amounts within a transaction must always sum up to zero.  As a
-convenience, one amount may be left blank; it will be inferred so as to
-balance the transaction.
-
-   Be sure to note the unusual two-space delimiter between account name
-and amount.  This makes it easy to write account names containing
-spaces.  But if you accidentally leave only one space (or tab) before
-the amount, the amount will be considered part of the account name.
-
-
-File: hledger_journal.info,  Node: Dates,  Next: Status,  Prev: Postings,  Up: FILE FORMAT
-
-1.3 Dates
-=========
-
-* Menu:
-
-* Simple dates::
-* Secondary dates::
-* Posting dates::
-
-
-File: hledger_journal.info,  Node: Simple dates,  Next: Secondary dates,  Up: Dates
-
-1.3.1 Simple dates
-------------------
-
-Within a journal file, transaction dates use Y/M/D (or Y-M-D or Y.M.D)
-Leading zeros are optional.  The year may be omitted, in which case it
-will be inferred from the context - the current transaction, the default
-year set with a default year directive, or the current date when the
-command is run.  Some examples: '2010/01/31', '1/31', '2010-01-31',
-'2010.1.31'.
-
-
-File: hledger_journal.info,  Node: Secondary dates,  Next: Posting dates,  Prev: Simple dates,  Up: Dates
-
-1.3.2 Secondary dates
----------------------
-
-Real-life transactions sometimes involve more than one date - eg the
-date you write a cheque, and the date it clears in your bank.  When you
-want to model this, eg for more accurate balances, you can specify
-individual posting dates, which I recommend.  Or, you can use the
-secondary dates (aka auxiliary/effective dates) feature, supported for
-compatibility with Ledger.
-
-   A secondary date can be written after the primary date, separated by
-an equals sign.  The primary date, on the left, is used by default; the
-secondary date, on the right, is used when the '--date2' flag is
-specified ('--aux-date' or '--effective' also work).
-
-   The meaning of secondary dates is up to you, but it's best to follow
-a consistent rule.  Eg write the bank's clearing date as primary, and
-when needed, the date the transaction was initiated as secondary.
-
-   Here's an example.  Note that a secondary date will use the year of
-the primary date if unspecified.
-
-2010/2/23=2/19 movie ticket
-  expenses:cinema                   $10
-  assets:checking
-
-$ hledger register checking
-2010/02/23 movie ticket         assets:checking                $-10         $-10
-
-$ hledger register checking --date2
-2010/02/19 movie ticket         assets:checking                $-10         $-10
-
-   Secondary dates require some effort; you must use them consistently
-in your journal entries and remember whether to use or not use the
-'--date2' flag for your reports.  They are included in hledger for
-Ledger compatibility, but posting dates are a more powerful and less
-confusing alternative.
-
-
-File: hledger_journal.info,  Node: Posting dates,  Prev: Secondary dates,  Up: Dates
-
-1.3.3 Posting dates
--------------------
-
-You can give individual postings a different date from their parent
-transaction, by adding a posting comment containing a tag (see below)
-like 'date:DATE'.  This is probably the best way to control posting
-dates precisely.  Eg in this example the expense should appear in May
-reports, and the deduction from checking should be reported on 6/1 for
-easy bank reconciliation:
-
-2015/5/30
-    expenses:food     $10  ; food purchased on saturday 5/30
-    assets:checking        ; bank cleared it on monday, date:6/1
-
-$ hledger -f t.j register food
-2015/05/30                      expenses:food                  $10           $10
-
-$ hledger -f t.j register checking
-2015/06/01                      assets:checking               $-10          $-10
-
-   DATE should be a simple date; if the year is not specified it will
-use the year of the transaction's date.  You can set the secondary date
-similarly, with 'date2:DATE2'.  The 'date:' or 'date2:' tags must have a
-valid simple date value if they are present, eg a 'date:' tag with no
-value is not allowed.
-
-   Ledger's earlier, more compact bracketed date syntax is also
-supported: '[DATE]', '[DATE=DATE2]' or '[=DATE2]'.  hledger will attempt
-to parse any square-bracketed sequence of the '0123456789/-.='
-characters in this way.  With this syntax, DATE infers its year from the
-transaction and DATE2 infers its year from DATE.
-
-
-File: hledger_journal.info,  Node: Status,  Next: Description,  Prev: Dates,  Up: FILE FORMAT
-
-1.4 Status
-==========
-
-Transactions, or individual postings within a transaction, can have a
-status mark, which is a single character before the transaction
-description or posting account name, separated from it by a space,
-indicating one of three statuses:
-
-mark  status
- 
------------------
-      unmarked
-'!'   pending
-'*'   cleared
-
-   When reporting, you can filter by status with the '-U/--unmarked',
-'-P/--pending', and '-C/--cleared' flags; or the 'status:', 'status:!',
-and 'status:*' queries; or the U, P, C keys in hledger-ui.
-
-   Note, in Ledger and in older versions of hledger, the "unmarked"
-state is called "uncleared".  As of hledger 1.3 we have renamed it to
-unmarked for clarity.
-
-   To replicate Ledger and old hledger's behaviour of also matching
-pending, combine -U and -P.
-
-   Status marks are optional, but can be helpful eg for reconciling with
-real-world accounts.  Some editor modes provide highlighting and
-shortcuts for working with status.  Eg in Emacs ledger-mode, you can
-toggle transaction status with C-c C-e, or posting status with C-c C-c.
-
-   What "uncleared", "pending", and "cleared" actually mean is up to
-you.  Here's one suggestion:
-
-status     meaning
---------------------------------------------------------------------------
-uncleared  recorded but not yet reconciled; needs review
-pending    tentatively reconciled (if needed, eg during a big
-           reconciliation)
-cleared    complete, reconciled as far as possible, and considered
-           correct
-
-   With this scheme, you would use '-PC' to see the current balance at
-your bank, '-U' to see things which will probably hit your bank soon
-(like uncashed checks), and no flags to see the most up-to-date state of
-your finances.
-
-
-File: hledger_journal.info,  Node: Description,  Next: Account names,  Prev: Status,  Up: FILE FORMAT
-
-1.5 Description
-===============
-
-A transaction's description is the rest of the line following the date
-and status mark (or until a comment begins).  Sometimes called the
-"narration" in traditional bookkeeping, it can be used for whatever you
-wish, or left blank.  Transaction descriptions can be queried, unlike
-comments.
-
-* Menu:
-
-* Payee and note::
-
-
-File: hledger_journal.info,  Node: Payee and note,  Up: Description
-
-1.5.1 Payee and note
---------------------
-
-You can optionally include a '|' (pipe) character in descriptions to
-subdivide the description into separate fields for payee/payer name on
-the left (up to the first '|') and an additional note field on the right
-(after the first '|').  This may be worthwhile if you need to do more
-precise querying and pivoting by payee or by note.
-
-
-File: hledger_journal.info,  Node: Account names,  Next: Amounts,  Prev: Description,  Up: FILE FORMAT
-
-1.6 Account names
-=================
-
-Account names typically have several parts separated by a full colon,
-from which hledger derives a hierarchical chart of accounts.  They can
-be anything you like, but in finance there are traditionally five
-top-level accounts: 'assets', 'liabilities', 'income', 'expenses', and
-'equity'.
-
-   Account names may contain single spaces, eg: 'assets:accounts
-receivable'.  Because of this, they must always be followed by *two or
-more spaces* (or newline).
-
-   Account names can be aliased.
-
-
-File: hledger_journal.info,  Node: Amounts,  Next: Virtual Postings,  Prev: Account names,  Up: FILE FORMAT
-
-1.7 Amounts
-===========
-
-After the account name, there is usually an amount.  (Important: between
-account name and amount, there must be *two or more spaces*.)
-
-   hledger's amount format is flexible, supporting several international
-formats.  Here are some examples.  Amounts have a number (the
-"quantity"):
-
-1
-
-   ..and usually a currency or commodity name (the "commodity").  This
-is a symbol, word, or phrase, to the left or right of the quantity, with
-or without a separating space:
-
-$1
-4000 AAPL
-
-   If the commodity name contains spaces, numbers, or punctuation, it
-must be enclosed in double quotes:
-
-3 "no. 42 green apples"
-
-   Amounts can be negative.  The minus sign can be written before or
-after a left-side commodity symbol:
-
--$1
-$-1
-
-   Scientific E notation is allowed:
-
-1E-6
-EUR 1E3
-
-   A decimal mark (decimal point) can be written with a period or a
-comma:
-
-1.23
-1,23456780000009
-
-* Menu:
-
-* Digit group marks::
-* Amount display format::
-
-
-File: hledger_journal.info,  Node: Digit group marks,  Next: Amount display format,  Up: Amounts
-
-1.7.1 Digit group marks
------------------------
-
-In the integer part of the quantity (left of the decimal mark), groups
-of digits can optionally be separated by a "digit group mark" - a space,
-comma, or period (different from the decimal mark):
-
-     $1,000,000.00
-  EUR 2.000.000,00
-INR 9,99,99,999.00
-      1 000 000.9455
-
-   Note, a number containing a single group mark and no decimal mark is
-ambiguous.  Are these group marks or decimal marks ?
-
-1,000
-1.000
-
-   hledger will treat them both as decimal marks by default (cf #793).
-If you use digit group marks, to prevent confusion and undetected typos
-we recommend you write commodity directives at the top of the file to
-explicitly declare the decimal mark (and optionally a digit group mark).
-Note, these formats ("amount styles") are specific to each commodity, so
-if your data uses multiple formats, hledger can handle it:
-
-commodity $1,000.00
-commodity EUR 1.000,00
-commodity INR 9,99,99,999.00
-commodity       1 000 000.9455
-
-
-File: hledger_journal.info,  Node: Amount display format,  Prev: Digit group marks,  Up: Amounts
-
-1.7.2 Amount display format
----------------------------
-
-For each commodity, hledger chooses a consistent format to use when
-displaying amounts.  (Except price amounts, which are always displayed
-as written).  The display format is chosen as follows:
-
-   * If there is a commodity directive for the commodity, that format is
-     used (see examples above).
-
-   * Otherwise the format of the first posting amount in that commodity
-     seen in the journal is used.  But the number of decimal places
-     ("precision") will be the maximum from all posting amounts in that
-     commmodity.
-
-   * Or if there are no such amounts in the journal, a default format is
-     used (like '$1000.00').
-
-   Price amounts, and amounts in 'D' directives don't affect the amount
-display format directly, but occasionally they can do so indirectly.
-(Eg when D's default commodity is applied to a commodity-less amount, or
-when an amountless posting is balanced using a price's commodity, or
-when -V is used.)  If you find this causing problems, use a commodity
-directive to set the display format.
-
-
-File: hledger_journal.info,  Node: Virtual Postings,  Next: Balance Assertions,  Prev: Amounts,  Up: FILE FORMAT
-
-1.8 Virtual Postings
-====================
-
-When you parenthesise the account name in a posting, we call that a
-_virtual posting_, which means:
-
-   * it is ignored when checking that the transaction is balanced
-   * it is excluded from reports when the '--real/-R' flag is used, or
-     the 'real:1' query.
-
-   You could use this, eg, to set an account's opening balance without
-needing to use the 'equity:opening balances' account:
-
-1/1 special unbalanced posting to set initial balance
-  (assets:checking)   $1000
-
-   When the account name is bracketed, we call it a _balanced virtual
-posting_.  This is like an ordinary virtual posting except the balanced
-virtual postings in a transaction must balance to 0, like the real
-postings (but separately from them).  Balanced virtual postings are also
-excluded by '--real/-R' or 'real:1'.
-
-1/1 buy food with cash, and update some budget-tracking subaccounts elsewhere
-  expenses:food                   $10
-  assets:cash                    $-10
-  [assets:checking:available]     $10
-  [assets:checking:budget:food]  $-10
-
-   Virtual postings have some legitimate uses, but those are few.  You
-can usually find an equivalent journal entry using real postings, which
-is more correct and provides better error checking.
-
-
-File: hledger_journal.info,  Node: Balance Assertions,  Next: Balance Assignments,  Prev: Virtual Postings,  Up: FILE FORMAT
-
-1.9 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 and
-b after each posting:
-
-2013/1/1
-  a   $1  =$1
-  b       =$-1
-
-2013/1/2
-  a   $1  =$2
-  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 protect 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.
-
-* Menu:
-
-* Assertions and ordering::
-* Assertions and included files::
-* Assertions and multiple -f options::
-* Assertions and commodities::
-* Assertions and prices::
-* Assertions and subaccounts::
-* Assertions and virtual postings::
-* Assertions and precision::
-
-
-File: hledger_journal.info,  Node: Assertions and ordering,  Next: Assertions and included files,  Up: Balance Assertions
-
-1.9.1 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
-different from Ledger, which sorts assertions only by parse order.
-(Also, Ledger assertions do not see the accumulated effect of repeated
-postings 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.  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.
-
-
-File: hledger_journal.info,  Node: Assertions and included files,  Next: Assertions and multiple -f options,  Prev: Assertions and ordering,  Up: Balance Assertions
-
-1.9.2 Assertions and included files
------------------------------------
-
-With included files, things are a little more complicated.  Including
-preserves the ordering of postings and assertions.  If you have multiple
-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.
-
-
-File: hledger_journal.info,  Node: Assertions and multiple -f options,  Next: Assertions and commodities,  Prev: Assertions and included files,  Up: Balance Assertions
-
-1.9.3 Assertions and multiple -f options
-----------------------------------------
-
-Balance assertions don't work well across files specified with multiple
--f options.  Use include or concatenate the files instead.
-
-
-File: hledger_journal.info,  Node: Assertions and commodities,  Next: Assertions and prices,  Prev: Assertions and multiple -f options,  Up: Balance Assertions
-
-1.9.4 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 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
-equals sign ('== EXPECTEDBALANCE').  This asserts that there are no
-other unasserted commodities in the account (or, that their balance is
-0).
-
-2013/1/1
-  a   $1
-  a    1€
-  b  $-1
-  c   -1€
-
-2013/1/2  ; These assertions succeed
-  a    0  =  $1
-  a    0  =   1€
-  b    0 == $-1
-  c    0 ==  -1€
-
-2013/1/3  ; This assertion fails as 'a' also contains 1€
-  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 into its own subaccount:
-
-2013/1/1
-  a:usd   $1
-  a:euro   1€
-  b
-
-2013/1/2
-  a        0 ==  0
-  a:usd    0 == $1
-  a:euro   0 ==  1€
-
-
-File: hledger_journal.info,  Node: Assertions and prices,  Next: Assertions and subaccounts,  Prev: Assertions and commodities,  Up: Balance Assertions
-
-1.9.5 Assertions and prices
----------------------------
-
-Balance assertions ignore transaction prices, and should normally be
-written without one:
-
-2019/1/1
-  (a)     $1 @ €1 = $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
-_assignments_ do use them (see below).
-
-
-File: hledger_journal.info,  Node: Assertions and subaccounts,  Next: Assertions and virtual postings,  Prev: Assertions and prices,  Up: Balance Assertions
-
-1.9.6 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 assert the balance including subaccounts by writing '=*' or '==*',
-eg:
-
-2019/1/1
-  equity:opening balances
-  checking:a       5
-  checking:b       5
-  checking         1  ==* 11
-
-
-File: hledger_journal.info,  Node: Assertions and virtual postings,  Next: Assertions and precision,  Prev: Assertions and subaccounts,  Up: Balance Assertions
-
-1.9.7 Assertions and virtual postings
--------------------------------------
-
-Balance assertions are checked against all postings, both real and
-virtual.  They are not affected by the '--real/-R' flag or 'real:'
-query.
-
-
-File: hledger_journal.info,  Node: Assertions and precision,  Prev: Assertions and virtual postings,  Up: Balance Assertions
-
-1.9.8 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 assertions.  Balance
-assertion failure messages show exact amounts.
-
-
-File: hledger_journal.info,  Node: Balance Assignments,  Next: Transaction prices,  Prev: Balance Assertions,  Up: FILE FORMAT
-
-1.10 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 setting
-opening balances:
-
-; starting a new journal, set asset account balances 
-2016/1/1 opening balances
-  assets:checking            = $409.32
-  assets:savings             = $735.24
-  assets:cash                 = $42
-  equity:opening balances
-
-   or when adjusting a balance to reality:
-
-; no cash left; update balance, record any untracked spending as a generic expense
-2016/1/15
-  assets:cash    = $0
-  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
-assignment).  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.
-
-* Menu:
-
-* Balance assignments and prices::
-
-
-File: hledger_journal.info,  Node: Balance assignments and prices,  Up: Balance Assignments
-
-1.10.1 Balance assignments and prices
--------------------------------------
-
-A transaction price in a balance assignment will cause the calculated
-amount to have that price attached:
-
-2019/1/1
-  (a)             = $1 @ €2
-
-$ hledger print --explicit
-2019/01/01
-    (a)         $1 @ €2 = $1 @ €2
-
-
-File: hledger_journal.info,  Node: Transaction prices,  Next: Comments,  Prev: Balance Assignments,  Up: FILE FORMAT
-
-1.11 Transaction prices
-=======================
-
-Within a transaction, you can note an amount's price in another
-commodity.  This can be used to document the cost (in a purchase) or
-selling price (in a sale).  For example, transaction prices are useful
-to record purchases of a foreign currency.  Note transaction prices are
-fixed at the time of the transaction, and do not change over time.  See
-also market prices, which represent prevailing exchange rates on a
-certain date.
-
-   There are several ways to record a transaction price:
-
-  1. Write the price per unit, as '@ UNITPRICE' after the amount:
-
-     2009/1/1
-       assets:euros     €100 @ $1.35  ; one hundred euros purchased at $1.35 each
-       assets:dollars                 ; balancing amount is -$135.00
-
-  2. Write the total price, as '@@ TOTALPRICE' after the amount:
-
-     2009/1/1
-       assets:euros     €100 @@ $135  ; one hundred euros purchased at $135 for the lot
-       assets:dollars
-
-  3. Specify amounts for all postings, using exactly two commodities,
-     and let hledger infer the price that balances the transaction:
-
-     2009/1/1
-       assets:euros     €100          ; one hundred euros purchased
-       assets:dollars  $-135          ; for $135
-
-   (Ledger users: Ledger uses a different syntax for fixed prices,
-'{=UNITPRICE}', which hledger currently ignores).
-
-   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:
-
-$ hledger bal -N --flat
-               $-135  assets:dollars
-                €100  assets:euros
-$ hledger bal -N --flat -B
-               $-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 amount.  So if example 3's postings are reversed, while the
-transaction is equivalent, -B shows something different:
-
-2009/1/1
-  assets:dollars  $-135              ; 135 dollars sold
-  assets:euros     €100              ; for 100 euros
-
-$ hledger bal -N --flat -B
-               €-100  assets:dollars  # <- the dollars' selling price
-                €100  assets:euros
-
-
-File: hledger_journal.info,  Node: Comments,  Next: Tags,  Prev: Transaction prices,  Up: FILE FORMAT
-
-1.12 Comments
-=============
-
-Lines in the journal beginning with a semicolon (';') or hash ('#') or
-star ('*') are comments, and will be ignored.  (Star comments cause
-org-mode nodes to be ignored, allowing emacs users to fold and navigate
-their journals with org-mode or orgstruct-mode.)
-
-   You can attach comments to a transaction by writing them after the
-description and/or indented on the following lines (before the
-postings).  Similarly, you can attach comments to an individual posting
-by writing them after the amount and/or indented on the following lines.
-Transaction and posting comments must begin with a semicolon (';').
-
-   Some examples:
-
-# a file comment
-
-; also a file comment
-
-comment
-This is a multiline file comment,
-which continues until a line
-where the "end comment" string
-appears on its own (or end of file).
-end comment
-
-2012/5/14 something  ; a transaction comment
-    ; the transaction comment, continued
-    posting1  1  ; a comment for posting 1
-    posting2
-    ; a comment for posting 2
-    ; another comment line for posting 2
-; a file comment (because not indented)
-
-   You can also comment larger regions of a file using 'comment' and
-'end comment' directives.
-
-
-File: hledger_journal.info,  Node: Tags,  Next: Directives,  Prev: Comments,  Up: FILE FORMAT
-
-1.13 Tags
-=========
-
-Tags are a way to add extra labels or labelled data to postings and
-transactions, which you can then search or pivot on.
-
-   A simple tag is a word (which may contain hyphens) followed by a full
-colon, written inside a transaction or posting comment line:
-
-2017/1/16 bought groceries  ; sometag:
-
-   Tags can have a value, which is the text after the colon, up to the
-next comma or end of line, with leading/trailing whitespace removed:
-
-    expenses:food    $10 ; a-posting-tag: the tag value
-
-   Note this means hledger's tag values can not contain commas or
-newlines.  Ending at commas means you can write multiple short tags on
-one line, comma separated:
-
-    assets:checking  ; a comment containing tag1:, tag2: some value ...
-
-   Here,
-
-   * "'a comment containing'" is just comment text, not a tag
-   * "'tag1'" is a tag with no value
-   * "'tag2'" is another tag, whose value is "'some value ...'"
-
-   Tags in a transaction comment affect the transaction and all of its
-postings, while tags in a posting comment affect only that posting.  For
-example, the following transaction has three tags ('A', 'TAG2',
-'third-tag') and the posting has four (those plus 'posting-tag'):
-
-1/1 a transaction  ; A:, TAG2:
-    ; third-tag: a third transaction tag, <- with a value
-    (a)  $1  ; posting-tag:
-
-   Tags are like Ledger's metadata feature, except hledger's tag values
-are simple strings.
-
-
-File: hledger_journal.info,  Node: Directives,  Next: Periodic transactions,  Prev: Tags,  Up: FILE FORMAT
-
-1.14 Directives
-===============
-
-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
-links to more detailed docs.
-
-directiveend       subdirectivespurpose                  can affect (as of
-         directive                                       2018/06)
------------------------------------------------------------------------------
-'account'          any     document account names,       all entries in
-                   text    declare account types &       all files, before
-                           display order                 or after
-'alias'  'end              rewrite account names         following
-         aliases'                                        inline/included
-                                                         entries until end
-                                                         of current file
-                                                         or end directive
-'apply   'end              prepend a common parent to    following
-account' apply             account names                 inline/included
-         account'                                        entries until end
-                                                         of current file
-                                                         or end directive
-'comment''end              ignore part of journal        following
-         comment'                                        inline/included
-                                                         entries until end
-                                                         of current file
-                                                         or end directive
-'commodity'        'format'declare a commodity and its   number notation:
-                           number notation & display     following entries
-                           style                         in that commodity
-                                                         in all files;
-                                                         display style:
-                                                         amounts of that
-                                                         commodity in
-                                                         reports
-'D'                        declare a commodity, number   commodity: all
-                           notation & display style      commodityless
-                           for commodityless amounts     entries in all
-                                                         files; number
-                                                         notation:
-                                                         following
-                                                         commodityless
-                                                         entries and
-                                                         entries in that
-                                                         commodity in all
-                                                         files; display
-                                                         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    amounts of that
-                           a commodity                   commodity in
-                                                         reports, when -V
-                                                         is used
-'Y'                        declare a year for yearless   following
-                           dates                         inline/included
-                                                         entries until end
-                                                         of current file
-
-   And some definitions:
-
-subdirectiveoptional indented directive line immediately following a
-          parent directive
-number    how to interpret numbers when parsing journal entries (the
-notation  identity of the decimal separator character).  (Currently
-          each commodity can have its own notation, even in the same
-          file.)
-display   how to display amounts of a commodity in reports (symbol side
-style     and spacing, digit groups, decimal separator, decimal places)
-directive which entries and (when there are multiple files) which files
-scope     are affected by a directive
-
-   As you can see, directives vary in which journal entries and files
-they affect, and whether they are focussed on input (parsing) or output
-(reports).  Some directives have multiple effects.
-
-   If you have a journal made up of multiple files, or pass multiple -f
-options on the command line, note that directives which affect input
-typically last only until the end of their defining file.  This provides
-more simplicity and predictability, eg reports are not changed by
-writing file options in a different order.  It can be surprising at
-times though.
-
-* Menu:
-
-* Comment blocks::
-* Including other files::
-* Default year::
-* Declaring commodities::
-* Default commodity::
-* Market prices::
-* Declaring accounts::
-* Rewriting accounts::
-* Default parent account::
-
-
-File: hledger_journal.info,  Node: Comment blocks,  Next: Including other files,  Up: Directives
-
-1.14.1 Comment blocks
----------------------
-
-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.
-
-
-File: hledger_journal.info,  Node: Including other files,  Next: Default year,  Prev: Comment blocks,  Up: Directives
-
-1.14.2 Including other files
-----------------------------
-
-You can pull in the content of additional files by writing an include
-directive, like this:
-
-include path/to/file.journal
-
-   If the path does not begin with a slash, it is relative to the
-current file.  The include file path may contain common glob patterns
-(e.g.  '*').
-
-   The 'include' directive can only be used in journal files.  It can
-include journal, timeclock or timedot files, but not CSV files.
-
-
-File: hledger_journal.info,  Node: Default year,  Next: Declaring commodities,  Prev: Including other files,  Up: Directives
-
-1.14.3 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.
-Eg:
-
-Y2009  ; set default year to 2009
-
-12/15  ; equivalent to 2009/12/15
-  expenses  1
-  assets
-
-Y2010  ; change default year to 2010
-
-2009/1/30  ; specifies the year, not affected
-  expenses  1
-  assets
-
-1/31   ; equivalent to 2010/1/31
-  expenses  1
-  assets
-
-
-File: hledger_journal.info,  Node: Declaring commodities,  Next: Default commodity,  Prev: Default year,  Up: Directives
-
-1.14.4 Declaring commodities
-----------------------------
-
-The 'commodity' directive has several functions:
-
-  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 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 format 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
-directives, 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.  It may be written on a single line, like this:
-
-; commodity EXAMPLEAMOUNT
-
-; display AAAA amounts with the symbol on the right, space-separated,
-; using period as decimal point, with four decimal places, and
-; 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
-places.):
-
-; commodity SYMBOL
-;   format EXAMPLEAMOUNT
-
-; display indian rupees with currency name on the left,
-; thousands, lakhs and crores comma-separated,
-; period as decimal point, and two decimal places.
-commodity INR
-  format INR 1,00,00,000.00
-
-   The quantity of the amount does not matter; only the format is
-significant.  The number must include a decimal mark: either a period or
-a comma, followed by 0 or more decimal digits.
-
-
-File: hledger_journal.info,  Node: Default commodity,  Next: Market prices,  Prev: Declaring commodities,  Up: Directives
-
-1.14.5 Default commodity
-------------------------
-
-The 'D' directive sets a default commodity (and display format), to be
-used for amounts without a commodity symbol (ie, plain numbers).  (Note
-this differs from Ledger's default commodity directive.)  The commodity
-and display format will be applied to all subsequent commodity-less
-amounts, or until the next 'D' directive.
-
-; commodity-less amounts should be treated as dollars
-; (and displayed with symbol on the left, thousands separators and two decimal places)
-D $1,000.00
-
-1/1
-  a     5  ; <- commodity-less amount, becomes $1
-  b
-
-   As with the 'commodity' directive, the amount must always be written
-with a decimal point.
-
-
-File: hledger_journal.info,  Node: Market prices,  Next: Declaring accounts,  Prev: Default commodity,  Up: Directives
-
-1.14.6 Market prices
---------------------
-
-The 'P' directive declares a market price, which is an exchange rate
-between 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:
-
-P DATE COMMODITYA COMMODITYBAMOUNT
-
-   * DATE is a simple date
-   * COMMODITYA is the symbol of the commodity being priced
-   * COMMODITYBAMOUNT is an amount (symbol and quantity) in a second
-     commodity, 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
-dollars during 2009, and $1.40 from 2010 onward:
-
-P 2009/1/1 € $1.35
-P 2010/1/1 € $1.40
-
-   The '-V/--value' flag can be used to convert reported amounts to
-another commodity using these prices.
-
-
-File: hledger_journal.info,  Node: Declaring accounts,  Next: Rewriting accounts,  Prev: Market prices,  Up: Directives
-
-1.14.7 Declaring accounts
--------------------------
-
-'account' directives can be used to pre-declare accounts.  Though not
-required, they can provide several benefits:
-
-   * They can document your intended chart of accounts, providing a
-     reference.
-   * They can store extra information about accounts (account numbers,
-     notes, etc.)
-   * They can help hledger know your accounts' types (asset, liability,
-     equity, revenue, expense), useful for reports like balancesheet and
-     incomestatement.
-   * They control account display order in reports, allowing
-     non-alphabetic sorting (eg Revenues to appear above Expenses).
-   * 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 account name, eg:
-
-account assets:bank:checking
-
-* Menu:
-
-* Account comments::
-* Account subdirectives::
-* Account types::
-* Account display order::
-
-
-File: hledger_journal.info,  Node: Account comments,  Next: Account subdirectives,  Up: Declaring accounts
-
-1.14.7.1 Account comments
-.........................
-
-Comments, beginning with a semicolon, optionally including tags, can be
-written after the account name, and/or on following lines.  Eg:
-
-account assets:bank:checking  ; a comment
-  ; another comment
-  ; acctno:12345, a tag
-
-   Tip: comments on the same line require hledger 1.12+.  If you need
-your journal to be compatible with older hledger versions, write
-comments on the next line instead.
-
-
-File: hledger_journal.info,  Node: Account subdirectives,  Next: Account types,  Prev: Account comments,  Up: Declaring accounts
-
-1.14.7.2 Account subdirectives
-..............................
-
-We also allow (and ignore) Ledger-style indented subdirectives, just for
-compatibility.:
-
-account assets:bank:checking
-  format blah blah  ; <- subdirective, ignored
-
-   Here is the full syntax of account directives:
-
-account ACCTNAME  [ACCTTYPE] [;COMMENT]
-  [;COMMENTS]
-  [LEDGER-STYLE SUBDIRECTIVES, IGNORED]
-
-
-File: hledger_journal.info,  Node: Account types,  Next: Account display order,  Prev: Account subdirectives,  Up: Declaring accounts
-
-1.14.7.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):
-
-account assets       ; type:Asset
-account liabilities  ; type:Liability
-account equity       ; type:Equity
-account revenues     ; type:Revenue
-account expenses     ; type:Expenses
-
-   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:
-
-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
-
-1.14.7.4 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
-sidebar.  By default accounts are listed in alphabetical order.  But if
-you have these account directives in the journal:
-
-account assets
-account liabilities
-account equity
-account revenues
-account expenses
-
-   you'll see those accounts displayed in declaration order, not
-alphabetically:
-
-$ hledger accounts -1
-assets
-liabilities
-equity
-revenues
-expenses
-
-   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,
-this directive:
-
-account other:zoo
-
-   would influence the position of 'zoo' among 'other''s subaccounts,
-but not the position of 'other' among the top-level accounts.  This
-means: - you will sometimes declare parent accounts (eg 'account other'
-above) that you don't intend to post to, just to customize their display
-order - sibling accounts stay together (you couldn't display 'x:y' in
-between 'a:b' and 'a:c').
-
-
-File: hledger_journal.info,  Node: Rewriting accounts,  Next: Default parent account,  Prev: Declaring accounts,  Up: Directives
-
-1.14.8 Rewriting accounts
--------------------------
-
-You can define account alias rules which rewrite your account names, or
-parts of them, before generating reports.  This can be useful for:
-
-   * expanding shorthand account names to their full form, allowing
-     easier data entry and a less verbose journal
-   * adapting old journals to your current chart of accounts
-   * experimenting with new account organisations, like a new hierarchy
-     or combining two accounts into one
-   * customising reports
-
-   Account aliases also rewrite account names in account directives.
-They do not affect account names being entered via hledger add or
-hledger-web.
-
-   See also Cookbook: Rewrite account names.
-
-* Menu:
-
-* Basic aliases::
-* Regex aliases::
-* Combining aliases::
-* end aliases::
-
-
-File: hledger_journal.info,  Node: Basic aliases,  Next: Regex aliases,  Up: Rewriting accounts
-
-1.14.8.1 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
-included files.  The spaces around the = are optional:
-
-alias OLD = NEW
-
-   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
-replace any occurrence of the old account name with the new one.
-Subaccounts 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"
-
-
-File: hledger_journal.info,  Node: Regex aliases,  Next: Combining aliases,  Prev: Basic aliases,  Up: Rewriting accounts
-
-1.14.8.2 Regex aliases
-......................
-
-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
-REPLACEMENT. If REGEX contains parenthesised match groups, these can be
-referenced by the usual numeric backreferences in REPLACEMENT. Eg:
-
-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
-whitespace.
-
-
-File: hledger_journal.info,  Node: Combining aliases,  Next: end aliases,  Prev: Regex aliases,  Up: Rewriting accounts
-
-1.14.8.3 Combining aliases
-..........................
-
-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
-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
-entry, we apply:
-
-  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
-     (left to right).
-
-   In other words, for (an account name in) a given journal entry:
-
-   * the nearest alias declaration before/above the entry is applied
-     first
-   * the next alias before/above that will be be applied next, and so on
-   * aliases defined after/below the entry do not affect it.
-
-   This gives nearby aliases precedence over distant ones, and helps
-provide semantic stability - aliases will keep working the same way
-independent of which files are being read and in which order.
-
-   In case of trouble, adding '--debug=6' to the command line will show
-which aliases are being applied when.
-
-
-File: hledger_journal.info,  Node: end aliases,  Prev: Combining aliases,  Up: Rewriting accounts
-
-1.14.8.4 'end aliases'
-......................
-
-You can clear (forget) all currently defined aliases with the 'end
-aliases' directive:
-
-end aliases
-
-
-File: hledger_journal.info,  Node: Default parent account,  Prev: Rewriting accounts,  Up: Directives
-
-1.14.9 Default parent account
------------------------------
-
-You can specify a parent account which will be prepended to all accounts
-within a section of the journal.  Use the 'apply account' and 'end apply
-account' directives like so:
-
-apply account home
-
-2010/1/1
-    food    $10
-    cash
-
-end apply account
-
-   which is equivalent to:
-
-2010/01/01
-    home:food           $10
-    home:cash          $-10
-
-   If 'end apply account' is omitted, the effect lasts to the end of the
-file.  Included files are also affected, eg:
-
-apply account business
-include biz.journal
-end apply account
-apply account personal
-include personal.journal
-
-   Prior to hledger 1.0, legacy 'account' and 'end' spellings were also
-supported.
-
-   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.
-
-
-File: hledger_journal.info,  Node: Periodic transactions,  Next: Auto postings / transaction modifiers,  Prev: Directives,  Up: FILE FORMAT
-
-1.15 Periodic transactions
-==========================
-
-Periodic transaction rules describe transactions that recur.  They allow
-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,
-read this whole section - or at least these tips:
-
-  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
-     tag:generated'.
-  3. Forecasted transactions will begin only after the last
-     non-forecasted transaction's date.
-  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
-     improvement, 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 error.
-  7. Other period expressions with an interval are automatically
-     expanded 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 2020/01/01', will be adjusted to start on
-     2019/12/10.
-
-* Menu:
-
-* Periodic rule syntax::
-* Two spaces between period expression and description!::
-* Forecasting with periodic transactions::
-* Budgeting with periodic transactions::
-
-
-File: hledger_journal.info,  Node: Periodic rule syntax,  Next: Two spaces between period expression and description!,  Up: Periodic transactions
-
-1.15.1 Periodic rule syntax
----------------------------
-
-A periodic transaction rule looks like a normal journal entry, with the
-date replaced by a tilde ('~') followed by a period expression
-(mnemonic: '~' looks like a recurring sine wave.):
-
-~ monthly
-    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
-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 they
-will be relative to Y/1/1.
-
-
-File: hledger_journal.info,  Node: Two spaces between period expression and description!,  Next: Forecasting with periodic transactions,  Prev: Periodic rule syntax,  Up: Periodic transactions
-
-1.15.2 Two spaces between period expression and 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
-accidentally alter their meaning, as in this example:
-
-; 2 or more spaces needed here, so the period is not understood as "every 2 months in 2020"
-;               ||
-;               vv
-~ every 2 months  in 2020, we will review
-    assets:bank:checking   $1500
-    income:acme inc
-
-   So,
-
-   * Do write two spaces between your period expression and your
-     transaction description, if any.
-   * Don't accidentally write two spaces in the middle of your period
-     expression.
-
-
-File: hledger_journal.info,  Node: Forecasting with periodic transactions,  Next: Budgeting with periodic transactions,  Prev: Two spaces between period expression and description!,  Up: Periodic transactions
-
-1.15.3 Forecasting with periodic transactions
----------------------------------------------
-
-With the '--forecast' flag, each periodic transaction rule generates
-future transactions recurring at the specified interval.  These are not
-saved in the journal, but appear in all reports.  They will look like
-normal transactions, but with an extra tag:
-
-   * 'generated-transaction:~ PERIODICEXPR' - shows that this was
-     generated by a periodic transaction rule, and the period
-
-   There is also a hidden tag, with an underscore prefix, which does not
-appear in hledger's output:
-
-   * '_generated-transaction:~ PERIODICEXPR'
-
-   This can be used to match transactions generated "just now", rather
-than generated in the past and saved to the journal.
-
-   Forecast transactions start on the first occurrence, and end on the
-last occurrence, of their interval within the forecast period.  The
-forecast period:
-
-   * begins on the later of
-        * the report start date if specified with -b/-p/date:
-        * the day after the latest normal (non-periodic) transaction in
-          the journal, or today if there are no normal transactions.
-
-   * ends on the report end date if specified with -e/-p/date:, or 180
-     days from today.
-
-   where "today" means the current date at report time.  The "later of"
-rule ensures that forecast transactions do not overlap normal
-transactions in time; they will begin only after normal transactions
-end.
-
-   Forecasting can be useful for estimating balances into the future,
-and experimenting with different scenarios.  Note the start date logic
-means that forecasted transactions are automatically replaced by normal
-transactions as you add those.
-
-   Forecasting can also help with data entry: describe most of your
-transactions with periodic rules, and every so often copy the output of
-'print --forecast' to the journal.
-
-   You can generate one-time transactions too: just write a period
-expression specifying a date with no report interval.  (You could also
-write a normal transaction with a future date, but remember this
-disables forecast transactions on previous dates.)
-
-
-File: hledger_journal.info,  Node: Budgeting with periodic transactions,  Prev: Forecasting with periodic transactions,  Up: Periodic transactions
-
-1.15.4 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
-compared in budget reports.
-
-   For more details, see: balance: Budget report and Budgeting and
-Forecasting.
-
-
-File: hledger_journal.info,  Node: Auto postings / transaction modifiers,  Prev: Periodic transactions,  Up: FILE FORMAT
-
-1.16 Auto postings / transaction modifiers
-==========================================
-
-Transaction modifier rules, AKA auto posting rules, describe changes to
-be applied automatically to certain matched transactions.  Currently
-just one kind of change is possible - adding extra postings, which we
-call "automated postings" or just "auto postings".  These rules become
-active when you use the '--auto' flag.
-
-   A transaction modifier rule looks much like a normal transaction
-except the first line is an equals sign followed by a query that matches
-certain postings (mnemonic: '=' suggests matching).  And each "posting"
-is actually a posting-generating rule:
-
-= QUERY
-    ACCT  AMT
-    ACCT  [AMT]
-    ...
-
-   These posting-generating rules look like normal postings, except the
-amount can be:
-
-   * a normal amount with a commodity symbol, eg '$2'.  This will be
-     used as-is.
-   * a number, eg '2'.  The commodity symbol (if any) from the matched
-     posting will be added to this.
-   * 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.
-   * 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.
-
-   These rules have global effect - a rule appearing anywhere in your
-data can potentially affect any transaction, including transactions
-recorded above it or in another file.
-
-   Some examples:
-
-; every time I buy food, schedule a dollar donation
-= expenses:food
-    (liabilities:charity)   $-1
-
-; when I buy a gift, also deduct that amount from a budget envelope subaccount
-= expenses:gifts
-    assets:checking:gifts  *-1
-    assets:checking         *1
-
-2017/12/1
-  expenses:food    $10
-  assets:checking
-
-2017/12/14
-  expenses:gifts   $20
-  assets:checking
-
-$ hledger print --auto
-2017/12/01
-    expenses:food              $10
-    assets:checking
-    (liabilities:charity)      $-1
-
-2017/12/14
-    expenses:gifts             $20
-    assets:checking
-    assets:checking:gifts     -$20
-    assets:checking            $20
-
-* Menu:
-
-* Auto postings and dates::
-* Auto postings and transaction balancing / inferred amounts / balance assertions::
-* Auto posting tags::
-
-
-File: hledger_journal.info,  Node: Auto postings and dates,  Next: Auto postings and transaction balancing / inferred amounts / balance assertions,  Up: Auto postings / transaction modifiers
-
-1.16.1 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 be
-used in the generated posting.
-
-
-File: hledger_journal.info,  Node: Auto postings and transaction balancing / inferred amounts / balance assertions,  Next: Auto posting tags,  Prev: Auto postings and dates,  Up: Auto postings / transaction modifiers
-
-1.16.2 Auto postings and transaction balancing / inferred amounts /
--------------------------------------------------------------------
-
-balance assertions Currently, transaction modifiers are applied / auto
-postings are added:
-
-   * after missing amounts are inferred, and transactions are checked
-     for balancedness,
-   * but before balance assertions are checked.
-
-   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.
-
-
-File: hledger_journal.info,  Node: Auto posting tags,  Prev: Auto postings and transaction balancing / inferred amounts / balance assertions,  Up: Auto postings / transaction modifiers
-
-1.16.3 Auto posting tags
-------------------------
-
-Postings added by transaction modifiers will have some extra tags:
-
-   * 'generated-posting:= QUERY' - shows this was generated by an auto
-     posting rule, and the query
-   * '_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 transaction modifier
-rules will have these tags added:
-
-   * 'modified:' - this transaction was modified
-   * '_modified:' - a hidden tag not appearing in the comment; this
-     transaction was modified "just now".
-
-
-File: hledger_journal.info,  Node: EDITOR SUPPORT,  Prev: FILE FORMAT,  Up: Top
-
-2 EDITOR SUPPORT
-****************
-
-Helper modes exist for popular text editors, which make working with
-journal files easier.  They add colour, formatting, tab completion, and
-helpful commands, and are quite recommended if you edit your journal
-with a text editor.  They include ledger-mode or hledger-mode for Emacs,
-vim-ledger for Vim, hledger-vscode for Visual Studio Code, and others.
-See the [[Cookbook]] at hledger.org for the latest information.
-
-
-Tag Table:
-Node: Top76
-Node: FILE FORMAT2356
-Ref: #file-format2480
-Node: Transactions2783
-Ref: #transactions2904
-Node: Postings3588
-Ref: #postings3715
-Node: Dates4710
-Ref: #dates4825
-Node: Simple dates4890
-Ref: #simple-dates5016
-Node: Secondary dates5382
-Ref: #secondary-dates5536
-Node: Posting dates7099
-Ref: #posting-dates7228
-Node: Status8600
-Ref: #status8720
-Node: Description10428
-Ref: #description10566
-Node: Payee and note10886
-Ref: #payee-and-note11000
-Node: Account names11335
-Ref: #account-names11478
-Node: Amounts11965
-Ref: #amounts12101
-Node: Digit group marks13034
-Ref: #digit-group-marks13183
-Node: Amount display format14121
-Ref: #amount-display-format14278
-Node: Virtual Postings15303
-Ref: #virtual-postings15462
-Node: Balance Assertions16682
-Ref: #balance-assertions16857
-Node: Assertions and ordering17816
-Ref: #assertions-and-ordering18002
-Node: Assertions and included files18702
-Ref: #assertions-and-included-files18943
-Node: Assertions and multiple -f options19276
-Ref: #assertions-and-multiple--f-options19530
-Node: Assertions and commodities19662
-Ref: #assertions-and-commodities19892
-Node: Assertions and prices21048
-Ref: #assertions-and-prices21260
-Node: Assertions and subaccounts21700
-Ref: #assertions-and-subaccounts21927
-Node: Assertions and virtual postings22251
-Ref: #assertions-and-virtual-postings22491
-Node: Assertions and precision22633
-Ref: #assertions-and-precision22824
-Node: Balance Assignments23091
-Ref: #balance-assignments23272
-Node: Balance assignments and prices24437
-Ref: #balance-assignments-and-prices24609
-Node: Transaction prices24833
-Ref: #transaction-prices25002
-Node: Comments27268
-Ref: #comments27402
-Node: Tags28572
-Ref: #tags28690
-Node: Directives30083
-Ref: #directives30226
-Node: Comment blocks35834
-Ref: #comment-blocks35979
-Node: Including other files36155
-Ref: #including-other-files36335
-Node: Default year36743
-Ref: #default-year36912
-Node: Declaring commodities37319
-Ref: #declaring-commodities37502
-Node: Default commodity39163
-Ref: #default-commodity39339
-Node: Market prices39973
-Ref: #market-prices40138
-Node: Declaring accounts40979
-Ref: #declaring-accounts41155
-Node: Account comments42080
-Ref: #account-comments42243
-Node: Account subdirectives42638
-Ref: #account-subdirectives42833
-Node: Account types43146
-Ref: #account-types43330
-Node: Account display order44972
-Ref: #account-display-order45142
-Node: Rewriting accounts46271
-Ref: #rewriting-accounts46456
-Node: Basic aliases47192
-Ref: #basic-aliases47338
-Node: Regex aliases48042
-Ref: #regex-aliases48214
-Node: Combining aliases48932
-Ref: #combining-aliases49110
-Node: end aliases50386
-Ref: #end-aliases50534
-Node: Default parent account50635
-Ref: #default-parent-account50801
-Node: Periodic transactions51685
-Ref: #periodic-transactions51883
-Node: Periodic rule syntax53755
-Ref: #periodic-rule-syntax53961
-Node: Two spaces between period expression and description!54665
-Ref: #two-spaces-between-period-expression-and-description54984
-Node: Forecasting with periodic transactions55668
-Ref: #forecasting-with-periodic-transactions55973
-Node: Budgeting with periodic transactions57999
-Ref: #budgeting-with-periodic-transactions58238
-Node: Auto postings / transaction modifiers58687
-Ref: #auto-postings-transaction-modifiers58898
-Node: Auto postings and dates61127
-Ref: #auto-postings-and-dates61384
-Node: Auto postings and transaction balancing / inferred amounts / balance assertions61559
-Ref: #auto-postings-and-transaction-balancing-inferred-amounts-balance-assertions61934
-Node: Auto posting tags62312
-Ref: #auto-posting-tags62551
-Node: EDITOR SUPPORT63216
-Ref: #editor-support63334
+File: hledger_journal.info,  Node: Top,  Up: (dir)
+
+hledger_journal(5) hledger 1.17
+*******************************
+
+Journal - hledger's default file format, representing a General Journal
+
+   hledger's usual data source is a plain text file containing journal
+entries in hledger journal format.  This file represents a standard
+accounting general journal.  I use file names ending in '.journal', but
+that's not required.  The journal file contains a number of transaction
+entries, each describing a transfer of money (or any commodity) between
+two or more named accounts, in a simple format readable by both hledger
+and humans.
+
+   hledger's journal format is a compatible subset, mostly, of ledger's
+journal format, so hledger can work with compatible ledger journal files
+as well.  It's safe, and encouraged, to run both hledger and ledger on
+the same journal file, eg to validate the results you're getting.
+
+   You can use hledger without learning any more about this file; just
+use the add or web or import commands to create and update it.
+
+   Many users, though, edit the journal file with a text editor, and
+track changes with a version control system such as git.  Editor addons
+such as ledger-mode or hledger-mode for Emacs, vim-ledger for Vim, and
+hledger-vscode for Visual Studio Code, make this easier, adding colour,
+formatting, tab completion, and useful commands.  See Editor
+configuration at hledger.org for the full list.
+
+   Here's a description of each part of the file format (and hledger's
+data model).  These are mostly in the order you'll use them, but in some
+cases related concepts have been grouped together for easy reference, or
+linked before they are introduced, so feel free to skip over anything
+that looks unnecessary right now.
+
+* Menu:
+
+* Transactions::
+
+
+File: hledger_journal.info,  Node: Transactions,  Up: Top
+
+1 Transactions
+**************
+
+Transactions are the main unit of information in a journal file.  They
+represent events, typically a movement of some quantity of commodities
+between two or more named accounts.
+
+   Each transaction is recorded as a journal entry, beginning with a
+simple date in column 0.  This can be followed by any of the following
+optional fields, separated by spaces:
+
+   * a status character (empty, '!', or '*')
+   * a code (any short number or text, enclosed in parentheses)
+   * a description (any remaining text until end of line or a semicolon)
+   * a comment (any remaining text following a semicolon until end of
+     line, and any following indented lines beginning with a semicolon)
+   * 0 or more indented _posting_ lines, describing what was transferred
+     and the accounts involved.
+
+   Here's a simple journal file containing one transaction:
+
+2008/01/01 income
+  assets:bank:checking   $1
+  income:salary         $-1
+
+* Menu:
+
+* Dates::
+* Status::
+* Description::
+* Comments::
+* Tags::
+* Postings::
+* Account names::
+* Amounts::
+* Transaction prices::
+* Balance Assertions::
+* Balance Assignments::
+* Directives::
+* Periodic transactions::
+* Auto postings / transaction modifiers::
+
+
+File: hledger_journal.info,  Node: Dates,  Next: Status,  Up: Transactions
+
+1.1 Dates
+=========
+
+* Menu:
+
+* Simple dates::
+* Secondary dates::
+* Posting dates::
+
+
+File: hledger_journal.info,  Node: Simple dates,  Next: Secondary dates,  Up: Dates
+
+1.1.1 Simple dates
+------------------
+
+Dates in the journal file use _simple dates_ format: 'YYYY-MM-DD' or
+'YYYY/MM/DD' or 'YYYY.MM.DD', with leading zeros optional.  The year may
+be omitted, in which case it will be inferred from the context: the
+current transaction, the default year set with a default year directive,
+or the current date when the command is run.  Some examples:
+'2010-01-31', '2010/01/31', '2010.1.31', '1/31'.
+
+   (The UI also accepts simple dates, as well as the more flexible smart
+dates documented in the hledger manual.)
+
+
+File: hledger_journal.info,  Node: Secondary dates,  Next: Posting dates,  Prev: Simple dates,  Up: Dates
+
+1.1.2 Secondary dates
+---------------------
+
+Real-life transactions sometimes involve more than one date - eg the
+date you write a cheque, and the date it clears in your bank.  When you
+want to model this, for more accurate daily balances, you can specify
+individual posting dates.
+
+   Or, you can use the older _secondary date_ feature (Ledger calls it
+auxiliary date or effective date).  Note: we support this for
+compatibility, but I usually recommend avoiding this feature; posting
+dates are almost always clearer and simpler.
+
+   A secondary date is written after the primary date, following an
+equals sign.  If the year is omitted, the primary date's year is
+assumed.  When running reports, the primary (left) date is used by
+default, but with the '--date2' flag (or '--aux-date' or '--effective'),
+the secondary (right) date will be used instead.
+
+   The meaning of secondary dates is up to you, but it's best to follow
+a consistent rule.  Eg "primary = the bank's clearing date, secondary =
+date the transaction was initiated, if different", as shown here:
+
+2010/2/23=2/19 movie ticket
+  expenses:cinema                   $10
+  assets:checking
+
+$ hledger register checking
+2010-02-23 movie ticket         assets:checking                $-10         $-10
+
+$ hledger register checking --date2
+2010-02-19 movie ticket         assets:checking                $-10         $-10
+
+
+File: hledger_journal.info,  Node: Posting dates,  Prev: Secondary dates,  Up: Dates
+
+1.1.3 Posting dates
+-------------------
+
+You can give individual postings a different date from their parent
+transaction, by adding a posting comment containing a tag (see below)
+like 'date:DATE'.  This is probably the best way to control posting
+dates precisely.  Eg in this example the expense should appear in May
+reports, and the deduction from checking should be reported on 6/1 for
+easy bank reconciliation:
+
+2015/5/30
+    expenses:food     $10  ; food purchased on saturday 5/30
+    assets:checking        ; bank cleared it on monday, date:6/1
+
+$ hledger -f t.j register food
+2015-05-30                      expenses:food                  $10           $10
+
+$ hledger -f t.j register checking
+2015-06-01                      assets:checking               $-10          $-10
+
+   DATE should be a simple date; if the year is not specified it will
+use the year of the transaction's date.  You can set the secondary date
+similarly, with 'date2:DATE2'.  The 'date:' or 'date2:' tags must have a
+valid simple date value if they are present, eg a 'date:' tag with no
+value is not allowed.
+
+   Ledger's earlier, more compact bracketed date syntax is also
+supported: '[DATE]', '[DATE=DATE2]' or '[=DATE2]'.  hledger will attempt
+to parse any square-bracketed sequence of the '0123456789/-.='
+characters in this way.  With this syntax, DATE infers its year from the
+transaction and DATE2 infers its year from DATE.
+
+
+File: hledger_journal.info,  Node: Status,  Next: Description,  Prev: Dates,  Up: Transactions
+
+1.2 Status
+==========
+
+Transactions, or individual postings within a transaction, can have a
+status mark, which is a single character before the transaction
+description or posting account name, separated from it by a space,
+indicating one of three statuses:
+
+mark  status
+ 
+-----------------
+      unmarked
+'!'   pending
+'*'   cleared
+
+   When reporting, you can filter by status with the '-U/--unmarked',
+'-P/--pending', and '-C/--cleared' flags; or the 'status:', 'status:!',
+and 'status:*' queries; or the U, P, C keys in hledger-ui.
+
+   Note, in Ledger and in older versions of hledger, the "unmarked"
+state is called "uncleared".  As of hledger 1.3 we have renamed it to
+unmarked for clarity.
+
+   To replicate Ledger and old hledger's behaviour of also matching
+pending, combine -U and -P.
+
+   Status marks are optional, but can be helpful eg for reconciling with
+real-world accounts.  Some editor modes provide highlighting and
+shortcuts for working with status.  Eg in Emacs ledger-mode, you can
+toggle transaction status with C-c C-e, or posting status with C-c C-c.
+
+   What "uncleared", "pending", and "cleared" actually mean is up to
+you.  Here's one suggestion:
+
+status     meaning
+--------------------------------------------------------------------------
+uncleared  recorded but not yet reconciled; needs review
+pending    tentatively reconciled (if needed, eg during a big
+           reconciliation)
+cleared    complete, reconciled as far as possible, and considered
+           correct
+
+   With this scheme, you would use '-PC' to see the current balance at
+your bank, '-U' to see things which will probably hit your bank soon
+(like uncashed checks), and no flags to see the most up-to-date state of
+your finances.
+
+
+File: hledger_journal.info,  Node: Description,  Next: Comments,  Prev: Status,  Up: Transactions
+
+1.3 Description
+===============
+
+A transaction's description is the rest of the line following the date
+and status mark (or until a comment begins).  Sometimes called the
+"narration" in traditional bookkeeping, it can be used for whatever you
+wish, or left blank.  Transaction descriptions can be queried, unlike
+comments.
+
+* Menu:
+
+* Payee and note::
+
+
+File: hledger_journal.info,  Node: Payee and note,  Up: Description
+
+1.3.1 Payee and note
+--------------------
+
+You can optionally include a '|' (pipe) character in descriptions to
+subdivide the description into separate fields for payee/payer name on
+the left (up to the first '|') and an additional note field on the right
+(after the first '|').  This may be worthwhile if you need to do more
+precise querying and pivoting by payee or by note.
+
+
+File: hledger_journal.info,  Node: Comments,  Next: Tags,  Prev: Description,  Up: Transactions
+
+1.4 Comments
+============
+
+Lines in the journal beginning with a semicolon (';') or hash ('#') or
+star ('*') are comments, and will be ignored.  (Star comments cause
+org-mode nodes to be ignored, allowing emacs users to fold and navigate
+their journals with org-mode or orgstruct-mode.)
+
+   You can attach comments to a transaction by writing them after the
+description and/or indented on the following lines (before the
+postings).  Similarly, you can attach comments to an individual posting
+by writing them after the amount and/or indented on the following lines.
+Transaction and posting comments must begin with a semicolon (';').
+
+   Some examples:
+
+# a file comment
+; another file comment
+* also a file comment, useful in org/orgstruct mode
+
+comment
+A multiline file comment, which continues
+until a line containing just "end comment"
+(or end of file).
+end comment
+
+2012/5/14 something  ; a transaction comment
+    ; the transaction comment, continued
+    posting1  1  ; a comment for posting 1
+    posting2
+    ; a comment for posting 2
+    ; another comment line for posting 2
+; a file comment (because not indented)
+
+   You can also comment larger regions of a file using 'comment' and
+'end comment' directives.
+
+
+File: hledger_journal.info,  Node: Tags,  Next: Postings,  Prev: Comments,  Up: Transactions
+
+1.5 Tags
+========
+
+Tags are a way to add extra labels or labelled data to postings and
+transactions, which you can then search or pivot on.
+
+   A simple tag is a word (which may contain hyphens) followed by a full
+colon, written inside a transaction or posting comment line:
+
+2017/1/16 bought groceries  ; sometag:
+
+   Tags can have a value, which is the text after the colon, up to the
+next comma or end of line, with leading/trailing whitespace removed:
+
+    expenses:food    $10 ; a-posting-tag: the tag value
+
+   Note this means hledger's tag values can not contain commas or
+newlines.  Ending at commas means you can write multiple short tags on
+one line, comma separated:
+
+    assets:checking  ; a comment containing tag1:, tag2: some value ...
+
+   Here,
+
+   * "'a comment containing'" is just comment text, not a tag
+   * "'tag1'" is a tag with no value
+   * "'tag2'" is another tag, whose value is "'some value ...'"
+
+   Tags in a transaction comment affect the transaction and all of its
+postings, while tags in a posting comment affect only that posting.  For
+example, the following transaction has three tags ('A', 'TAG2',
+'third-tag') and the posting has four (those plus 'posting-tag'):
+
+1/1 a transaction  ; A:, TAG2:
+    ; third-tag: a third transaction tag, <- with a value
+    (a)  $1  ; posting-tag:
+
+   Tags are like Ledger's metadata feature, except hledger's tag values
+are simple strings.
+
+
+File: hledger_journal.info,  Node: Postings,  Next: Account names,  Prev: Tags,  Up: Transactions
+
+1.6 Postings
+============
+
+A posting is an addition of some amount to, or removal of some amount
+from, an account.  Each posting line begins with at least one space or
+tab (2 or 4 spaces is common), followed by:
+
+   * (optional) a status character (empty, '!', or '*'), followed by a
+     space
+   * (required) an account name (any text, optionally containing *single
+     spaces*, until end of line or a double space)
+   * (optional) *two or more spaces* or tabs followed by an amount.
+
+   Positive amounts are being added to the account, negative amounts are
+being removed.
+
+   The amounts within a transaction must always sum up to zero.  As a
+convenience, one amount may be left blank; it will be inferred so as to
+balance the transaction.
+
+   Be sure to note the unusual two-space delimiter between account name
+and amount.  This makes it easy to write account names containing
+spaces.  But if you accidentally leave only one space (or tab) before
+the amount, the amount will be considered part of the account name.
+
+* Menu:
+
+* Virtual Postings::
+
+
+File: hledger_journal.info,  Node: Virtual Postings,  Up: Postings
+
+1.6.1 Virtual Postings
+----------------------
+
+A posting with a parenthesised account name is called a _virtual
+posting_ or _unbalanced posting_, which means it is exempt from the
+usual rule that a transaction's postings must balance add up to zero.
+
+   This is not part of double entry accounting, so you might choose to
+avoid this feature.  Or you can use it sparingly for certain special
+cases where it can be convenient.  Eg, you could set opening balances
+without using a balancing equity account:
+
+1/1 opening balances
+  (assets:checking)   $1000
+  (assets:savings)    $2000
+
+   A posting with a bracketed account name is called a _balanced virtual
+posting_.  The balanced virtual postings in a transaction must add up to
+zero (separately from other postings).  Eg:
+
+1/1 buy food with cash, update budget envelope subaccounts, & something else
+  assets:cash                    $-10 ; <- these balance
+  expenses:food                    $7 ; <-
+  expenses:food                    $3 ; <-
+  [assets:checking:budget:food]  $-10    ; <- and these balance
+  [assets:checking:available]     $10    ; <-
+  (something:else)                 $5       ; <- not required to balance
+
+   Ordinary non-parenthesised, non-bracketed postings are called _real
+postings_.  You can exclude virtual postings from reports with the
+'-R/--real' flag or 'real:1' query.
+
+
+File: hledger_journal.info,  Node: Account names,  Next: Amounts,  Prev: Postings,  Up: Transactions
+
+1.7 Account names
+=================
+
+Account names typically have several parts separated by a full colon,
+from which hledger derives a hierarchical chart of accounts.  They can
+be anything you like, but in finance there are traditionally five
+top-level accounts: 'assets', 'liabilities', 'income', 'expenses', and
+'equity'.
+
+   Account names may contain single spaces, eg: 'assets:accounts
+receivable'.  Because of this, they must always be followed by *two or
+more spaces* (or newline).
+
+   Account names can be aliased.
+
+
+File: hledger_journal.info,  Node: Amounts,  Next: Transaction prices,  Prev: Account names,  Up: Transactions
+
+1.8 Amounts
+===========
+
+After the account name, there is usually an amount.  (Important: between
+account name and amount, there must be *two or more spaces*.)
+
+   hledger's amount format is flexible, supporting several international
+formats.  Here are some examples.  Amounts have a number (the
+"quantity"):
+
+1
+
+   ..and usually a currency or commodity name (the "commodity").  This
+is a symbol, word, or phrase, to the left or right of the quantity, with
+or without a separating space:
+
+$1
+4000 AAPL
+
+   If the commodity name contains spaces, numbers, or punctuation, it
+must be enclosed in double quotes:
+
+3 "no. 42 green apples"
+
+   Amounts can be negative.  The minus sign can be written before or
+after a left-side commodity symbol:
+
+-$1
+$-1
+
+   Scientific E notation is allowed:
+
+1E-6
+EUR 1E3
+
+   A decimal mark (decimal point) can be written with a period or a
+comma:
+
+1.23
+1,23456780000009
+
+* Menu:
+
+* Digit group marks::
+* Amount display style::
+
+
+File: hledger_journal.info,  Node: Digit group marks,  Next: Amount display style,  Up: Amounts
+
+1.8.1 Digit group marks
+-----------------------
+
+In the integer part of the quantity (left of the decimal mark), groups
+of digits can optionally be separated by a "digit group mark" - a space,
+comma, or period (different from the decimal mark):
+
+     $1,000,000.00
+  EUR 2.000.000,00
+INR 9,99,99,999.00
+      1 000 000.9455
+
+   Note, a number containing a single group mark and no decimal mark is
+ambiguous.  Are these group marks or decimal marks ?
+
+1,000
+1.000
+
+   hledger will treat them both as decimal marks by default (cf #793).
+If you use digit group marks, to prevent confusion and undetected typos
+we recommend you write commodity directives at the top of the file to
+explicitly declare the decimal mark (and optionally a digit group mark).
+Note, these formats ("amount styles") are specific to each commodity, so
+if your data uses multiple formats, hledger can handle it:
+
+commodity $1,000.00
+commodity EUR 1.000,00
+commodity INR 9,99,99,999.00
+commodity       1 000 000.9455
+
+
+File: hledger_journal.info,  Node: Amount display style,  Prev: Digit group marks,  Up: Amounts
+
+1.8.2 Amount display style
+--------------------------
+
+For each commodity, hledger chooses a consistent format to use when
+displaying amounts.  (Except price amounts, which are always displayed
+as written).  The display style is chosen as follows:
+
+   * If there is a commodity directive (or default commodity directive)
+     for the commodity, that format is used (see examples above).
+
+   * Otherwise the format of the first posting amount in that commodity
+     seen in the journal is used.  But the number of decimal places
+     ("precision") will be the maximum from all posting amounts in that
+     commmodity.
+
+   * Or if there are no such amounts in the journal, a default format is
+     used (like '$1000.00').
+
+   Transaction prices don't affect the amount display style directly,
+but occasionally they can do so indirectly (eg when an posting's amount
+is inferred using a transaction price).  If you find this causing
+problems, use a commodity directive to fix the display style.
+
+   In summary: amounts will be displayed much as they appear in your
+journal, with the max observed number of decimal places.  If you want to
+see fewer decimal places in reports, use a commodity directive to
+override that.
+
+
+File: hledger_journal.info,  Node: Transaction prices,  Next: Balance Assertions,  Prev: Amounts,  Up: Transactions
+
+1.9 Transaction prices
+======================
+
+Within a transaction, you can note an amount's price in another
+commodity.  This can be used to document the cost (in a purchase) or
+selling price (in a sale).  For example, transaction prices are useful
+to record purchases of a foreign currency.  Note transaction prices are
+fixed at the time of the transaction, and do not change over time.  See
+also market prices, which represent prevailing exchange rates on a
+certain date.
+
+   There are several ways to record a transaction price:
+
+  1. Write the price per unit, as '@ UNITPRICE' after the amount:
+
+     2009/1/1
+       assets:euros     €100 @ $1.35  ; one hundred euros purchased at $1.35 each
+       assets:dollars                 ; balancing amount is -$135.00
+
+  2. Write the total price, as '@@ TOTALPRICE' after the amount:
+
+     2009/1/1
+       assets:euros     €100 @@ $135  ; one hundred euros purchased at $135 for the lot
+       assets:dollars
+
+  3. Specify amounts for all postings, using exactly two commodities,
+     and let hledger infer the price that balances the transaction:
+
+     2009/1/1
+       assets:euros     €100          ; one hundred euros purchased
+       assets:dollars  $-135          ; for $135
+
+   (Ledger users: Ledger uses a different syntax for fixed prices,
+'{=UNITPRICE}', which hledger currently ignores).
+
+   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:
+
+$ hledger bal -N --flat
+               $-135  assets:dollars
+                €100  assets:euros
+$ hledger bal -N --flat -B
+               $-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 amount.  So if example 3's postings are reversed, while the
+transaction is equivalent, -B shows something different:
+
+2009/1/1
+  assets:dollars  $-135              ; 135 dollars sold
+  assets:euros     €100              ; for 100 euros
+
+$ hledger bal -N --flat -B
+               €-100  assets:dollars  # <- the dollars' selling price
+                €100  assets:euros
+
+
+File: hledger_journal.info,  Node: Balance Assertions,  Next: Balance Assignments,  Prev: Transaction prices,  Up: Transactions
+
+1.10 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 and
+b after each posting:
+
+2013/1/1
+  a   $1  =$1
+  b       =$-1
+
+2013/1/2
+  a   $1  =$2
+  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 protect 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 balance assignments, below).
+
+* Menu:
+
+* Assertions and ordering::
+* Assertions and included files::
+* Assertions and multiple -f options::
+* Assertions and commodities::
+* Assertions and prices::
+* Assertions and subaccounts::
+* Assertions and virtual postings::
+* Assertions and precision::
+
+
+File: hledger_journal.info,  Node: Assertions and ordering,  Next: Assertions and included files,  Up: Balance Assertions
+
+1.10.1 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
+different from Ledger, which sorts assertions only by parse order.
+(Also, Ledger assertions do not see the accumulated effect of repeated
+postings 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.  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.
+
+
+File: hledger_journal.info,  Node: Assertions and included files,  Next: Assertions and multiple -f options,  Prev: Assertions and ordering,  Up: Balance Assertions
+
+1.10.2 Assertions and included files
+------------------------------------
+
+With included files, things are a little more complicated.  Including
+preserves the ordering of postings and assertions.  If you have multiple
+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.
+
+
+File: hledger_journal.info,  Node: Assertions and multiple -f options,  Next: Assertions and commodities,  Prev: Assertions and included files,  Up: Balance Assertions
+
+1.10.3 Assertions and multiple -f options
+-----------------------------------------
+
+Balance assertions don't work well across files specified with multiple
+-f options.  Use include or concatenate the files instead.
+
+
+File: hledger_journal.info,  Node: Assertions and commodities,  Next: Assertions and prices,  Prev: Assertions and multiple -f options,  Up: Balance Assertions
+
+1.10.4 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 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
+equals sign ('== EXPECTEDBALANCE').  This asserts that there are no
+other unasserted commodities in the account (or, that their balance is
+0).
+
+2013/1/1
+  a   $1
+  a    1€
+  b  $-1
+  c   -1€
+
+2013/1/2  ; These assertions succeed
+  a    0  =  $1
+  a    0  =   1€
+  b    0 == $-1
+  c    0 ==  -1€
+
+2013/1/3  ; This assertion fails as 'a' also contains 1€
+  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 into its own subaccount:
+
+2013/1/1
+  a:usd   $1
+  a:euro   1€
+  b
+
+2013/1/2
+  a        0 ==  0
+  a:usd    0 == $1
+  a:euro   0 ==  1€
+
+
+File: hledger_journal.info,  Node: Assertions and prices,  Next: Assertions and subaccounts,  Prev: Assertions and commodities,  Up: Balance Assertions
+
+1.10.5 Assertions and prices
+----------------------------
+
+Balance assertions ignore transaction prices, and should normally be
+written without one:
+
+2019/1/1
+  (a)     $1 @ €1 = $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
+_assignments_ do use them (see below).
+
+
+File: hledger_journal.info,  Node: Assertions and subaccounts,  Next: Assertions and virtual postings,  Prev: Assertions and prices,  Up: Balance Assertions
+
+1.10.6 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 assert the balance including subaccounts by writing '=*' or '==*',
+eg:
+
+2019/1/1
+  equity:opening balances
+  checking:a       5
+  checking:b       5
+  checking         1  ==* 11
+
+
+File: hledger_journal.info,  Node: Assertions and virtual postings,  Next: Assertions and precision,  Prev: Assertions and subaccounts,  Up: Balance Assertions
+
+1.10.7 Assertions and virtual postings
+--------------------------------------
+
+Balance assertions are checked against all postings, both real and
+virtual.  They are not affected by the '--real/-R' flag or 'real:'
+query.
+
+
+File: hledger_journal.info,  Node: Assertions and precision,  Prev: Assertions and virtual postings,  Up: Balance Assertions
+
+1.10.8 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 assertions.  Balance
+assertion failure messages show exact amounts.
+
+
+File: hledger_journal.info,  Node: Balance Assignments,  Next: Directives,  Prev: Balance Assertions,  Up: Transactions
+
+1.11 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 setting
+opening balances:
+
+; starting a new journal, set asset account balances
+2016/1/1 opening balances
+  assets:checking            = $409.32
+  assets:savings             = $735.24
+  assets:cash                 = $42
+  equity:opening balances
+
+   or when adjusting a balance to reality:
+
+; no cash left; update balance, record any untracked spending as a generic expense
+2016/1/15
+  assets:cash    = $0
+  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
+assignment).  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.
+
+* Menu:
+
+* Balance assignments and prices::
+
+
+File: hledger_journal.info,  Node: Balance assignments and prices,  Up: Balance Assignments
+
+1.11.1 Balance assignments and prices
+-------------------------------------
+
+A transaction price in a balance assignment will cause the calculated
+amount to have that price attached:
+
+2019/1/1
+  (a)             = $1 @ €2
+
+$ hledger print --explicit
+2019-01-01
+    (a)         $1 @ €2 = $1 @ €2
+
+
+File: hledger_journal.info,  Node: Directives,  Next: Periodic transactions,  Prev: Balance Assignments,  Up: Transactions
+
+1.12 Directives
+===============
+
+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
+links to more detailed docs.
+
+directiveend       subdirectivespurpose                  can affect (as of
+         directive                                       2018/06)
+-----------------------------------------------------------------------------
+'account'          any     document account names,       all entries in
+                   text    declare account types &       all files, before
+                           display order                 or after
+'alias'  'end              rewrite account names         following
+         aliases'                                        inline/included
+                                                         entries until end
+                                                         of current file
+                                                         or end directive
+'apply   'end              prepend a common parent to    following
+account' apply             account names                 inline/included
+         account'                                        entries until end
+                                                         of current file
+                                                         or end directive
+'comment''end              ignore part of journal        following
+         comment'                                        inline/included
+                                                         entries until end
+                                                         of current file
+                                                         or end directive
+'commodity'        'format'declare a commodity and its   number notation:
+                           number notation & display     following entries
+                           style                         in that commodity
+                                                         in all files;
+                                                         display style:
+                                                         amounts of that
+                                                         commodity in
+                                                         reports
+'D'                        declare a commodity to be     default
+                           used for commodityless        commodity:
+                           amounts, and its number       following
+                           notation & display style      commodityless
+                                                         entries until end
+                                                         of current file;
+                                                         number notation:
+                                                         following entries
+                                                         in that commodity
+                                                         until end of
+                                                         current file;
+                                                         display 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    amounts of that
+                           a commodity                   commodity in
+                                                         reports, when -V
+                                                         is used
+'Y'                        declare a year for yearless   following
+                           dates                         inline/included
+                                                         entries until end
+                                                         of current file
+
+   And some definitions:
+
+subdirectiveoptional indented directive line immediately following a parent
+       directive
+number how to interpret numbers when parsing journal entries (the
+notationidentity of the decimal separator character).  (Currently each
+       commodity can have its own notation, even in the same file.)
+displayhow to display amounts of a commodity in reports (symbol side
+style  and spacing, digit groups, decimal separator, decimal places)
+directivewhich entries and (when there are multiple files) which files
+scope  are affected by a directive
+
+   As you can see, directives vary in which journal entries and files
+they affect, and whether they are focussed on input (parsing) or output
+(reports).  Some directives have multiple effects.
+
+   If you have a journal made up of multiple files, or pass multiple -f
+options on the command line, note that directives which affect input
+typically last only until the end of their defining file.  This provides
+more simplicity and predictability, eg reports are not changed by
+writing file options in a different order.  It can be surprising at
+times though.
+
+* Menu:
+
+* Comment blocks::
+* Including other files::
+* Default year::
+* Declaring commodities::
+* Default commodity::
+* Market prices::
+* Declaring accounts::
+* Rewriting accounts::
+* Default parent account::
+
+
+File: hledger_journal.info,  Node: Comment blocks,  Next: Including other files,  Up: Directives
+
+1.12.1 Comment blocks
+---------------------
+
+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.
+
+
+File: hledger_journal.info,  Node: Including other files,  Next: Default year,  Prev: Comment blocks,  Up: Directives
+
+1.12.2 Including other files
+----------------------------
+
+You can pull in the content of additional files by writing an include
+directive, like this:
+
+include path/to/file.journal
+
+   If the path does not begin with a slash, it is relative to the
+current file.  The include file path may contain common glob patterns
+(e.g.  '*').
+
+   The 'include' directive can only be used in journal files.  It can
+include journal, timeclock or timedot files, but not CSV files.
+
+
+File: hledger_journal.info,  Node: Default year,  Next: Declaring commodities,  Prev: Including other files,  Up: Directives
+
+1.12.3 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.
+Eg:
+
+Y2009  ; set default year to 2009
+
+12/15  ; equivalent to 2009/12/15
+  expenses  1
+  assets
+
+Y2010  ; change default year to 2010
+
+2009/1/30  ; specifies the year, not affected
+  expenses  1
+  assets
+
+1/31   ; equivalent to 2010/1/31
+  expenses  1
+  assets
+
+
+File: hledger_journal.info,  Node: Declaring commodities,  Next: Default commodity,  Prev: Default year,  Up: Directives
+
+1.12.4 Declaring commodities
+----------------------------
+
+The 'commodity' directive has several functions:
+
+  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' and '1.000' as 1).
+
+  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
+directives, 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.  It may be written on a single line, like this:
+
+; commodity EXAMPLEAMOUNT
+
+; display AAAA amounts with the symbol on the right, space-separated,
+; using period as decimal point, with four decimal places, and
+; 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
+places.):
+
+; commodity SYMBOL
+;   format EXAMPLEAMOUNT
+
+; display indian rupees with currency name on the left,
+; thousands, lakhs and crores comma-separated,
+; period as decimal point, and two decimal places.
+commodity INR
+  format INR 1,00,00,000.00
+
+   The quantity of the amount does not matter; only the format is
+significant.  The number must include a decimal mark: either a period or
+a comma, followed by 0 or more decimal digits.
+
+
+File: hledger_journal.info,  Node: Default commodity,  Next: Market prices,  Prev: Declaring commodities,  Up: Directives
+
+1.12.5 Default commodity
+------------------------
+
+The 'D' directive sets a default commodity, to be used for amounts
+without a commodity symbol (ie, plain numbers).  This commodity will be
+applied to all subsequent commodity-less amounts, or until the next 'D'
+directive.  (Note, this is different from Ledger's 'D'.)
+
+   For compatibility/historical reasons, 'D' also acts like a
+'commodity' directive, 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 used, 'commodity''s style takes precedence.
+
+   The syntax is 'D AMOUNT'.  Eg:
+
+; commodity-less amounts should be treated as dollars
+; (and displayed with the dollar sign on the left, thousands separators and two decimal places)
+D $1,000.00
+
+1/1
+  a     5  ; <- commodity-less amount, parsed as $5 and displayed as $5.00
+  b
+
+
+File: hledger_journal.info,  Node: Market prices,  Next: Declaring accounts,  Prev: Default commodity,  Up: Directives
+
+1.12.6 Market prices
+--------------------
+
+The 'P' directive declares a market price, which is an exchange rate
+between 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:
+
+P DATE COMMODITYA COMMODITYBAMOUNT
+
+   * DATE is a simple date
+   * COMMODITYA is the symbol of the commodity being priced
+   * COMMODITYBAMOUNT is an amount (symbol and quantity) in a second
+     commodity, 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
+dollars during 2009, and $1.40 from 2010 onward:
+
+P 2009/1/1 € $1.35
+P 2010/1/1 € $1.40
+
+   The '-V/--value' flag can be used to convert reported amounts to
+another commodity using these prices.
+
+
+File: hledger_journal.info,  Node: Declaring accounts,  Next: Rewriting accounts,  Prev: Market prices,  Up: Directives
+
+1.12.7 Declaring accounts
+-------------------------
+
+'account' directives can be used to pre-declare accounts.  Though not
+required, they can provide several benefits:
+
+   * They can document your intended chart of accounts, providing a
+     reference.
+   * They can store extra information about accounts (account numbers,
+     notes, etc.)
+   * They can help hledger know your accounts' types (asset, liability,
+     equity, revenue, expense), useful for reports like balancesheet and
+     incomestatement.
+   * They control account display order in reports, allowing
+     non-alphabetic sorting (eg Revenues to appear above Expenses).
+   * 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 account name, eg:
+
+account assets:bank:checking
+
+* Menu:
+
+* Account comments::
+* Account subdirectives::
+* Account types::
+* Account display order::
+
+
+File: hledger_journal.info,  Node: Account comments,  Next: Account subdirectives,  Up: Declaring accounts
+
+1.12.7.1 Account comments
+.........................
+
+Comments, beginning with a semicolon, can be added:
+
+   * on the same line, *after two or more spaces* (because ; is allowed
+     in account names)
+   * on the next lines, indented
+
+   An example of both:
+
+account assets:bank:checking  ; same-line comment, note 2+ spaces before ;
+  ; next-line comment
+  ; another with tag, acctno:12345 (not used yet)
+
+   Same-line comments are not supported by Ledger, or hledger <1.13.
+
+
+File: hledger_journal.info,  Node: Account subdirectives,  Next: Account types,  Prev: Account comments,  Up: Declaring accounts
+
+1.12.7.2 Account subdirectives
+..............................
+
+We also allow (and ignore) Ledger-style indented subdirectives, just for
+compatibility.:
+
+account assets:bank:checking
+  format blah blah  ; <- subdirective, ignored
+
+   Here is the full syntax of account directives:
+
+account ACCTNAME  [ACCTTYPE] [;COMMENT]
+  [;COMMENTS]
+  [LEDGER-STYLE SUBDIRECTIVES, IGNORED]
+
+
+File: hledger_journal.info,  Node: Account types,  Next: Account display order,  Prev: Account subdirectives,  Up: Declaring accounts
+
+1.12.7.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):
+
+account assets       ; type:Asset
+account liabilities  ; type:Liability
+account equity       ; type:Equity
+account revenues     ; type:Revenue
+account expenses     ; type: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:
+
+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
+
+1.12.7.4 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
+sidebar.  By default accounts are listed in alphabetical order.  But if
+you have these account directives in the journal:
+
+account assets
+account liabilities
+account equity
+account revenues
+account expenses
+
+   you'll see those accounts displayed in declaration order, not
+alphabetically:
+
+$ hledger accounts -1
+assets
+liabilities
+equity
+revenues
+expenses
+
+   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,
+this directive:
+
+account other:zoo
+
+   would influence the position of 'zoo' among 'other''s subaccounts,
+but not the position of 'other' among the top-level accounts.  This
+means:
+
+   * you will sometimes declare parent accounts (eg 'account other'
+     above) that you don't intend to post to, just to customize their
+     display order
+   * sibling accounts stay together (you couldn't display 'x:y' in
+     between 'a:b' and 'a:c').
+
+
+File: hledger_journal.info,  Node: Rewriting accounts,  Next: Default parent account,  Prev: Declaring accounts,  Up: Directives
+
+1.12.8 Rewriting accounts
+-------------------------
+
+You can define account alias rules which rewrite your account names, or
+parts of them, before generating reports.  This can be useful for:
+
+   * expanding shorthand account names to their full form, allowing
+     easier data entry and a less verbose journal
+   * adapting old journals to your current chart of accounts
+   * experimenting with new account organisations, like a new hierarchy
+     or combining two accounts into one
+   * customising reports
+
+   Account aliases also rewrite account names in account directives.
+They do not affect account names being entered via hledger add or
+hledger-web.
+
+   See also Rewrite account names.
+
+* Menu:
+
+* Basic aliases::
+* Regex aliases::
+* Combining aliases::
+* end aliases::
+
+
+File: hledger_journal.info,  Node: Basic aliases,  Next: Regex aliases,  Up: Rewriting accounts
+
+1.12.8.1 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
+included files.  The spaces around the = are optional:
+
+alias OLD = NEW
+
+   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
+replace any occurrence of the old account name with the new one.
+Subaccounts 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"
+
+
+File: hledger_journal.info,  Node: Regex aliases,  Next: Combining aliases,  Prev: Basic aliases,  Up: Rewriting accounts
+
+1.12.8.2 Regex aliases
+......................
+
+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
+REPLACEMENT. If REGEX contains parenthesised match groups, these can be
+referenced by the usual numeric backreferences in REPLACEMENT. Eg:
+
+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
+whitespace.
+
+
+File: hledger_journal.info,  Node: Combining aliases,  Next: end aliases,  Prev: Regex aliases,  Up: Rewriting accounts
+
+1.12.8.3 Combining aliases
+..........................
+
+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
+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
+entry, we apply:
+
+  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
+     (left to right).
+
+   In other words, for (an account name in) a given journal entry:
+
+   * the nearest alias declaration before/above the entry is applied
+     first
+   * the next alias before/above that will be be applied next, and so on
+   * aliases defined after/below the entry do not affect it.
+
+   This gives nearby aliases precedence over distant ones, and helps
+provide semantic stability - aliases will keep working the same way
+independent of which files are being read and in which order.
+
+   In case of trouble, adding '--debug=6' to the command line will show
+which aliases are being applied when.
+
+
+File: hledger_journal.info,  Node: end aliases,  Prev: Combining aliases,  Up: Rewriting accounts
+
+1.12.8.4 'end aliases'
+......................
+
+You can clear (forget) all currently defined aliases with the 'end
+aliases' directive:
+
+end aliases
+
+
+File: hledger_journal.info,  Node: Default parent account,  Prev: Rewriting accounts,  Up: Directives
+
+1.12.9 Default parent account
+-----------------------------
+
+You can specify a parent account which will be prepended to all accounts
+within a section of the journal.  Use the 'apply account' and 'end apply
+account' directives like so:
+
+apply account home
+
+2010/1/1
+    food    $10
+    cash
+
+end apply account
+
+   which is equivalent to:
+
+2010/01/01
+    home:food           $10
+    home:cash          $-10
+
+   If 'end apply account' is omitted, the effect lasts to the end of the
+file.  Included files are also affected, eg:
+
+apply account business
+include biz.journal
+end apply account
+apply account personal
+include personal.journal
+
+   Prior to hledger 1.0, legacy 'account' and 'end' spellings were also
+supported.
+
+   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.
+
+
+File: hledger_journal.info,  Node: Periodic transactions,  Next: Auto postings / transaction modifiers,  Prev: Directives,  Up: Transactions
+
+1.13 Periodic transactions
+==========================
+
+Periodic transaction rules describe transactions that recur.  They allow
+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,
+read this whole section - or at least these tips:
+
+  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
+     tag:generated'.
+  3. Forecasted transactions will begin only after the last
+     non-forecasted transaction's date.
+  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
+     improvement, 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 error.
+  7. Other period expressions with an interval are automatically
+     expanded 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 2020/01/01', will be adjusted to start on
+     2019/12/10.
+
+* Menu:
+
+* Periodic rule syntax::
+* Two spaces between period expression and description!::
+* Forecasting with periodic transactions::
+* Budgeting with periodic transactions::
+
+
+File: hledger_journal.info,  Node: Periodic rule syntax,  Next: Two spaces between period expression and description!,  Up: Periodic transactions
+
+1.13.1 Periodic rule syntax
+---------------------------
+
+A periodic transaction rule looks like a normal journal entry, with the
+date replaced by a tilde ('~') followed by a period expression
+(mnemonic: '~' looks like a recurring sine wave.):
+
+~ monthly
+    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
+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 they
+will be relative to Y/1/1.
+
+
+File: hledger_journal.info,  Node: Two spaces between period expression and description!,  Next: Forecasting with periodic transactions,  Prev: Periodic rule syntax,  Up: Periodic transactions
+
+1.13.2 Two spaces between period expression and 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
+accidentally alter their meaning, as in this example:
+
+; 2 or more spaces needed here, so the period is not understood as "every 2 months in 2020"
+;               ||
+;               vv
+~ every 2 months  in 2020, we will review
+    assets:bank:checking   $1500
+    income:acme inc
+
+   So,
+
+   * Do write two spaces between your period expression and your
+     transaction description, if any.
+   * Don't accidentally write two spaces in the middle of your period
+     expression.
+
+
+File: hledger_journal.info,  Node: Forecasting with periodic transactions,  Next: Budgeting with periodic transactions,  Prev: Two spaces between period expression and description!,  Up: Periodic transactions
+
+1.13.3 Forecasting with periodic transactions
+---------------------------------------------
+
+With the '--forecast' flag, each periodic transaction rule generates
+future transactions recurring at the specified interval.  These are not
+saved in the journal, but appear in all reports.  They will look like
+normal transactions, but with an extra tag:
+
+   * 'generated-transaction:~ PERIODICEXPR' - shows that this was
+     generated by a periodic transaction rule, and the period
+
+   There is also a hidden tag, with an underscore prefix, which does not
+appear in hledger's output:
+
+   * '_generated-transaction:~ PERIODICEXPR'
+
+   This can be used to match transactions generated "just now", rather
+than generated in the past and saved to the journal.
+
+   Forecast transactions start on the first occurrence, and end on the
+last occurrence, of their interval within the forecast period.  The
+forecast period:
+
+   * begins on the later of
+        * the report start date if specified with -b/-p/date:
+        * the day after the latest normal (non-periodic) transaction in
+          the journal, or today if there are no normal transactions.
+
+   * ends on the report end date if specified with -e/-p/date:, or 180
+     days from today.
+
+   where "today" means the current date at report time.  The "later of"
+rule ensures that forecast transactions do not overlap normal
+transactions in time; they will begin only after normal transactions
+end.
+
+   Forecasting can be useful for estimating balances into the future,
+and experimenting with different scenarios.  Note the start date logic
+means that forecasted transactions are automatically replaced by normal
+transactions as you add those.
+
+   Forecasting can also help with data entry: describe most of your
+transactions with periodic rules, and every so often copy the output of
+'print --forecast' to the journal.
+
+   You can generate one-time transactions too: just write a period
+expression specifying a date with no report interval.  (You could also
+write a normal transaction with a future date, but remember this
+disables forecast transactions on previous dates.)
+
+
+File: hledger_journal.info,  Node: Budgeting with periodic transactions,  Prev: Forecasting with periodic transactions,  Up: Periodic transactions
+
+1.13.4 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
+compared in budget reports.
+
+   For more details, see: balance: Budget report and Budgeting and
+Forecasting.
+
+
+File: hledger_journal.info,  Node: Auto postings / transaction modifiers,  Prev: Periodic transactions,  Up: Transactions
+
+1.14 Auto postings / transaction modifiers
+==========================================
+
+Transaction modifier rules, AKA auto posting rules, describe changes to
+be applied automatically to certain matched transactions.  Currently
+just one kind of change is possible - adding extra postings, which we
+call "automated postings" or just "auto postings".  These rules become
+active when you use the '--auto' flag.
+
+   A transaction modifier rule looks much like a normal transaction
+except the first line is an equals sign followed by a query that matches
+certain postings (mnemonic: '=' suggests matching).  And each "posting"
+is actually a posting-generating rule:
+
+= QUERY
+    ACCOUNT  AMOUNT
+    ACCOUNT  [AMOUNT]
+    ...
+
+   These posting-generating rules look like normal postings, except the
+amount can be:
+
+   * a normal amount with a commodity symbol, eg '$2'.  This will be
+     used as-is.
+   * a number, eg '2'.  The commodity symbol (if any) from the matched
+     posting will be added to this.
+   * 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.
+   * 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.
+
+   A 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'
+    (budget:funds:dining out)                 *-1
+
+   These rules have global effect - a rule appearing anywhere in your
+data can potentially affect any transaction, including transactions
+recorded above it or in another file.
+
+   Some examples:
+
+; every time I buy food, schedule a dollar donation
+= expenses:food
+    (liabilities:charity)   $-1
+
+; when I buy a gift, also deduct that amount from a budget envelope subaccount
+= expenses:gifts
+    assets:checking:gifts  *-1
+    assets:checking         *1
+
+2017/12/1
+  expenses:food    $10
+  assets:checking
+
+2017/12/14
+  expenses:gifts   $20
+  assets:checking
+
+$ hledger print --auto
+2017-12-01
+    expenses:food              $10
+    assets:checking
+    (liabilities:charity)      $-1
+
+2017-12-14
+    expenses:gifts             $20
+    assets:checking
+    assets:checking:gifts     -$20
+    assets:checking            $20
+
+* Menu:
+
+* Auto postings and dates::
+* Auto postings and transaction balancing / inferred amounts / balance assertions::
+* Auto posting tags::
+
+
+File: hledger_journal.info,  Node: Auto postings and dates,  Next: Auto postings and transaction balancing / inferred amounts / balance assertions,  Up: Auto postings / transaction modifiers
+
+1.14.1 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 be
+used in the generated posting.
+
+
+File: hledger_journal.info,  Node: Auto postings and transaction balancing / inferred amounts / balance assertions,  Next: Auto posting tags,  Prev: Auto postings and dates,  Up: Auto postings / transaction modifiers
+
+1.14.2 Auto postings and transaction balancing / inferred amounts /
+-------------------------------------------------------------------
+
+balance assertions Currently, transaction modifiers are applied / auto
+postings are added:
+
+   * after missing amounts are inferred, and transactions are checked
+     for balancedness,
+   * but before balance assertions are checked.
+
+   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.
+
+
+File: hledger_journal.info,  Node: Auto posting tags,  Prev: Auto postings and transaction balancing / inferred amounts / balance assertions,  Up: Auto postings / transaction modifiers
+
+1.14.3 Auto posting tags
+------------------------
+
+Postings added by transaction modifiers will have some extra tags:
+
+   * 'generated-posting:= QUERY' - shows this was generated by an auto
+     posting rule, and the query
+   * '_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 transaction modifier
+rules will have these tags added:
+
+   * 'modified:' - this transaction was modified
+   * '_modified:' - a hidden tag not appearing in the comment; this
+     transaction was modified "just now".
+
+
+Tag Table:
+Node: Top76
+Node: Transactions1869
+Ref: #transactions1961
+Node: Dates3150
+Ref: #dates3249
+Node: Simple dates3314
+Ref: #simple-dates3440
+Node: Secondary dates3949
+Ref: #secondary-dates4103
+Node: Posting dates5439
+Ref: #posting-dates5568
+Node: Status6940
+Ref: #status7061
+Node: Description8769
+Ref: #description8903
+Node: Payee and note9223
+Ref: #payee-and-note9337
+Node: Comments9672
+Ref: #comments9798
+Node: Tags10992
+Ref: #tags11107
+Node: Postings12500
+Ref: #postings12628
+Node: Virtual Postings13654
+Ref: #virtual-postings13771
+Node: Account names15076
+Ref: #account-names15217
+Node: Amounts15704
+Ref: #amounts15843
+Node: Digit group marks16775
+Ref: #digit-group-marks16923
+Node: Amount display style17861
+Ref: #amount-display-style18015
+Node: Transaction prices19176
+Ref: #transaction-prices19342
+Node: Balance Assertions21608
+Ref: #balance-assertions21788
+Node: Assertions and ordering22821
+Ref: #assertions-and-ordering23009
+Node: Assertions and included files23709
+Ref: #assertions-and-included-files23952
+Node: Assertions and multiple -f options24285
+Ref: #assertions-and-multiple--f-options24541
+Node: Assertions and commodities24673
+Ref: #assertions-and-commodities24905
+Node: Assertions and prices26062
+Ref: #assertions-and-prices26276
+Node: Assertions and subaccounts26716
+Ref: #assertions-and-subaccounts26945
+Node: Assertions and virtual postings27269
+Ref: #assertions-and-virtual-postings27511
+Node: Assertions and precision27653
+Ref: #assertions-and-precision27846
+Node: Balance Assignments28113
+Ref: #balance-assignments28287
+Node: Balance assignments and prices29451
+Ref: #balance-assignments-and-prices29623
+Node: Directives29847
+Ref: #directives30006
+Node: Comment blocks35654
+Ref: #comment-blocks35799
+Node: Including other files35975
+Ref: #including-other-files36155
+Node: Default year36563
+Ref: #default-year36732
+Node: Declaring commodities37139
+Ref: #declaring-commodities37322
+Node: Default commodity38995
+Ref: #default-commodity39171
+Node: Market prices40060
+Ref: #market-prices40225
+Node: Declaring accounts41066
+Ref: #declaring-accounts41242
+Node: Account comments42167
+Ref: #account-comments42330
+Node: Account subdirectives42754
+Ref: #account-subdirectives42949
+Node: Account types43262
+Ref: #account-types43446
+Node: Account display order45085
+Ref: #account-display-order45255
+Node: Rewriting accounts46406
+Ref: #rewriting-accounts46591
+Node: Basic aliases47317
+Ref: #basic-aliases47463
+Node: Regex aliases48167
+Ref: #regex-aliases48339
+Node: Combining aliases49057
+Ref: #combining-aliases49235
+Node: end aliases50511
+Ref: #end-aliases50659
+Node: Default parent account50760
+Ref: #default-parent-account50926
+Node: Periodic transactions51810
+Ref: #periodic-transactions52009
+Node: Periodic rule syntax53881
+Ref: #periodic-rule-syntax54087
+Node: Two spaces between period expression and description!54791
+Ref: #two-spaces-between-period-expression-and-description55110
+Node: Forecasting with periodic transactions55794
+Ref: #forecasting-with-periodic-transactions56099
+Node: Budgeting with periodic transactions58125
+Ref: #budgeting-with-periodic-transactions58364
+Node: Auto postings / transaction modifiers58813
+Ref: #auto-postings-transaction-modifiers59025
+Node: Auto postings and dates61521
+Ref: #auto-postings-and-dates61778
+Node: Auto postings and transaction balancing / inferred amounts / balance assertions61953
+Ref: #auto-postings-and-transaction-balancing-inferred-amounts-balance-assertions62328
+Node: Auto posting tags62706
+Ref: #auto-posting-tags62945
 
 End Tag Table
 
diff --git a/embeddedfiles/hledger_journal.txt b/embeddedfiles/hledger_journal.txt
--- a/embeddedfiles/hledger_journal.txt
+++ b/embeddedfiles/hledger_journal.txt
@@ -22,135 +22,98 @@
        ting.
 
        You can use hledger without learning any more about this file; just use
-       the add or web commands to create and update it.  Many  users,  though,
-       also  edit  the  journal  file directly with a text editor, perhaps as-
-       sisted by the helper modes for emacs or vim.
-
-       Here's an example:
-
-              ; A sample journal file. This is a comment.
-
-              2008/01/01 income             ; <- transaction's first line starts in column 0, contains date and description
-                  assets:bank:checking  $1  ; <- posting lines start with whitespace, each contains an account name
-                  income:salary        $-1  ;    followed by at least two spaces and an amount
-
-              2008/06/01 gift
-                  assets:bank:checking  $1  ; <- at least two postings in a transaction
-                  income:gifts         $-1  ; <- their amounts must balance to 0
-
-              2008/06/02 save
-                  assets:bank:saving    $1
-                  assets:bank:checking      ; <- one amount may be omitted; here $-1 is inferred
-
-              2008/06/03 eat & shop         ; <- description can be anything
-                  expenses:food         $1
-                  expenses:supplies     $1  ; <- this transaction debits two expense accounts
-                  assets:cash               ; <- $-2 inferred
-
-              2008/10/01 take a loan
-                  assets:bank:checking  $1
-                  liabilities:debts    $-1
+       the add or web or import commands to create and update it.
 
-              2008/12/31 * pay off          ; <- an optional * or ! after the date means "cleared" (or anything you want)
-                  liabilities:debts     $1
-                  assets:bank:checking
+       Many users, though, edit the journal file with a text editor, and track
+       changes  with a version control system such as git.  Editor addons such
+       as ledger-mode or hledger-mode  for  Emacs,  vim-ledger  for  Vim,  and
+       hledger-vscode for Visual Studio Code, make this easier, adding colour,
+       formatting, tab completion, and useful commands.  See Editor configura-
+       tion at hledger.org for the full list.
 
 FILE FORMAT
-   Transactions
-       Transactions are movements of  some  quantity  of  commodities  between
-       named accounts.  Each transaction is represented by a journal entry be-
-       ginning with a simple date in column 0.  This can be followed by any of
-       the following, separated by spaces:
-
-       o (optional) a status character (empty, !, or *)
-
-       o (optional)  a transaction code (any short number or text, enclosed in
-         parentheses)
-
-       o (optional) a transaction description (any remaining text until end of
-         line or a semicolon)
+       Here's  a  description  of  each part of the file format (and hledger's
+       data model).  These are mostly in the order you'll  use  them,  but  in
+       some  cases related concepts have been grouped together for easy refer-
+       ence, or linked before they are introduced, so feel free to  skip  over
+       anything that looks unnecessary right now.
 
-       o (optional)  a  transaction  comment  (any  remaining text following a
-         semicolon until end of line)
+   Transactions
+       Transactions  are the main unit of information in a journal file.  They
+       represent events, typically a movement of some quantity of  commodities
+       between two or more named accounts.
 
-       Then comes zero or more (but usually at least 2) indented lines  repre-
-       senting...
+       Each  transaction is recorded as a journal entry, beginning with a sim-
+       ple date in column 0.  This can be followed by any of the following op-
+       tional fields, separated by spaces:
 
-   Postings
-       A  posting  is an addition of some amount to, or removal of some amount
-       from, an account.  Each posting line begins with at least one space  or
-       tab (2 or 4 spaces is common), followed by:
+       o a status character (empty, !, or *)
 
-       o (optional) a status character (empty, !, or *), followed by a space
+       o a code (any short number or text, enclosed in parentheses)
 
-       o (required)  an  account  name (any text, optionally containing single
-         spaces, until end of line or a double space)
+       o a description (any remaining text until end of line or a semicolon)
 
-       o (optional) two or more spaces or tabs followed by an amount.
+       o a  comment  (any  remaining  text  following a semicolon until end of
+         line, and any following indented lines beginning with a semicolon)
 
-       Positive amounts are being added to the account, negative  amounts  are
-       being removed.
+       o 0 or more indented posting lines, describing what was transferred and
+         the accounts involved.
 
-       The amounts within a transaction must always sum up to zero.  As a con-
-       venience, one amount may be left blank; it will be inferred  so  as  to
-       balance the transaction.
+       Here's a simple journal file containing one transaction:
 
-       Be  sure  to  note the unusual two-space delimiter between account name
-       and amount.  This makes it easy to write account names containing  spa-
-       ces.   But if you accidentally leave only one space (or tab) before the
-       amount, the amount will be considered part of the account name.
+              2008/01/01 income
+                assets:bank:checking   $1
+                income:salary         $-1
 
    Dates
    Simple dates
-       Within a journal file, transaction dates use Y/M/D (or Y-M-D or  Y.M.D)
-       Leading  zeros are optional.  The year may be omitted, in which case it
-       will be inferred from the context - the current  transaction,  the  de-
-       fault  year set with a default year directive, or the current date when
-       the command is  run.   Some  examples:  2010/01/31,  1/31,  2010-01-31,
-       2010.1.31.
+       Dates  in  the  journal  file  use  simple  dates format: YYYY-MM-DD or
+       YYYY/MM/DD or YYYY.MM.DD, with leading zeros optional.  The year may be
+       omitted,  in  which case it will be inferred from the context: the cur-
+       rent transaction, the default year set with a default  year  directive,
+       or   the  current  date  when  the  command  is  run.   Some  examples:
+       2010-01-31, 2010/01/31, 2010.1.31, 1/31.
 
+       (The UI also accepts simple dates, as well as the more  flexible  smart
+       dates documented in the hledger manual.)
+
    Secondary dates
        Real-life  transactions  sometimes  involve more than one date - eg the
        date you write a cheque, and the date it clears in your bank.  When you
-       want  to model this, eg for more accurate balances, you can specify in-
-       dividual posting dates, which I recommend.  Or, you can  use  the  sec-
-       ondary  dates  (aka  auxiliary/effective  dates) feature, supported for
-       compatibility with Ledger.
+       want  to  model this, for more accurate daily balances, you can specify
+       individual posting dates.
 
-       A secondary date can be written after the primary date, separated by an
-       equals  sign.   The  primary date, on the left, is used by default; the
-       secondary date, on the right, is used when the --date2 flag  is  speci-
-       fied (--aux-date or --effective also work).
+       Or, you can use the older secondary date feature (Ledger calls it  aux-
+       iliary  date or effective date).  Note: we support this for compatibil-
+       ity, but I usually recommend avoiding this feature; posting  dates  are
+       almost always clearer and simpler.
 
-       The  meaning of secondary dates is up to you, but it's best to follow a
-       consistent rule.  Eg write the bank's clearing  date  as  primary,  and
-       when needed, the date the transaction was initiated as secondary.
+       A secondary date is written after the primary date, following an equals
+       sign.  If the year is omitted, the  primary  date's  year  is  assumed.
+       When  running  reports, the primary (left) date is used by default, but
+       with the --date2 flag (or --aux-date  or  --effective),  the  secondary
+       (right) date will be used instead.
 
-       Here's an example.  Note that a secondary date will use the year of the
-       primary date if unspecified.
+       The  meaning of secondary dates is up to you, but it's best to follow a
+       consistent rule.  Eg "primary = the bank's clearing date,  secondary  =
+       date the transaction was initiated, if different", as shown here:
 
               2010/2/23=2/19 movie ticket
                 expenses:cinema                   $10
                 assets:checking
 
               $ hledger register checking
-              2010/02/23 movie ticket         assets:checking                $-10         $-10
+              2010-02-23 movie ticket         assets:checking                $-10         $-10
 
               $ hledger register checking --date2
-              2010/02/19 movie ticket         assets:checking                $-10         $-10
-
-       Secondary dates require some effort; you must use them consistently  in
-       your journal entries and remember whether to use or not use the --date2
-       flag for your reports.  They are included in hledger for Ledger compat-
-       ibility,  but  posting dates are a more powerful and less confusing al-
-       ternative.
+              2010-02-19 movie ticket         assets:checking                $-10         $-10
 
    Posting dates
-       You can give individual postings a different  date  from  their  parent
-       transaction,  by  adding a posting comment containing a tag (see below)
+       You  can  give  individual  postings a different date from their parent
+       transaction, by adding a posting comment containing a tag  (see  below)
        like date:DATE.  This is probably the best way to control posting dates
-       precisely.   Eg  in  this  example the expense should appear in May re-
-       ports, and the deduction from checking should be reported  on  6/1  for
+       precisely.  Eg in this example the expense should  appear  in  May  re-
+       ports,  and  the  deduction from checking should be reported on 6/1 for
        easy bank reconciliation:
 
               2015/5/30
@@ -158,27 +121,27 @@
                   assets:checking        ; bank cleared it on monday, date:6/1
 
               $ hledger -f t.j register food
-              2015/05/30                      expenses:food                  $10           $10
+              2015-05-30                      expenses:food                  $10           $10
 
               $ hledger -f t.j register checking
-              2015/06/01                      assets:checking               $-10          $-10
+              2015-06-01                      assets:checking               $-10          $-10
 
-       DATE  should be a simple date; if the year is not specified it will use
-       the year of the transaction's date.  You can  set  the  secondary  date
-       similarly,  with  date2:DATE2.   The  date:  or date2: tags must have a
-       valid simple date value if they are present, eg a  date:  tag  with  no
+       DATE should be a simple date; if the year is not specified it will  use
+       the  year  of  the  transaction's date.  You can set the secondary date
+       similarly, with date2:DATE2.  The date: or  date2:  tags  must  have  a
+       valid  simple  date  value  if they are present, eg a date: tag with no
        value is not allowed.
 
        Ledger's earlier, more compact bracketed date syntax is also supported:
-       [DATE], [DATE=DATE2] or [=DATE2].  hledger will attempt  to  parse  any
+       [DATE],  [DATE=DATE2]  or  [=DATE2].  hledger will attempt to parse any
        square-bracketed sequence of the 0123456789/-.= characters in this way.
-       With this syntax, DATE infers its year from the transaction  and  DATE2
+       With  this  syntax, DATE infers its year from the transaction and DATE2
        infers its year from DATE.
 
    Status
-       Transactions,  or  individual postings within a transaction, can have a
-       status mark, which is a single character  before  the  transaction  de-
-       scription  or posting account name, separated from it by a space, indi-
+       Transactions, or individual postings within a transaction, can  have  a
+       status  mark,  which  is  a single character before the transaction de-
+       scription or posting account name, separated from it by a space,  indi-
        cating one of three statuses:
 
        mark     status
@@ -187,23 +150,23 @@
        !        pending
        *        cleared
 
-       When reporting, you  can  filter  by  status  with  the  -U/--unmarked,
-       -P/--pending,  and  -C/--cleared  flags;  or the status:, status:!, and
+       When  reporting,  you  can  filter  by  status  with the -U/--unmarked,
+       -P/--pending, and -C/--cleared flags; or  the  status:,  status:!,  and
        status:* queries; or the U, P, C keys in hledger-ui.
 
-       Note, in Ledger and in older versions of hledger, the "unmarked"  state
-       is  called  "uncleared".   As  of hledger 1.3 we have renamed it to un-
+       Note,  in Ledger and in older versions of hledger, the "unmarked" state
+       is called "uncleared".  As of hledger 1.3 we have  renamed  it  to  un-
        marked for clarity.
 
-       To replicate Ledger and old hledger's behaviour of also matching  pend-
+       To  replicate Ledger and old hledger's behaviour of also matching pend-
        ing, combine -U and -P.
 
-       Status  marks  are optional, but can be helpful eg for reconciling with
+       Status marks are optional, but can be helpful eg for  reconciling  with
        real-world accounts.  Some editor modes provide highlighting and short-
-       cuts  for working with status.  Eg in Emacs ledger-mode, you can toggle
+       cuts for working with status.  Eg in Emacs ledger-mode, you can  toggle
        transaction status with C-c C-e, or posting status with C-c C-c.
 
-       What "uncleared", "pending", and "cleared" actually mean is up to  you.
+       What  "uncleared", "pending", and "cleared" actually mean is up to you.
        Here's one suggestion:
 
        status       meaning
@@ -214,25 +177,154 @@
        cleared      complete, reconciled as far as possible, and considered cor-
                     rect
 
-       With  this scheme, you would use -PC to see the current balance at your
+       With this scheme, you would use -PC to see the current balance at  your
        bank, -U to see things which will probably hit your bank soon (like un-
-       cashed  checks),  and no flags to see the most up-to-date state of your
+       cashed checks), and no flags to see the most up-to-date state  of  your
        finances.
 
    Description
-       A transaction's description is the rest of the line following the  date
-       and  status  mark  (or  until  a comment begins).  Sometimes called the
+       A  transaction's description is the rest of the line following the date
+       and status mark (or until a  comment  begins).   Sometimes  called  the
        "narration" in traditional bookkeeping, it can be used for whatever you
-       wish,  or  left blank.  Transaction descriptions can be queried, unlike
+       wish, or left blank.  Transaction descriptions can be  queried,  unlike
        comments.
 
    Payee and note
        You can optionally include a | (pipe) character in descriptions to sub-
        divide the description into separate fields for payee/payer name on the
        left (up to the first |) and an additional note field on the right (af-
-       ter  the  first |).  This may be worthwhile if you need to do more pre-
+       ter the first |).  This may be worthwhile if you need to do  more  pre-
        cise querying and pivoting by payee or by note.
 
+   Comments
+       Lines in the journal beginning with a semicolon (;) or hash (#) or star
+       (*) are comments, and will be ignored.  (Star comments  cause  org-mode
+       nodes  to  be  ignored, allowing emacs users to fold and navigate their
+       journals with org-mode or orgstruct-mode.)
+
+       You can attach comments to a transaction by writing them after the  de-
+       scription and/or indented on the following lines (before the postings).
+       Similarly, you can attach comments to an individual posting by  writing
+       them after the amount and/or indented on the following lines.  Transac-
+       tion and posting comments must begin with a semicolon (;).
+
+       Some examples:
+
+              # a file comment
+              ; another file comment
+              * also a file comment, useful in org/orgstruct mode
+
+              comment
+              A multiline file comment, which continues
+              until a line containing just "end comment"
+              (or end of file).
+              end comment
+
+              2012/5/14 something  ; a transaction comment
+                  ; the transaction comment, continued
+                  posting1  1  ; a comment for posting 1
+                  posting2
+                  ; a comment for posting 2
+                  ; another comment line for posting 2
+              ; a file comment (because not indented)
+
+       You can also comment larger regions of a file  using  comment  and  end
+       comment directives.
+
+   Tags
+       Tags  are  a  way  to add extra labels or labelled data to postings and
+       transactions, which you can then search or pivot on.
+
+       A simple tag is a word (which may contain hyphens) followed by  a  full
+       colon, written inside a transaction or posting comment line:
+
+              2017/1/16 bought groceries  ; sometag:
+
+       Tags  can  have  a  value, which is the text after the colon, up to the
+       next comma or end of line, with leading/trailing whitespace removed:
+
+                  expenses:food    $10 ; a-posting-tag: the tag value
+
+       Note this means hledger's tag values can not  contain  commas  or  new-
+       lines.  Ending at commas means you can write multiple short tags on one
+       line, comma separated:
+
+                  assets:checking  ; a comment containing tag1:, tag2: some value ...
+
+       Here,
+
+       o "a comment containing" is just comment text, not a tag
+
+       o "tag1" is a tag with no value
+
+       o "tag2" is another tag, whose value is "some value ..."
+
+       Tags in a transaction comment affect the transaction  and  all  of  its
+       postings,  while  tags  in  a posting comment affect only that posting.
+       For example, the following transaction has three tags (A, TAG2,  third-
+       tag) and the posting has four (those plus posting-tag):
+
+              1/1 a transaction  ; A:, TAG2:
+                  ; third-tag: a third transaction tag, <- with a value
+                  (a)  $1  ; posting-tag:
+
+       Tags  are  like  Ledger's metadata feature, except hledger's tag values
+       are simple strings.
+
+   Postings
+       A posting is an addition of some amount to, or removal of  some  amount
+       from,  an account.  Each posting line begins with at least one space or
+       tab (2 or 4 spaces is common), followed by:
+
+       o (optional) a status character (empty, !, or *), followed by a space
+
+       o (required) an account name (any text,  optionally  containing  single
+         spaces, until end of line or a double space)
+
+       o (optional) two or more spaces or tabs followed by an amount.
+
+       Positive  amounts  are being added to the account, negative amounts are
+       being removed.
+
+       The amounts within a transaction must always sum up to zero.  As a con-
+       venience,  one  amount  may be left blank; it will be inferred so as to
+       balance the transaction.
+
+       Be sure to note the unusual two-space delimiter  between  account  name
+       and  amount.  This makes it easy to write account names containing spa-
+       ces.  But if you accidentally leave only one space (or tab) before  the
+       amount, the amount will be considered part of the account name.
+
+   Virtual Postings
+       A posting with a parenthesised account name is called a virtual posting
+       or unbalanced posting, which means it is exempt  from  the  usual  rule
+       that a transaction's postings must balance add up to zero.
+
+       This  is  not  part  of double entry accounting, so you might choose to
+       avoid this feature.  Or you can use it sparingly  for  certain  special
+       cases  where  it can be convenient.  Eg, you could set opening balances
+       without using a balancing equity account:
+
+              1/1 opening balances
+                (assets:checking)   $1000
+                (assets:savings)    $2000
+
+       A posting with a bracketed account name is called  a  balanced  virtual
+       posting.  The balanced virtual postings in a transaction must add up to
+       zero (separately from other postings).  Eg:
+
+              1/1 buy food with cash, update budget envelope subaccounts, & something else
+                assets:cash                    $-10 ; <- these balance
+                expenses:food                    $7 ; <-
+                expenses:food                    $3 ; <-
+                [assets:checking:budget:food]  $-10    ; <- and these balance
+                [assets:checking:available]     $10    ; <-
+                (something:else)                 $5       ; <- not required to balance
+
+       Ordinary non-parenthesised,  non-bracketed  postings  are  called  real
+       postings.   You  can  exclude  virtual  postings  from reports with the
+       -R/--real flag or real:1 query.
+
    Account names
        Account names typically have several parts separated by a  full  colon,
        from  which hledger derives a hierarchical chart of accounts.  They can
@@ -311,13 +403,13 @@
               commodity INR 9,99,99,999.00
               commodity       1 000 000.9455
 
-   Amount display format
+   Amount display style
        For each commodity, hledger chooses a consistent  format  to  use  when
        displaying  amounts.  (Except price amounts, which are always displayed
-       as written).  The display format is chosen as follows:
+       as written).  The display style is chosen as follows:
 
-       o If there is a commodity directive for the commodity, that  format  is
-         used (see examples above).
+       o If there is a commodity directive (or  default  commodity  directive)
+         for the commodity, that format is used (see examples above).
 
        o Otherwise  the  format  of the first posting amount in that commodity
          seen in the journal is used.  But the number of decimal places ("pre-
@@ -327,48 +419,77 @@
        o Or if there are no such amounts in the journal, a default  format  is
          used (like $1000.00).
 
-       Price amounts, and amounts in D directives don't affect the amount dis-
-       play format directly, but occasionally they can do so indirectly.   (Eg
-       when  D's  default  commodity is applied to a commodity-less amount, or
-       when an amountless posting is balanced using a  price's  commodity,  or
-       when  -V  is  used.) If you find this causing problems, use a commodity
-       directive to set the display format.
+       Transaction  prices don't affect the amount display style directly, but
+       occasionally they can do so indirectly (eg when an posting's amount  is
+       inferred  using  a  transaction price).  If you find this causing prob-
+       lems, use a commodity directive to fix the display style.
 
-   Virtual Postings
-       When you parenthesise the account name in a posting,  we  call  that  a
-       virtual posting, which means:
+       In summary: amounts will be displayed much as they appear in your jour-
+       nal,  with  the  max observed number of decimal places.  If you want to
+       see fewer decimal places in reports, use a commodity directive to over-
+       ride that.
 
-       o it is ignored when checking that the transaction is balanced
+   Transaction prices
+       Within a transaction, you can note an amount's price in another commod-
+       ity.  This can be used to document the cost (in a purchase) or  selling
+       price  (in  a  sale).   For  example,  transaction prices are useful to
+       record purchases of a foreign currency.  Note  transaction  prices  are
+       fixed at the time of the transaction, and do not change over time.  See
+       also market prices, which represent prevailing exchange rates on a cer-
+       tain date.
 
-       o it  is  excluded from reports when the --real/-R flag is used, or the
-         real:1 query.
+       There are several ways to record a transaction price:
 
-       You could use this, eg, to set an  account's  opening  balance  without
-       needing to use the equity:opening balances account:
+       1. Write the price per unit, as @ UNITPRICE after the amount:
 
-              1/1 special unbalanced posting to set initial balance
-                (assets:checking)   $1000
+                  2009/1/1
+                    assets:euros     EUR100 @ $1.35  ; one hundred euros purchased at $1.35 each
+                    assets:dollars                 ; balancing amount is -$135.00
 
-       When the account name is bracketed, we call it a balanced virtual post-
-       ing.  This is like an ordinary virtual posting except the balanced vir-
-       tual  postings  in a transaction must balance to 0, like the real post-
-       ings (but separately from them).  Balanced virtual  postings  are  also
-       excluded by --real/-R or real:1.
+       2. Write the total price, as @@ TOTALPRICE after the amount:
 
-              1/1 buy food with cash, and update some budget-tracking subaccounts elsewhere
-                expenses:food                   $10
-                assets:cash                    $-10
-                [assets:checking:available]     $10
-                [assets:checking:budget:food]  $-10
+                  2009/1/1
+                    assets:euros     EUR100 @@ $135  ; one hundred euros purchased at $135 for the lot
+                    assets:dollars
 
-       Virtual postings have some legitimate uses, but those are few.  You can
-       usually find an equivalent journal entry using real postings, which  is
-       more correct and provides better error checking.
+       3. Specify amounts for all postings, using exactly two commodities, and
+          let hledger infer the price that balances the transaction:
 
+                  2009/1/1
+                    assets:euros     EUR100          ; one hundred euros purchased
+                    assets:dollars  $-135          ; for $135
+
+       (Ledger users: Ledger uses a different syntax for fixed prices, {=UNIT-
+       PRICE}, which hledger currently ignores).
+
+       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:
+
+              $ hledger bal -N --flat
+                             $-135  assets:dollars
+                              EUR100  assets:euros
+              $ hledger bal -N --flat -B
+                             $-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
+       amount.  So if example 3's postings are reversed, while the transaction
+       is equivalent, -B shows something different:
+
+              2009/1/1
+                assets:dollars  $-135              ; 135 dollars sold
+                assets:euros     EUR100              ; for 100 euros
+
+              $ hledger bal -N --flat -B
+                             EUR-100  assets:dollars  # <- the dollars' selling price
+                              EUR100  assets:euros
+
    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
@@ -380,11 +501,12 @@
                 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.
+       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
@@ -414,9 +536,8 @@
    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 work in Ledger also.  We could call this a "par-
-       tial" balance assertion.
+       (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.
@@ -524,142 +645,9 @@
                 (a)             = $1 @ EUR2
 
               $ hledger print --explicit
-              2019/01/01
+              2019-01-01
                   (a)         $1 @ EUR2 = $1 @ EUR2
 
-   Transaction prices
-       Within a transaction, you can note an amount's price in another commod-
-       ity.   This can be used to document the cost (in a purchase) or selling
-       price (in a sale).  For  example,  transaction  prices  are  useful  to
-       record  purchases  of  a foreign currency.  Note transaction prices are
-       fixed at the time of the transaction, and do not change over time.  See
-       also market prices, which represent prevailing exchange rates on a cer-
-       tain date.
-
-       There are several ways to record a transaction price:
-
-       1. Write the price per unit, as @ UNITPRICE after the amount:
-
-                  2009/1/1
-                    assets:euros     EUR100 @ $1.35  ; one hundred euros purchased at $1.35 each
-                    assets:dollars                 ; balancing amount is -$135.00
-
-       2. Write the total price, as @@ TOTALPRICE after the amount:
-
-                  2009/1/1
-                    assets:euros     EUR100 @@ $135  ; one hundred euros purchased at $135 for the lot
-                    assets:dollars
-
-       3. Specify amounts for all postings, using exactly two commodities, and
-          let hledger infer the price that balances the transaction:
-
-                  2009/1/1
-                    assets:euros     EUR100          ; one hundred euros purchased
-                    assets:dollars  $-135          ; for $135
-
-       (Ledger users: Ledger uses a different syntax for fixed prices, {=UNIT-
-       PRICE}, which hledger currently ignores).
-
-       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:
-
-              $ hledger bal -N --flat
-                             $-135  assets:dollars
-                              EUR100  assets:euros
-              $ hledger bal -N --flat -B
-                             $-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
-       amount.  So if example 3's postings are reversed, while the transaction
-       is equivalent, -B shows something different:
-
-              2009/1/1
-                assets:dollars  $-135              ; 135 dollars sold
-                assets:euros     EUR100              ; for 100 euros
-
-              $ hledger bal -N --flat -B
-                             EUR-100  assets:dollars  # <- the dollars' selling price
-                              EUR100  assets:euros
-
-   Comments
-       Lines in the journal beginning with a semicolon (;) or hash (#) or star
-       (*) are comments, and will be ignored.  (Star comments  cause  org-mode
-       nodes  to  be  ignored, allowing emacs users to fold and navigate their
-       journals with org-mode or orgstruct-mode.)
-
-       You can attach comments to a transaction by writing them after the  de-
-       scription and/or indented on the following lines (before the postings).
-       Similarly, you can attach comments to an individual posting by  writing
-       them after the amount and/or indented on the following lines.  Transac-
-       tion and posting comments must begin with a semicolon (;).
-
-       Some examples:
-
-              # a file comment
-
-              ; also a file comment
-
-              comment
-              This is a multiline file comment,
-              which continues until a line
-              where the "end comment" string
-              appears on its own (or end of file).
-              end comment
-
-              2012/5/14 something  ; a transaction comment
-                  ; the transaction comment, continued
-                  posting1  1  ; a comment for posting 1
-                  posting2
-                  ; a comment for posting 2
-                  ; another comment line for posting 2
-              ; a file comment (because not indented)
-
-       You can also comment larger regions of a file  using  comment  and  end
-       comment directives.
-
-   Tags
-       Tags  are  a  way  to add extra labels or labelled data to postings and
-       transactions, which you can then search or pivot on.
-
-       A simple tag is a word (which may contain hyphens) followed by  a  full
-       colon, written inside a transaction or posting comment line:
-
-              2017/1/16 bought groceries  ; sometag:
-
-       Tags  can  have  a  value, which is the text after the colon, up to the
-       next comma or end of line, with leading/trailing whitespace removed:
-
-                  expenses:food    $10 ; a-posting-tag: the tag value
-
-       Note this means hledger's tag values can not  contain  commas  or  new-
-       lines.  Ending at commas means you can write multiple short tags on one
-       line, comma separated:
-
-                  assets:checking  ; a comment containing tag1:, tag2: some value ...
-
-       Here,
-
-       o "a comment containing" is just comment text, not a tag
-
-       o "tag1" is a tag with no value
-
-       o "tag2" is another tag, whose value is "some value ..."
-
-       Tags in a transaction comment affect the transaction  and  all  of  its
-       postings,  while  tags  in  a posting comment affect only that posting.
-       For example, the following transaction has three tags (A, TAG2,  third-
-       tag) and the posting has four (those plus posting-tag):
-
-              1/1 a transaction  ; A:, TAG2:
-                  ; third-tag: a third transaction tag, <- with a value
-                  (a)  $1  ; posting-tag:
-
-       Tags  are  like  Ledger's metadata feature, except hledger's tag values
-       are simple strings.
-
    Directives
        A directive is a line in the journal beginning with a special  keyword,
        that influences how the journal is processed.  hledger's directives are
@@ -699,44 +687,47 @@
                                                                        play style: amounts
                                                                        of  that  commodity
                                                                        in reports
-       D                                declare  a commodity, number   commodity: all com-
-                                        notation & display style for   modityless  entries
-                                        commodityless amounts          in  all files; num-
-                                                                       ber notation:  fol-
-                                                                       lowing   commodity-
-                                                                       less  entries   and
-                                                                       entries   in   that
-                                                                       commodity  in   all
-                                                                       files;      display
-                                                                       style:  amounts  of
-                                                                       that  commodity  in
-                                                                       reports
+       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-
+                                                                       tion: following en-
+                                                                       tries in that  com-
+                                                                       modity until end of
+                                                                       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
 
        And some definitions:
 
-       subdirec-   optional indented directive line immediately following a par-
-       tive        ent directive
-       number      how  to  interpret  numbers when parsing journal entries (the
-       notation    identity of the  decimal  separator  character).   (Currently
-                   each  commodity  can  have its own notation, even in the same
-                   file.)
-       display     how to display amounts of a commodity in reports (symbol side
-       style       and spacing, digit groups, decimal separator, decimal places)
+       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-
+       tion     modity can have its own notation, even in the same file.)
+       dis-     how to display amounts of a commodity in  reports  (symbol  side
+       play     and spacing, digit groups, decimal separator, decimal places)
+       style
 
 
-       directive   which entries and (when there are multiple files) which files
-       scope       are affected by a directive
 
+       direc-   which  entries  and  (when there are multiple files) which files
+       tive     are affected by a directive
+       scope
+
        As you can see, directives vary in which journal entries and files they
        affect, and whether they are focussed on input (parsing) or output (re-
        ports).  Some directives have multiple effects.
@@ -793,15 +784,16 @@
        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 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).
+       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 format 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.
@@ -814,8 +806,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
@@ -828,31 +820,35 @@
                 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.
 
    Default commodity
-       The D directive sets a default commodity (and display  format),  to  be
-       used for amounts without a commodity symbol (ie, plain numbers).  (Note
-       this differs from Ledger's default commodity directive.) The  commodity
-       and  display  format  will  be applied to all subsequent commodity-less
-       amounts, or until the next D directive.
+       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-
+       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
+       used, commodity's style takes precedence.
+
+       The syntax is D AMOUNT.  Eg:
+
               ; commodity-less amounts should be treated as dollars
-              ; (and displayed with symbol on the left, thousands separators and two decimal places)
+              ; (and displayed with the dollar sign on the left, thousands separators and two decimal places)
               D $1,000.00
 
               1/1
-                a     5  ; <- commodity-less amount, becomes $1
+                a     5  ; <- commodity-less amount, parsed as $5 and displayed as $5.00
                 b
 
-       As with the commodity directive, the amount must always be written with
-       a decimal point.
-
    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:
@@ -863,16 +859,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/--value flag can be used to convert reported amounts to  another
+       The  -V/--value flag can be used to convert reported amounts to another
        commodity using these prices.
 
    Declaring accounts
@@ -882,38 +878,42 @@
        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
 
    Account comments
-       Comments, beginning with a semicolon, optionally including tags, can be
-       written after the account name, and/or on following lines.  Eg:
+       Comments, beginning with a semicolon, can be added:
 
-              account assets:bank:checking  ; a comment
-                ; another comment
-                ; acctno:12345, a tag
+       o on the same line, after two or more spaces (because ; is  allowed  in
+         account names)
 
-       Tip: comments on the same line require hledger 1.12+.  If you need your
-       journal to be compatible with older hledger versions, write comments on
-       the next line instead.
+       o on the next lines, indented
 
+       An example of both:
+
+              account assets:bank:checking  ; same-line comment, note 2+ spaces before ;
+                ; next-line comment
+                ; another with tag, acctno:12345 (not used yet)
+
+       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
@@ -926,18 +926,18 @@
                 [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
+       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.
 
    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
+       bilities/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 di-
-       rective, by writing a type: tag in a comment, followed by  one  of  the
+       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):
 
@@ -945,11 +945,11 @@
               account liabilities  ; type:Liability
               account equity       ; type:Equity
               account revenues     ; type:Revenue
-              account expenses     ; type:Expenses
+              account expenses     ; type: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 depre-
+       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:
 
               account assets       A
@@ -959,7 +959,7 @@
               account expenses     X
 
    Overriding auto-detected types
-       If you ever override the types of those auto-detected  english  account
+       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
@@ -970,8 +970,8 @@
               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:
 
@@ -993,19 +993,22 @@
 
        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
-       the position of other among the top-level accounts.  This means: -  you
-       will  sometimes  declare  parent accounts (eg account other above) that
-       you don't intend to post to, just to customize their  display  order  -
-       sibling accounts stay together (you couldn't display x:y in between a:b
-       and a:c).
+       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)
+         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
+         a:b and a:c).
+
    Rewriting accounts
        You can define account alias rules which rewrite your account names, or
        parts of them, before generating reports.  This can be useful for:
@@ -1024,7 +1027,7 @@
        do not affect account names being entered via hledger add  or  hledger-
        web.
 
-       See also Cookbook: Rewrite account names.
+       See also Rewrite account names.
 
    Basic aliases
        To  set an account alias, use the alias directive in your journal file.
@@ -1288,8 +1291,8 @@
        actually a posting-generating rule:
 
               = QUERY
-                  ACCT  AMT
-                  ACCT  [AMT]
+                  ACCOUNT  AMOUNT
+                  ACCOUNT  [AMOUNT]
                   ...
 
        These posting-generating rules look like normal  postings,  except  the
@@ -1309,6 +1312,13 @@
          symbol S).  The matched posting's amount will be multiplied by N, and
          its commodity symbol will be replaced with S.
 
+       A  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'
+                  (budget:funds:dining out)                 *-1
+
        These rules have global effect - a rule appearing anywhere in your data
        can potentially affect any transaction, including transactions recorded
        above it or in another file.
@@ -1333,12 +1343,12 @@
                 assets:checking
 
               $ hledger print --auto
-              2017/12/01
+              2017-12-01
                   expenses:food              $10
                   assets:checking
                   (liabilities:charity)      $-1
 
-              2017/12/14
+              2017-12-14
                   expenses:gifts             $20
                   assets:checking
                   assets:checking:gifts     -$20
@@ -1380,17 +1390,8 @@
        o _modified: - a hidden tag not appearing in the comment; this transac-
          tion was modified "just now".
 
-EDITOR SUPPORT
-       Helper modes exist for popular text editors, which  make  working  with
-       journal files easier.  They add colour, formatting, tab completion, and
-       helpful commands, and are quite recommended if you  edit  your  journal
-       with  a  text  editor.   They  include  ledger-mode or hledger-mode for
-       Emacs, vim-ledger for Vim, hledger-vscode for Visual Studio  Code,  and
-       others.   See  the  [[Cookbook]] at hledger.org for the latest informa-
-       tion.
 
 
-
 REPORTING BUGS
        Report bugs at http://bugs.hledger.org (or on the #hledger IRC  channel
        or hledger mail list)
@@ -1414,4 +1415,4 @@
 
 
 
-hledger 1.16.2                   January 2020               hledger_journal(5)
+hledger 1.17                      March 2020                hledger_journal(5)
diff --git a/embeddedfiles/hledger_timeclock.5 b/embeddedfiles/hledger_timeclock.5
--- a/embeddedfiles/hledger_timeclock.5
+++ b/embeddedfiles/hledger_timeclock.5
@@ -1,5 +1,5 @@
 
-.TH "hledger_timeclock" "5" "January 2020" "hledger 1.16.2" "hledger User Manuals"
+.TH "hledger_timeclock" "5" "March 2020" "hledger 1.17" "hledger User Manuals"
 
 
 
@@ -36,13 +36,13 @@
 .nf
 \f[C]
 $ hledger -f t.timeclock print
-2015/03/30 * optional description after two spaces
+2015-03-30 * optional description after two spaces
     (some:account name)         0.33h
 
-2015/03/31 * 22:21-23:59
+2015-03-31 * 22:21-23:59
     (another account)         1.64h
 
-2015/04/01 * 00:00-02:00
+2015-04-01 * 00:00-02:00
     (another account)         2.01h
 \f[R]
 .fi
diff --git a/embeddedfiles/hledger_timeclock.info b/embeddedfiles/hledger_timeclock.info
--- a/embeddedfiles/hledger_timeclock.info
+++ b/embeddedfiles/hledger_timeclock.info
@@ -4,16 +4,18 @@
 
 File: hledger_timeclock.info,  Node: Top,  Up: (dir)
 
-hledger_timeclock(5) hledger 1.16.2
-***********************************
+hledger_timeclock(5) hledger 1.17
+*********************************
 
-hledger can read timeclock files.  As with Ledger, these are (a subset
-of) timeclock.el's format, containing clock-in and clock-out entries as
-in the example below.  The date is a simple date.  The time format is
-HH:MM[:SS][+-ZZZZ]. Seconds and timezone are optional.  The timezone, if
-present, must be four digits and is ignored (currently the time is
-always interpreted as a local time).
+Timeclock - the time logging format of timeclock.el, as read by hledger
 
+   hledger can read timeclock files.  As with Ledger, these are (a
+subset of) timeclock.el's format, containing clock-in and clock-out
+entries as in the example below.  The date is a simple date.  The time
+format is HH:MM[:SS][+-ZZZZ]. Seconds and timezone are optional.  The
+timezone, if present, must be four digits and is ignored (currently the
+time is always interpreted as a local time).
+
 i 2015/03/30 09:00:00 some:account name  optional description after two spaces
 o 2015/03/30 09:20:00
 i 2015/03/31 22:21:45 another account
@@ -25,13 +27,13 @@
 the above time log, 'hledger print' generates these journal entries:
 
 $ hledger -f t.timeclock print
-2015/03/30 * optional description after two spaces
+2015-03-30 * optional description after two spaces
     (some:account name)         0.33h
 
-2015/03/31 * 22:21-23:59
+2015-03-31 * 22:21-23:59
     (another account)         1.64h
 
-2015/04/01 * 00:00-02:00
+2015-04-01 * 00:00-02:00
     (another account)         2.01h
 
    Here is a sample.timeclock to download and some queries to try:
diff --git a/embeddedfiles/hledger_timeclock.txt b/embeddedfiles/hledger_timeclock.txt
--- a/embeddedfiles/hledger_timeclock.txt
+++ b/embeddedfiles/hledger_timeclock.txt
@@ -25,13 +25,13 @@
        the above time log, hledger print generates these journal entries:
 
               $ hledger -f t.timeclock print
-              2015/03/30 * optional description after two spaces
+              2015-03-30 * optional description after two spaces
                   (some:account name)         0.33h
 
-              2015/03/31 * 22:21-23:59
+              2015-03-31 * 22:21-23:59
                   (another account)         1.64h
 
-              2015/04/01 * 00:00-02:00
+              2015-04-01 * 00:00-02:00
                   (another account)         2.01h
 
        Here is a sample.timeclock to download and some queries to try:
@@ -78,4 +78,4 @@
 
 
 
-hledger 1.16.2                   January 2020             hledger_timeclock(5)
+hledger 1.17                      March 2020              hledger_timeclock(5)
diff --git a/embeddedfiles/hledger_timedot.5 b/embeddedfiles/hledger_timedot.5
--- a/embeddedfiles/hledger_timedot.5
+++ b/embeddedfiles/hledger_timedot.5
@@ -1,5 +1,5 @@
 
-.TH "hledger_timedot" "5" "January 2020" "hledger 1.16.2" "hledger User Manuals"
+.TH "hledger_timedot" "5" "March 2020" "hledger 1.17" "hledger User Manuals"
 
 
 
@@ -20,20 +20,23 @@
 commodityless quantities, so it could be used to represent dated
 quantities other than time.
 In the docs below we\[aq]ll assume it\[aq]s time.
-.SH FILE FORMAT
 .PP
 A timedot file contains a series of day entries.
-A day entry begins with a date, and is followed by category/quantity
-pairs, one per line.
-Dates are hledger-style simple dates (see hledger_journal(5)).
-Categories are hledger-style account names, optionally indented.
-As in a hledger journal, there must be at least two spaces between the
-category (account name) and the quantity.
+A day entry begins with a non-indented hledger-style simple date (Y-M-D,
+Y/M/D, Y.M.D..) Any additional text on the same line is used as a
+transaction description for this day.
 .PP
+This is followed by optionally-indented timelog items for that day, one
+per line.
+Each timelog item is a note, usually a hledger:style:account:name
+representing a time category, followed by two or more spaces, and a
+quantity.
+Each timelog item generates a hledger transaction.
+.PP
 Quantities can be written as:
 .IP \[bu] 2
-a sequence of dots (.) representing quarter hours.
-Spaces may optionally be used for grouping and readability.
+dots: a sequence of dots (.) representing quarter hours.
+Spaces may optionally be used for grouping.
 Eg: ....
 \&..
 .IP \[bu] 2
@@ -48,15 +51,32 @@
 The following equivalencies are assumed, currently: 1m = 60s, 1h = 60m,
 1d = 24h, 1w = 7d, 1mo = 30d, 1y=365d.
 .PP
-Blank lines and lines beginning with #, ; or * are ignored.
-An example:
+There is some flexibility allowing notes and todo lists to be kept right
+in the time log, if needed:
+.IP \[bu] 2
+Blank lines and lines beginning with \f[C]#\f[R] or \f[C];\f[R] are
+ignored.
+.IP \[bu] 2
+Lines not ending with a double-space and quantity are parsed as items
+taking no time, which will not appear in balance reports by default.
+(Add -E to see them.)
+.IP \[bu] 2
+Org mode headlines (lines beginning with one or more \f[C]*\f[R]
+followed by a space) can be used as date lines or timelog items (the
+stars are ignored).
+Also all org headlines before the first date line are ignored.
+This means org users can manage their timelog as an org outline (eg
+using org-mode/orgstruct-mode in Emacs), for organisation, faster
+navigation, controlling visibility etc.
+.PP
+Examples:
 .IP
 .nf
 \f[C]
 # on this day, 6h was spent on client work, 1.5h on haskell FOSS work, etc.
 2016/2/1
 inc:client1   .... .... .... .... .... ....
-fos:haskell   .... .. 
+fos:haskell   .... ..
 biz:research  .
 
 2016/2/2
@@ -64,8 +84,6 @@
 biz:research  .
 \f[R]
 .fi
-.PP
-Or with numbers:
 .IP
 .nf
 \f[C]
@@ -75,16 +93,45 @@
 biz:research  1
 \f[R]
 .fi
+.IP
+.nf
+\f[C]
+* Time log
+** 2020-01-01
+*** adm:time  .
+*** adm:finance  .
+\f[R]
+.fi
+.IP
+.nf
+\f[C]
+* 2020 Work Diary
+** Q1
+*** 2020-02-29
+**** DONE
+0700 yoga
+**** UNPLANNED
+**** BEGUN
+hom:chores
+ cleaning  ...
+ water plants
+  outdoor - one full watering can
+  indoor - light watering
+**** TODO
+adm:planning: trip
+*** LATER
+\f[R]
+.fi
 .PP
 Reporting:
 .IP
 .nf
 \f[C]
 $ hledger -f t.timedot print date:2016/2/2
-2016/02/02 *
+2016-02-02 *
     (inc:client1)          2.00
 
-2016/02/02 *
+2016-02-02 *
     (biz:research)          0.25
 \f[R]
 .fi
@@ -92,9 +139,9 @@
 .nf
 \f[C]
 $ hledger -f t.timedot bal --daily --tree
-Balance changes in 2016/02/01-2016/02/03:
+Balance changes in 2016-02-01-2016-02-03:
 
-            ||  2016/02/01d  2016/02/02d  2016/02/03d 
+            ||  2016-02-01d  2016-02-02d  2016-02-03d 
 ============++========================================
  biz        ||         0.25         0.25         1.00 
    research ||         0.25         0.25         1.00 
diff --git a/embeddedfiles/hledger_timedot.info b/embeddedfiles/hledger_timedot.info
--- a/embeddedfiles/hledger_timedot.info
+++ b/embeddedfiles/hledger_timedot.info
@@ -2,14 +2,16 @@
 stdin.
 
 
-File: hledger_timedot.info,  Node: Top,  Next: FILE FORMAT,  Up: (dir)
+File: hledger_timedot.info,  Node: Top,  Up: (dir)
 
-hledger_timedot(5) hledger 1.16.2
-*********************************
+hledger_timedot(5) hledger 1.17
+*******************************
 
-Timedot is a plain text format for logging dated, categorised quantities
-(of time, usually), supported by hledger.  It is convenient for
-approximate and retroactive time logging, eg when the real-time
+Timedot - hledger's human-friendly time logging format
+
+   Timedot is a plain text format for logging dated, categorised
+quantities (of time, usually), supported by hledger.  It is convenient
+for approximate and retroactive time logging, eg when the real-time
 clock-in/out required with a timeclock file is too precise or too
 interruptive.  It can be formatted like a bar chart, making clear at a
 glance where time was spent.
@@ -18,27 +20,21 @@
 commodityless quantities, so it could be used to represent dated
 quantities other than time.  In the docs below we'll assume it's time.
 
-* Menu:
-
-* FILE FORMAT::
-
-
-File: hledger_timedot.info,  Node: FILE FORMAT,  Prev: Top,  Up: Top
-
-1 FILE FORMAT
-*************
+   A timedot file contains a series of day entries.  A day entry begins
+with a non-indented hledger-style simple date (Y-M-D, Y/M/D, Y.M.D..)
+Any additional text on the same line is used as a transaction
+description for this day.
 
-A timedot file contains a series of day entries.  A day entry begins
-with a date, and is followed by category/quantity pairs, one per line.
-Dates are hledger-style simple dates (see hledger_journal(5)).
-Categories are hledger-style account names, optionally indented.  As in
-a hledger journal, there must be at least two spaces between the
-category (account name) and the quantity.
+   This is followed by optionally-indented timelog items for that day,
+one per line.  Each timelog item is a note, usually a
+hledger:style:account:name representing a time category, followed by two
+or more spaces, and a quantity.  Each timelog item generates a hledger
+transaction.
 
    Quantities can be written as:
 
-   * a sequence of dots (.)  representing quarter hours.  Spaces may
-     optionally be used for grouping and readability.  Eg: ....  ..
+   * dots: a sequence of dots (.)  representing quarter hours.  Spaces
+     may optionally be used for grouping.  Eg: ....  ..
 
    * an integral or decimal number, representing hours.  Eg: 1.5
 
@@ -48,39 +44,73 @@
      The following equivalencies are assumed, currently: 1m = 60s, 1h =
      60m, 1d = 24h, 1w = 7d, 1mo = 30d, 1y=365d.
 
-   Blank lines and lines beginning with #, ; or * are ignored.  An
-example:
+   There is some flexibility allowing notes and todo lists to be kept
+right in the time log, if needed:
 
+   * Blank lines and lines beginning with '#' or ';' are ignored.
+
+   * Lines not ending with a double-space and quantity are parsed as
+     items taking no time, which will not appear in balance reports by
+     default.  (Add -E to see them.)
+
+   * Org mode headlines (lines beginning with one or more '*' followed
+     by a space) can be used as date lines or timelog items (the stars
+     are ignored).  Also all org headlines before the first date line
+     are ignored.  This means org users can manage their timelog as an
+     org outline (eg using org-mode/orgstruct-mode in Emacs), for
+     organisation, faster navigation, controlling visibility etc.
+
+   Examples:
+
 # on this day, 6h was spent on client work, 1.5h on haskell FOSS work, etc.
 2016/2/1
 inc:client1   .... .... .... .... .... ....
-fos:haskell   .... .. 
+fos:haskell   .... ..
 biz:research  .
 
 2016/2/2
 inc:client1   .... ....
 biz:research  .
 
-   Or with numbers:
-
 2016/2/3
 inc:client1   4
 fos:hledger   3
 biz:research  1
 
+* Time log
+** 2020-01-01
+*** adm:time  .
+*** adm:finance  .
+
+* 2020 Work Diary
+** Q1
+*** 2020-02-29
+**** DONE
+0700 yoga
+**** UNPLANNED
+**** BEGUN
+hom:chores
+ cleaning  ...
+ water plants
+  outdoor - one full watering can
+  indoor - light watering
+**** TODO
+adm:planning: trip
+*** LATER
+
    Reporting:
 
 $ hledger -f t.timedot print date:2016/2/2
-2016/02/02 *
+2016-02-02 *
     (inc:client1)          2.00
 
-2016/02/02 *
+2016-02-02 *
     (biz:research)          0.25
 
 $ hledger -f t.timedot bal --daily --tree
-Balance changes in 2016/02/01-2016/02/03:
+Balance changes in 2016-02-01-2016-02-03:
 
-            ||  2016/02/01d  2016/02/02d  2016/02/03d 
+            ||  2016-02-01d  2016-02-02d  2016-02-03d 
 ============++========================================
  biz        ||         0.25         0.25         1.00 
    research ||         0.25         0.25         1.00 
@@ -111,8 +141,6 @@
 
 Tag Table:
 Node: Top76
-Node: FILE FORMAT812
-Ref: #file-format913
 
 End Tag Table
 
diff --git a/embeddedfiles/hledger_timedot.txt b/embeddedfiles/hledger_timedot.txt
--- a/embeddedfiles/hledger_timedot.txt
+++ b/embeddedfiles/hledger_timedot.txt
@@ -18,18 +18,21 @@
        less  quantities,  so  it  could  be used to represent dated quantities
        other than time.  In the docs below we'll assume it's time.
 
-FILE FORMAT
        A timedot file contains a series of day entries.  A  day  entry  begins
-       with  a date, and is followed by category/quantity pairs, one per line.
-       Dates are hledger-style simple dates (see  hledger_journal(5)).   Cate-
-       gories  are  hledger-style account names, optionally indented.  As in a
-       hledger journal, there must be at least two spaces between the category
-       (account name) and the quantity.
+       with  a  non-indented hledger-style simple date (Y-M-D, Y/M/D, Y.M.D..)
+       Any additional text on the same line is used as a transaction  descrip-
+       tion for this day.
 
+       This is followed by optionally-indented timelog items for that day, one
+       per line.  Each timelog item is a  note,  usually  a  hledger:style:ac-
+       count:name  representing  a time category, followed by two or more spa-
+       ces, and a quantity.  Each timelog item generates  a  hledger  transac-
+       tion.
+
        Quantities can be written as:
 
-       o a  sequence  of  dots (.) representing quarter hours.  Spaces may op-
-         tionally be used for grouping and readability.  Eg: ....  ..
+       o dots:  a sequence of dots (.) representing quarter hours.  Spaces may
+         optionally be used for grouping.  Eg: ....  ..
 
        o an integral or decimal number, representing hours.  Eg: 1.5
 
@@ -39,9 +42,24 @@
          lencies  are  assumed,  currently: 1m = 60s, 1h = 60m, 1d = 24h, 1w =
          7d, 1mo = 30d, 1y=365d.
 
-       Blank lines and lines beginning with #, ; or * are ignored.   An  exam-
-       ple:
+       There is some flexibility allowing notes and  todo  lists  to  be  kept
+       right in the time log, if needed:
 
+       o Blank lines and lines beginning with # or ; are ignored.
+
+       o Lines not ending with a double-space and quantity are parsed as items
+         taking no time, which will not appear in balance reports by  default.
+         (Add -E to see them.)
+
+       o Org  mode headlines (lines beginning with one or more * followed by a
+         space) can be used as date lines or timelog items (the stars are  ig-
+         nored).   Also  all  org headlines before the first date line are ig-
+         nored.  This means org users can manage their timelog as an org  out-
+         line  (eg  using org-mode/orgstruct-mode in Emacs), for organisation,
+         faster navigation, controlling visibility etc.
+
+       Examples:
+
               # on this day, 6h was spent on client work, 1.5h on haskell FOSS work, etc.
               2016/2/1
               inc:client1   .... .... .... .... .... ....
@@ -52,26 +70,45 @@
               inc:client1   .... ....
               biz:research  .
 
-       Or with numbers:
-
               2016/2/3
               inc:client1   4
               fos:hledger   3
               biz:research  1
 
+              * Time log
+              ** 2020-01-01
+              *** adm:time  .
+              *** adm:finance  .
+
+              * 2020 Work Diary
+              ** Q1
+              *** 2020-02-29
+              **** DONE
+              0700 yoga
+              **** UNPLANNED
+              **** BEGUN
+              hom:chores
+               cleaning  ...
+               water plants
+                outdoor - one full watering can
+                indoor - light watering
+              **** TODO
+              adm:planning: trip
+              *** LATER
+
        Reporting:
 
               $ hledger -f t.timedot print date:2016/2/2
-              2016/02/02 *
+              2016-02-02 *
                   (inc:client1)          2.00
 
-              2016/02/02 *
+              2016-02-02 *
                   (biz:research)          0.25
 
               $ hledger -f t.timedot bal --daily --tree
-              Balance changes in 2016/02/01-2016/02/03:
+              Balance changes in 2016-02-01-2016-02-03:
 
-                          ||  2016/02/01d  2016/02/02d  2016/02/03d
+                          ||  2016-02-01d  2016-02-02d  2016-02-03d
               ============++========================================
                biz        ||         0.25         0.25         1.00
                  research ||         0.25         0.25         1.00
@@ -83,7 +120,7 @@
               ------------++----------------------------------------
                           ||         7.75         2.25         8.00
 
-       I  prefer to use period for separating account components.  We can make
+       I prefer to use period for separating account components.  We can  make
        this work with an account alias:
 
               2016/2/4
@@ -102,7 +139,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)
 
 
@@ -116,7 +153,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)
 
@@ -124,4 +161,4 @@
 
 
 
-hledger 1.16.2                   January 2020               hledger_timedot(5)
+hledger 1.17                      March 2020                hledger_timedot(5)
diff --git a/hledger.1 b/hledger.1
--- a/hledger.1
+++ b/hledger.1
@@ -1,3711 +1,4260 @@
 .\"t
 
-.TH "hledger" "1" "January 2020" "hledger 1.16.2" "hledger User Manuals"
-
-
-
-.SH NAME
-.PP
-hledger - a command-line accounting tool
-.SH SYNOPSIS
-.PP
-\f[C]hledger [-f FILE] COMMAND [OPTIONS] [ARGS]\f[R]
-.PD 0
-.P
-.PD
-\f[C]hledger [-f FILE] ADDONCMD -- [OPTIONS] [ARGS]\f[R]
-.PD 0
-.P
-.PD
-\f[C]hledger\f[R]
-.SH DESCRIPTION
-.PP
-hledger is a cross-platform program for tracking money, time, or any
-other commodity, using double-entry accounting and a simple, editable
-file format.
-hledger is inspired by and largely compatible with ledger(1).
-.PD 0
-.P
-.PD
-Tested on unix, mac, windows, hledger aims to be a reliable, practical
-tool for daily use.
-.PP
-This is hledger\[cq]s command-line interface (there are also terminal
-and web interfaces).
-Its basic function is to read a plain text file describing financial
-transactions (in accounting terms, a general journal) and print useful
-reports on standard output, or export them as CSV.
-hledger can also read some other file formats such as CSV files,
-translating them to journal format.
-Additionally, hledger lists other hledger-* executables found in the
-user\[cq]s $PATH and can invoke them as subcommands.
-.PP
-hledger reads data from one or more files in hledger journal, timeclock,
-timedot, or CSV format specified with \f[C]-f\f[R], or
-\f[C]$LEDGER_FILE\f[R], or \f[C]$HOME/.hledger.journal\f[R] (on windows,
-perhaps \f[C]C:/Users/USER/.hledger.journal\f[R]).
-If using \f[C]$LEDGER_FILE\f[R], note this must be a real environment
-variable, not a shell variable.
-You can specify standard input with \f[C]-f-\f[R].
-.PP
-Transactions are dated movements of money between two (or more) named
-accounts, and are recorded with journal entries like this:
-.IP
-.nf
-\f[C]
-2015/10/16 bought food
- expenses:food          $10
- assets:cash
-\f[R]
-.fi
-.PP
-For more about this format, see hledger_journal(5).
-.PP
-Most users use a text editor to edit the journal, usually with an editor
-mode such as ledger-mode for added convenience.
-hledger\[cq]s interactive add command is another way to record new
-transactions.
-hledger never changes existing transactions.
-.PP
-To get started, you can either save some entries like the above in
-\f[C]\[ti]/.hledger.journal\f[R], or run \f[C]hledger add\f[R] and
-follow the prompts.
-Then try some commands like \f[C]hledger print\f[R] or
-\f[C]hledger balance\f[R].
-Run \f[C]hledger\f[R] with no arguments for a list of commands.
-.SH EXAMPLES
-.PP
-Two simple transactions in hledger journal format:
-.IP
-.nf
-\f[C]
-2015/9/30 gift received
-  assets:cash   $20
-  income:gifts
-
-2015/10/16 farmers market
-  expenses:food    $10
-  assets:cash
-\f[R]
-.fi
-.PP
-Some basic reports:
-.IP
-.nf
-\f[C]
-$ hledger print
-2015/09/30 gift received
-    assets:cash            $20
-    income:gifts          $-20
-
-2015/10/16 farmers market
-    expenses:food           $10
-    assets:cash            $-10
-\f[R]
-.fi
-.IP
-.nf
-\f[C]
-$ hledger accounts --tree
-assets
-  cash
-expenses
-  food
-income
-  gifts
-\f[R]
-.fi
-.IP
-.nf
-\f[C]
-$ hledger balance
-                 $10  assets:cash
-                 $10  expenses:food
-                $-20  income:gifts
---------------------
-                   0
-\f[R]
-.fi
-.IP
-.nf
-\f[C]
-$ hledger register cash
-2015/09/30 gift received   assets:cash               $20           $20
-2015/10/16 farmers market  assets:cash              $-10           $10
-\f[R]
-.fi
-.PP
-More commands:
-.IP
-.nf
-\f[C]
-$ hledger                                 # show available commands
-$ hledger add                             # add more transactions to the journal file
-$ hledger balance                         # all accounts with aggregated balances
-$ hledger balance --help                  # show detailed help for balance command
-$ hledger balance --depth 1               # only top-level accounts
-$ hledger register                        # show account postings, with running total
-$ hledger reg income                      # show postings to/from income accounts
-$ hledger reg \[aq]assets:some bank:checking\[aq] # show postings to/from this checking account
-$ hledger print desc:shop                 # show transactions with shop in the description
-$ hledger activity -W                     # show transaction counts per week as a bar chart
-\f[R]
-.fi
-.SH OPTIONS
-.SS General options
-.PP
-To see general usage help, including general options which are supported
-by most hledger commands, run \f[C]hledger -h\f[R].
-.PP
-General help options:
-.TP
-\f[B]\f[CB]-h --help\f[B]\f[R]
-show general usage (or after COMMAND, command usage)
-.TP
-\f[B]\f[CB]--version\f[B]\f[R]
-show version
-.TP
-\f[B]\f[CB]--debug[=N]\f[B]\f[R]
-show debug output (levels 1-9, default: 1)
-.PP
-General input options:
-.TP
-\f[B]\f[CB]-f FILE --file=FILE\f[B]\f[R]
-use a different input file.
-For stdin, use - (default: \f[C]$LEDGER_FILE\f[R] or
-\f[C]$HOME/.hledger.journal\f[R])
-.TP
-\f[B]\f[CB]--rules-file=RULESFILE\f[B]\f[R]
-Conversion rules file to use when reading CSV (default: FILE.rules)
-.TP
-\f[B]\f[CB]--separator=CHAR\f[B]\f[R]
-Field separator to expect when reading CSV (default: \[aq],\[aq])
-.TP
-\f[B]\f[CB]--alias=OLD=NEW\f[B]\f[R]
-rename accounts named OLD to NEW
-.TP
-\f[B]\f[CB]--anon\f[B]\f[R]
-anonymize accounts and payees
-.TP
-\f[B]\f[CB]--pivot FIELDNAME\f[B]\f[R]
-use some other field or tag for the account name
-.TP
-\f[B]\f[CB]-I --ignore-assertions\f[B]\f[R]
-ignore any failing balance assertions
-.PP
-General reporting options:
-.TP
-\f[B]\f[CB]-b --begin=DATE\f[B]\f[R]
-include postings/txns on or after this date
-.TP
-\f[B]\f[CB]-e --end=DATE\f[B]\f[R]
-include postings/txns before this date
-.TP
-\f[B]\f[CB]-D --daily\f[B]\f[R]
-multiperiod/multicolumn report by day
-.TP
-\f[B]\f[CB]-W --weekly\f[B]\f[R]
-multiperiod/multicolumn report by week
-.TP
-\f[B]\f[CB]-M --monthly\f[B]\f[R]
-multiperiod/multicolumn report by month
-.TP
-\f[B]\f[CB]-Q --quarterly\f[B]\f[R]
-multiperiod/multicolumn report by quarter
-.TP
-\f[B]\f[CB]-Y --yearly\f[B]\f[R]
-multiperiod/multicolumn report by year
-.TP
-\f[B]\f[CB]-p --period=PERIODEXP\f[B]\f[R]
-set start date, end date, and/or reporting interval all at once using
-period expressions syntax
-.TP
-\f[B]\f[CB]--date2\f[B]\f[R]
-match the secondary date instead (see command help for other effects)
-.TP
-\f[B]\f[CB]-U --unmarked\f[B]\f[R]
-include only unmarked postings/txns (can combine with -P or -C)
-.TP
-\f[B]\f[CB]-P --pending\f[B]\f[R]
-include only pending postings/txns
-.TP
-\f[B]\f[CB]-C --cleared\f[B]\f[R]
-include only cleared postings/txns
-.TP
-\f[B]\f[CB]-R --real\f[B]\f[R]
-include only non-virtual postings
-.TP
-\f[B]\f[CB]-NUM --depth=NUM\f[B]\f[R]
-hide/aggregate accounts or postings more than NUM levels deep
-.TP
-\f[B]\f[CB]-E --empty\f[B]\f[R]
-show items with zero amount, normally hidden (and vice-versa in
-hledger-ui/hledger-web)
-.TP
-\f[B]\f[CB]-B --cost\f[B]\f[R]
-convert amounts to their cost at transaction time (using the transaction
-price, if any)
-.TP
-\f[B]\f[CB]-V --value\f[B]\f[R]
-convert amounts to their market value on the report end date (using the
-most recent applicable market price, if any)
-.TP
-\f[B]\f[CB]--auto\f[B]\f[R]
-apply automated posting rules to modify transactions.
-.TP
-\f[B]\f[CB]--forecast\f[B]\f[R]
-apply periodic transaction rules to generate future transactions, to 6
-months from now or report end date.
-.PP
-When a reporting option appears more than once in the command line, the
-last one takes precedence.
-.PP
-Some reporting options can also be written as query arguments.
-.SS Command options
-.PP
-To see options for a particular command, including command-specific
-options, run: \f[C]hledger COMMAND -h\f[R].
-.PP
-Command-specific options must be written after the command name, eg:
-\f[C]hledger print -x\f[R].
-.PP
-Additionally, if the command is an addon, you may need to put its
-options after a double-hyphen, eg: \f[C]hledger ui -- --watch\f[R].
-Or, you can run the addon executable directly:
-\f[C]hledger-ui --watch\f[R].
-.SS Command arguments
-.PP
-Most hledger commands accept arguments after the command name, which are
-often a query, filtering the data in some way.
-.SS Argument files
-.PP
-You can save a set of command line options/arguments in a file, one per
-line, and then reuse them by writing \f[C]\[at]FILENAME\f[R] in a
-command line.
-To prevent this expansion of \f[C]\[at]\f[R]-arguments, precede them
-with a \f[C]--\f[R] argument.
-For more, see Save frequently used options.
-.SS Special characters in arguments and queries
-.PP
-In shell command lines, option and argument values which contain
-\[dq]problematic\[dq] characters, ie spaces, and also characters
-significant to your shell such as \f[C]<\f[R], \f[C]>\f[R], \f[C](\f[R],
-\f[C])\f[R], \f[C]|\f[R] and \f[C]$\f[R], should be escaped by enclosing
-them in quotes or by writing backslashes before the characters.
-Eg:
-.PP
-\f[C]hledger register -p \[aq]last year\[aq] \[dq]accounts receivable (receivable|payable)\[dq] amt:\[rs]>100\f[R].
-.SS More escaping
-.PP
-Characters significant both to the shell and in regular expressions may
-need one extra level of escaping.
-These include parentheses, the pipe symbol and the dollar sign.
-Eg, to match the dollar symbol, bash users should do:
-.PP
-\f[C]hledger balance cur:\[aq]\[rs]$\[aq]\f[R]
-.PP
-or:
-.PP
-\f[C]hledger balance cur:\[rs]\[rs]$\f[R]
-.SS Even more escaping
-.PP
-When hledger runs an addon executable (eg you type \f[C]hledger ui\f[R],
-hledger runs \f[C]hledger-ui\f[R]), it de-escapes command-line options
-and arguments once, so you might need to \f[I]triple\f[R]-escape.
-Eg in bash, running the ui command and matching the dollar sign,
-it\[aq]s:
-.PP
-\f[C]hledger ui cur:\[aq]\[rs]\[rs]$\[aq]\f[R]
-.PP
-or:
-.PP
-\f[C]hledger ui cur:\[rs]\[rs]\[rs]\[rs]$\f[R]
-.PP
-If you asked why \f[I]four\f[R] slashes above, this may help:
-.PP
-.TS
-tab(@);
-l l.
-T{
-unescaped:
-T}@T{
-\f[C]$\f[R]
-T}
-T{
-escaped:
-T}@T{
-\f[C]\[rs]$\f[R]
-T}
-T{
-double-escaped:
-T}@T{
-\f[C]\[rs]\[rs]$\f[R]
-T}
-T{
-triple-escaped:
-T}@T{
-\f[C]\[rs]\[rs]\[rs]\[rs]$\f[R]
-T}
-.TE
-.PP
-(The number of backslashes in fish shell is left as an exercise for the
-reader.)
-.PP
-You can always avoid the extra escaping for addons by running the addon
-directly:
-.PP
-\f[C]hledger-ui cur:\[rs]\[rs]$\f[R]
-.SS Less escaping
-.PP
-Inside an argument file, or in the search field of hledger-ui or
-hledger-web, or at a GHCI prompt, you need one less level of escaping
-than at the command line.
-And backslashes may work better than quotes.
-Eg:
-.PP
-\f[C]ghci> :main balance cur:\[rs]$\f[R]
-.SS Command line tips
-.PP
-If in doubt, keep things simple:
-.IP \[bu] 2
-write options after the command (\f[C]hledger CMD -OPTIONS ARGS\f[R])
-.IP \[bu] 2
-run add-on executables directly (\f[C]hledger-ui -OPTIONS ARGS\f[R])
-.IP \[bu] 2
-enclose problematic args in single quotes
-.IP \[bu] 2
-if needed, also add a backslash to escape regexp metacharacters
-.PP
-To find out exactly how a command line is being parsed, add
-\f[C]--debug=2\f[R] to troubleshoot.
-.SS Unicode characters
-.PP
-hledger is expected to handle non-ascii characters correctly:
-.IP \[bu] 2
-they should be parsed correctly in input files and on the command line,
-by all hledger tools (add, iadd, hledger-web\[aq]s search/add/edit
-forms, etc.)
-.IP \[bu] 2
-they should be displayed correctly by all hledger tools, and on-screen
-alignment should be preserved.
-.PP
-This requires a well-configured environment.
-Here are some tips:
-.IP \[bu] 2
-A system locale must be configured, and it must be one that can decode
-the characters being used.
-In bash, you can set a locale like this:
-\f[C]export LANG=en_US.UTF-8\f[R].
-There are some more details in Troubleshooting.
-This step is essential - without it, hledger will quit on encountering a
-non-ascii character (as with all GHC-compiled programs).
-.IP \[bu] 2
-your terminal software (eg Terminal.app, iTerm, CMD.exe, xterm..) must
-support unicode
-.IP \[bu] 2
-the terminal must be using a font which includes the required unicode
-glyphs
-.IP \[bu] 2
-the terminal should be configured to display wide characters as double
-width (for report alignment)
-.IP \[bu] 2
-on Windows, for best results you should run hledger in the same kind of
-environment in which it was built.
-Eg hledger built in the standard CMD.EXE environment (like the binaries
-on our download page) might show display problems when run in a cygwin
-or msys terminal, and vice versa.
-(See eg #961).
-.SS Input files
-.PP
-hledger reads transactions from a data file (and the add command writes
-to it).
-By default this file is \f[C]$HOME/.hledger.journal\f[R] (or on Windows,
-something like \f[C]C:/Users/USER/.hledger.journal\f[R]).
-You can override this with the \f[C]$LEDGER_FILE\f[R] environment
-variable:
-.IP
-.nf
-\f[C]
-$ setenv LEDGER_FILE \[ti]/finance/2016.journal
-$ hledger stats
-\f[R]
-.fi
-.PP
-or with the \f[C]-f/--file\f[R] option:
-.IP
-.nf
-\f[C]
-$ hledger -f /some/file stats
-\f[R]
-.fi
-.PP
-The file name \f[C]-\f[R] (hyphen) means standard input:
-.IP
-.nf
-\f[C]
-$ cat some.journal | hledger -f-
-\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:
-.PP
-.TS
-tab(@);
-lw(7.6n) lw(31.2n) lw(31.2n).
-T{
-Reader:
-T}@T{
-Reads:
-T}@T{
-Used for file extensions:
-T}
-_
-T{
-\f[C]journal\f[R]
-T}@T{
-hledger\[aq]s journal format, also some Ledger journals
-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)
-T}@T{
-\f[C].timeclock\f[R]
-T}
-T{
-\f[C]timedot\f[R]
-T}@T{
-timedot files (approximate time logging)
-T}@T{
-\f[C].timedot\f[R]
-T}
-T{
-\f[C]csv\f[R]
-T}@T{
-comma-separated values (data interchange)
-T}@T{
-\f[C].csv\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:
-.IP
-.nf
-\f[C]
-$ hledger -f csv:/some/csv-file.dat stats
-$ echo \[aq]i 2009/13/1 08:00:00\[aq] | hledger print -ftimeclock:-
-\f[R]
-.fi
-.PP
-You can also 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].
-.SS Smart dates
-.PP
-hledger\[aq]s user interfaces accept a flexible \[dq]smart date\[dq]
-syntax (unlike dates in the journal file).
-Smart dates allow some english words, can be relative to today\[aq]s
-date, and can have less-significant date parts omitted (defaulting to
-1).
-.PP
-Examples:
-.PP
-.TS
-tab(@);
-l l.
-T{
-\f[C]2004/10/1\f[R], \f[C]2004-01-01\f[R], \f[C]2004.9.1\f[R]
-T}@T{
-exact date, several separators allowed.
-Year is 4+ digits, month is 1-12, day is 1-31
-T}
-T{
-\f[C]2004\f[R]
-T}@T{
-start of year
-T}
-T{
-\f[C]2004/10\f[R]
-T}@T{
-start of month
-T}
-T{
-\f[C]10/1\f[R]
-T}@T{
-month and day in current year
-T}
-T{
-\f[C]21\f[R]
-T}@T{
-day in current month
-T}
-T{
-\f[C]october, oct\f[R]
-T}@T{
-start of month in current year
-T}
-T{
-\f[C]yesterday, today, tomorrow\f[R]
-T}@T{
--1, 0, 1 days from today
-T}
-T{
-\f[C]last/this/next day/week/month/quarter/year\f[R]
-T}@T{
--1, 0, 1 periods from the current period
-T}
-T{
-\f[C]20181201\f[R]
-T}@T{
-8 digit YYYYMMDD with valid year month and day
-T}
-T{
-\f[C]201812\f[R]
-T}@T{
-6 digit YYYYMM with valid year and month
-T}
-.TE
-.PP
-Counterexamples - malformed digit sequences might give surprising
-results:
-.PP
-.TS
-tab(@);
-l l.
-T{
-\f[C]201813\f[R]
-T}@T{
-6 digits with an invalid month is parsed as start of 6-digit year
-T}
-T{
-\f[C]20181301\f[R]
-T}@T{
-8 digits with an invalid month is parsed as start of 8-digit year
-T}
-T{
-\f[C]20181232\f[R]
-T}@T{
-8 digits with an invalid day gives an error
-T}
-T{
-\f[C]201801012\f[R]
-T}@T{
-9+ digits beginning with a valid YYYYMMDD gives an error
-T}
-.TE
-.SS Report start & end date
-.PP
-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 the journal.
-.PP
-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 \f[C]-b/--begin\f[R],
-\f[C]-e/--end\f[R], \f[C]-p/--period\f[R] or a \f[C]date:\f[R] query
-(described below).
-All of these accept the smart date syntax.
-.PP
-Some notes:
-.IP \[bu] 2
-As in Ledger, end dates are exclusive, so you need to write the date
-\f[I]after\f[R] the last day you want to include.
-.IP \[bu] 2
-As noted in reporting options: among start/end dates specified with
-\f[I]options\f[R], the last (i.e.
-right-most) option takes precedence.
-.IP \[bu] 2
-The effective report start and end dates are the intersection of the
-start/end dates from options and that from \f[C]date:\f[R] queries.
-That is, \f[C]date:2019-01 date:2019 -p\[aq]2000 to 2030\[aq]\f[R]
-yields January 2019, the smallest common time span.
-.PP
-Examples:
-.PP
-.TS
-tab(@);
-l l.
-T{
-\f[C]-b 2016/3/17\f[R]
-T}@T{
-begin on St.
-Patrick\[aq]s day 2016
-T}
-T{
-\f[C]-e 12/1\f[R]
-T}@T{
-end at the start of december 1st of the current year (11/30 will be the
-last date included)
-T}
-T{
-\f[C]-b thismonth\f[R]
-T}@T{
-all transactions on or after the 1st of the current month
-T}
-T{
-\f[C]-p thismonth\f[R]
-T}@T{
-all transactions in the current month
-T}
-T{
-\f[C]date:2016/3/17-\f[R]
-T}@T{
-the above written as queries instead
-T}
-T{
-\f[C]date:-12/1\f[R]
-T}@T{
-T}
-T{
-\f[C]date:thismonth-\f[R]
-T}@T{
-T}
-T{
-\f[C]date:thismonth\f[R]
-T}@T{
-T}
-.TE
-.SS Report intervals
-.PP
-A report interval can be specified so that commands like register,
-balance and activity will divide their reports into multiple subperiods.
-The basic intervals can be selected with one of \f[C]-D/--daily\f[R],
-\f[C]-W/--weekly\f[R], \f[C]-M/--monthly\f[R], \f[C]-Q/--quarterly\f[R],
-or \f[C]-Y/--yearly\f[R].
-More complex intervals may be specified with a period expression.
-Report intervals can not be specified with a query.
-.SS Period expressions
-.PP
-The \f[C]-p/--period\f[R] option accepts period expressions, a shorthand
-way of expressing a start date, end date, and/or report interval all at
-once.
-.PP
-Here\[aq]s a basic period expression specifying the first quarter of
-2009.
-Note, hledger always treats start dates as inclusive and end dates as
-exclusive:
-.PP
-\f[C]-p \[dq]from 2009/1/1 to 2009/4/1\[dq]\f[R]
-.PP
-Keywords like \[dq]from\[dq] and \[dq]to\[dq] are optional, and so are
-the spaces, as long as you don\[aq]t run two dates together.
-\[dq]to\[dq] can also be written as \[dq]-\[dq].
-These are equivalent to the above:
-.PP
-.TS
-tab(@);
-l.
-T{
-\f[C]-p \[dq]2009/1/1 2009/4/1\[dq]\f[R]
-T}
-T{
-\f[C]-p2009/1/1to2009/4/1\f[R]
-T}
-T{
-\f[C]-p2009/1/1-2009/4/1\f[R]
-T}
-.TE
-.PP
-Dates are smart dates, so if the current year is 2009, the above can
-also be written as:
-.PP
-.TS
-tab(@);
-l.
-T{
-\f[C]-p \[dq]1/1 4/1\[dq]\f[R]
-T}
-T{
-\f[C]-p \[dq]january-apr\[dq]\f[R]
-T}
-T{
-\f[C]-p \[dq]this year to 4/1\[dq]\f[R]
-T}
-.TE
-.PP
-If you specify only one date, the missing start or end date will be the
-earliest or latest transaction in your journal:
-.PP
-.TS
-tab(@);
-l l.
-T{
-\f[C]-p \[dq]from 2009/1/1\[dq]\f[R]
-T}@T{
-everything after january 1, 2009
-T}
-T{
-\f[C]-p \[dq]from 2009/1\[dq]\f[R]
-T}@T{
-the same
-T}
-T{
-\f[C]-p \[dq]from 2009\[dq]\f[R]
-T}@T{
-the same
-T}
-T{
-\f[C]-p \[dq]to 2009\[dq]\f[R]
-T}@T{
-everything before january 1, 2009
-T}
-.TE
-.PP
-A single date with no \[dq]from\[dq] or \[dq]to\[dq] defines both the
-start and end date like so:
-.PP
-.TS
-tab(@);
-l r.
-T{
-\f[C]-p \[dq]2009\[dq]\f[R]
-T}@T{
-the year 2009; equivalent to \[dq]2009/1/1 to 2010/1/1\[dq]
-T}
-T{
-\f[C]-p \[dq]2009/1\[dq]\f[R]
-T}@T{
-the month of jan; equivalent to \[dq]2009/1/1 to 2009/2/1\[dq]
-T}
-T{
-\f[C]-p \[dq]2009/1/1\[dq]\f[R]
-T}@T{
-just that day; equivalent to \[dq]2009/1/1 to 2009/1/2\[dq]
-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],
-\f[C]monthly\f[R], \f[C]quarterly\f[R], or \f[C]yearly\f[R], which have
-the same effect as the
-\f[C]-D\f[R],\f[C]-W\f[R],\f[C]-M\f[R],\f[C]-Q\f[R], or \f[C]-Y\f[R]
-flags.
-Between report interval and start/end dates (if any), the word
-\f[C]in\f[R] is optional.
-Examples:
-.PP
-.TS
-tab(@);
-l.
-T{
-\f[C]-p \[dq]weekly from 2009/1/1 to 2009/4/1\[dq]\f[R]
-T}
-T{
-\f[C]-p \[dq]monthly in 2008\[dq]\f[R]
-T}
-T{
-\f[C]-p \[dq]quarterly\[dq]\f[R]
-T}
-.TE
-.PP
-Note that \f[C]weekly\f[R], \f[C]monthly\f[R], \f[C]quarterly\f[R] and
-\f[C]yearly\f[R] intervals will always start on the first day on week,
-month, quarter or year accordingly, and will end on the last day of same
-period, even if associated period expression specifies different
-explicit start and end date.
-.PP
-For example:
-.PP
-.TS
-tab(@);
-l.
-T{
-\f[C]-p \[dq]weekly from 2009/1/1 to 2009/4/1\[dq]\f[R] -- starts on
-2008/12/29, closest preceding Monday
-T}
-T{
-\f[C]-p \[dq]monthly in 2008/11/25\[dq]\f[R] -- starts on 2018/11/01
-T}
-T{
-\f[C]-p \[dq]quarterly from 2009-05-05 to 2009-06-01\[dq]\f[R] - starts
-on 2009/04/01, ends on 2009/06/30, which are first and last days of Q2
-2009
-T}
-T{
-\f[C]-p \[dq]yearly from 2009-12-29\[dq]\f[R] - starts on 2009/01/01,
-first day of 2009
-T}
-.TE
-.PP
-The following more complex report intervals are also supported:
-\f[C]biweekly\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
-All of these will start on the first day of the requested period and end
-on the last one, as described above.
-.PP
-Examples:
-.PP
-.TS
-tab(@);
-l.
-T{
-\f[C]-p \[dq]bimonthly from 2008\[dq]\f[R] -- periods will have
-boundaries on 2008/01/01, 2008/03/01, ...
-T}
-T{
-\f[C]-p \[dq]every 2 weeks\[dq]\f[R] -- starts on closest preceding
-Monday
-T}
-T{
-\f[C]-p \[dq]every 5 month from 2009/03\[dq]\f[R] -- periods will have
-boundaries on 2009/03/01, 2009/08/01, ...
-T}
-.TE
-.PP
-If you want intervals that start on arbitrary day of your choosing and
-span a week, month or year, you need to use any of the following:
-.PP
-\f[C]every Nth day of week\f[R], \f[C]every <weekday>\f[R],
-\f[C]every Nth day [of month]\f[R],
-\f[C]every Nth weekday [of month]\f[R], \f[C]every MM/DD [of year]\f[R],
-\f[C]every Nth MMM [of year]\f[R], \f[C]every MMM Nth [of year]\f[R].
-.PP
-Examples:
-.PP
-.TS
-tab(@);
-l.
-T{
-\f[C]-p \[dq]every 2nd day of week\[dq]\f[R] -- periods will go from Tue
-to Tue
-T}
-T{
-\f[C]-p \[dq]every Tue\[dq]\f[R] -- same
-T}
-T{
-\f[C]-p \[dq]every 15th day\[dq]\f[R] -- period boundaries will be on
-15th of each month
-T}
-T{
-\f[C]-p \[dq]every 2nd Monday\[dq]\f[R] -- period boundaries will be on
-second Monday of each month
-T}
-T{
-\f[C]-p \[dq]every 11/05\[dq]\f[R] -- yearly periods with boundaries on
-5th of Nov
-T}
-T{
-\f[C]-p \[dq]every 5th Nov\[dq]\f[R] -- same
-T}
-T{
-\f[C]-p \[dq]every Nov 5th\[dq]\f[R] -- same
-T}
-.TE
-.PP
-Show historical balances at end of 15th each month (N is exclusive end
-date):
-.PP
-\f[C]hledger balance -H -p \[dq]every 16th day\[dq]\f[R]
-.PP
-Group postings from start of wednesday to end of next tuesday (N is
-start date and exclusive end date):
-.PP
-\f[C]hledger register checking -p \[dq]every 3rd day of week\[dq]\f[R]
-.SS Depth limiting
-.PP
-With the \f[C]--depth N\f[R] option (short form: \f[C]-N\f[R]), commands
-like account, balance and register will show only the uppermost accounts
-in the account tree, down to level N.
-Use this when you want a summary with less detail.
-This flag has the same effect as a \f[C]depth:\f[R] query argument (so
-\f[C]-2\f[R], \f[C]--depth=2\f[R] or \f[C]depth:2\f[R] are basically
-equivalent).
-.SS Pivoting
-.PP
-Normally hledger sums amounts, and organizes them in a hierarchy, based
-on account name.
-The \f[C]--pivot FIELD\f[R] option causes it to sum and organize
-hierarchy based on the value of some other field instead.
-FIELD can be: \f[C]code\f[R], \f[C]description\f[R], \f[C]payee\f[R],
-\f[C]note\f[R], or the full name (case insensitive) of any tag.
-As with account names, values containing \f[C]colon:separated:parts\f[R]
-will be displayed hierarchically in reports.
-.PP
-\f[C]--pivot\f[R] is a general option affecting all reports; you can
-think of hledger transforming the journal before any other processing,
-replacing every posting\[aq]s account name with the value of the
-specified field on that posting, inheriting it from the transaction or
-using a blank value if it\[aq]s not present.
-.PP
-An example:
-.IP
-.nf
-\f[C]
-2016/02/16 Member Fee Payment
-    assets:bank account                    2 EUR
-    income:member fees                    -2 EUR  ; member: John Doe
-\f[R]
-.fi
-.PP
-Normal balance report showing account names:
-.IP
-.nf
-\f[C]
-$ hledger balance
-               2 EUR  assets:bank account
-              -2 EUR  income:member fees
---------------------
-                   0
-\f[R]
-.fi
-.PP
-Pivoted balance report, using member: tag values instead:
-.IP
-.nf
-\f[C]
-$ hledger balance --pivot member
-               2 EUR
-              -2 EUR  John Doe
---------------------
-                   0
-\f[R]
-.fi
-.PP
-One way to show only amounts with a member: value (using a query,
-described below):
-.IP
-.nf
-\f[C]
-$ hledger balance --pivot member tag:member=.
-              -2 EUR  John Doe
---------------------
-              -2 EUR
-\f[R]
-.fi
-.PP
-Another way (the acct: query matches against the pivoted \[dq]account
-name\[dq]):
-.IP
-.nf
-\f[C]
-$ hledger balance --pivot member acct:.
-              -2 EUR  John Doe
---------------------
-              -2 EUR
-\f[R]
-.fi
-.SS Valuation
-.SS -B: Cost
-.PP
-The \f[C]-B/--cost\f[R] flag converts amounts to their cost (or selling
-price) at transaction time, if they have a transaction price specified.
-This flag is equivalent to \f[C]--value=cost\f[R], described below.
-.SS -V: Market value
-.PP
-The \f[C]-V/--market\f[R] flag converts reported amounts to their market
-value in a default valuation commodity, using the market prices in
-effect on a default valuation date.
-For single period reports, the valuation date is today (equivalent to
-\f[C]--value=now\f[R]); for multiperiod reports, it is the last day of
-each subperiod (equivalent to \f[C]--value=end\f[R]).
-.PP
-The default valuation commodity is the one referenced in the latest
-applicable market price dated on or before the valuation date.
-If most of your P declarations lead to a single home currency, this will
-usually be what you want.
-(To specify the commodity, see -X below.)
-.PP
-Note that in hledger, market prices are always declared explicitly with
-P directives; we do not infer them from transaction prices as Ledger
-does.
-.PP
-Here\[aq]s a quick example of -V:
-.IP
-.nf
-\f[C]
-; one euro is worth this many dollars from nov 1
-P 2016/11/01 \[Eu] $1.10
-
-; purchase some euros on nov 3
-2016/11/3
-    assets:euros        \[Eu]100
-    assets:checking
-
-; the euro is worth fewer dollars by dec 21
-P 2016/12/21 \[Eu] $1.03
-\f[R]
-.fi
-.PP
-How many euros do I have ?
-.IP
-.nf
-\f[C]
-$ hledger -f t.j bal -N euros
-                \[Eu]100  assets:euros
-\f[R]
-.fi
-.PP
-What are they worth at end of nov 3 ?
-.IP
-.nf
-\f[C]
-$ hledger -f t.j bal -N euros -V -e 2016/11/4
-             $110.00  assets:euros
-\f[R]
-.fi
-.PP
-What are they worth after 2016/12/21 ?
-(no report end date specified, defaults to today)
-.IP
-.nf
-\f[C]
-$ hledger -f t.j bal -N euros -V
-             $103.00  assets:euros
-\f[R]
-.fi
-.SS -X: Market value in specified commodity
-.PP
-The \f[C]-X/--exchange\f[R] option is like \f[C]-V\f[R], except it
-specifies the target commodity you would like to convert to.
-It is equivalent to \f[C]--value=now,COMM\f[R] or
-\f[C]--value=end,COMM\f[R].
-.SS --value: Flexible valuation
-.PP
-\f[I](experimental, added 201905)\f[R]
-.PP
-\f[C]-B\f[R], \f[C]-V\f[R] and \f[C]-X\f[R] are special cases of the
-more general \f[C]--value\f[R] option:
-.IP
-.nf
-\f[C]
- --value=TYPE[,COMM]  TYPE is cost, end, now or YYYY-MM-DD.
-                      COMM is an optional commodity symbol.
-                      Shows amounts converted to:
-                      - cost commodity using transaction prices (then optionally to COMM using market prices at period end(s))
-                      - default valuation commodity (or COMM) using market prices at period end(s)
-                      - default valuation commodity (or COMM) using current market prices
-                      - default valuation commodity (or COMM) using market prices at some date
-\f[R]
-.fi
-.PP
-The TYPE part basically selects either \[dq]cost\[dq], or \[dq]market
-value\[dq] plus a valuation date:
-.TP
-\f[B]\f[CB]--value=cost\f[B]\f[R]
-Convert amounts to cost, using the prices recorded in transactions.
-.TP
-\f[B]\f[CB]--value=end\f[B]\f[R]
-Convert amounts to their value in a default valuation commodity, using
-market prices on the last day of the report period (or if unspecified,
-the journal\[aq]s end date); or in multiperiod reports, market prices on
-the last day of each subperiod.
-.TP
-\f[B]\f[CB]--value=now\f[B]\f[R]
-Convert amounts to their value in default valuation commodity using
-current market prices (as of when report is generated).
-.TP
-\f[B]\f[CB]--value=YYYY-MM-DD\f[B]\f[R]
-Convert amounts to their value in default valuation commodity using
-market prices on this date.
-.PP
-The default valuation commodity is the commodity mentioned in the most
-recent applicable market price declaration.
-When all your price declarations lead to a single home currency, this
-will usually do what you want.
-.PP
-To select a different valuation commodity, add the optional
-\f[C],COMM\f[R] part: a comma, then the target commodity\[aq]s symbol.
-Eg: \f[B]\f[CB]--value=now,EUR\f[B]\f[R].
-hledger will do its best to convert amounts to this commodity, using:
-.IP \[bu] 2
-declared prices (from source commodity to valuation commodity)
-.IP \[bu] 2
-reverse prices (declared prices from valuation to source commodity,
-inverted)
-.IP \[bu] 2
-indirect prices (prices calculated from the shortest chain of declared
-or reverse prices from source to valuation commodity)
-.PP
-in that order.
-.PP
-Here are some examples showing the effect of \f[C]--value\f[R] as seen
-with \f[C]print\f[R]:
-.IP
-.nf
-\f[C]
-P 2000-01-01 A  1 B
-P 2000-02-01 A  2 B
-P 2000-03-01 A  3 B
-P 2000-04-01 A  4 B
-
-2000-01-01
-  (a)      1 A \[at] 5 B
-
-2000-02-01
-  (a)      1 A \[at] 6 B
-
-2000-03-01
-  (a)      1 A \[at] 7 B
-\f[R]
-.fi
-.PP
-Show the cost of each posting:
-.IP
-.nf
-\f[C]
-$ hledger -f- print --value=cost
-2000/01/01
-    (a)             5 B
-
-2000/02/01
-    (a)             6 B
-
-2000/03/01
-    (a)             7 B
-\f[R]
-.fi
-.PP
-Show the value as of the last day of the report period (2000-02-29):
-.IP
-.nf
-\f[C]
-$ hledger -f- print --value=end date:2000/01-2000/03
-2000-01-01
-    (a)             2 B
-
-2000-02-01
-    (a)             2 B
-\f[R]
-.fi
-.PP
-With no report period specified, that shows the value as of the last day
-of the journal (2000-03-01):
-.IP
-.nf
-\f[C]
-$ hledger -f- print --value=end
-2000/01/01
-    (a)             3 B
-
-2000/02/01
-    (a)             3 B
-
-2000/03/01
-    (a)             3 B
-\f[R]
-.fi
-.PP
-Show the current value (the 2000-04-01 price is still in effect today):
-.IP
-.nf
-\f[C]
-$ hledger -f- print --value=now
-2000-01-01
-    (a)             4 B
-
-2000-02-01
-    (a)             4 B
-
-2000-03-01
-    (a)             4 B
-\f[R]
-.fi
-.PP
-Show the value on 2000/01/15:
-.IP
-.nf
-\f[C]
-$ hledger -f- print --value=2000-01-15
-2000/01/01
-    (a)             1 B
-
-2000/02/01
-    (a)             1 B
-
-2000/03/01
-    (a)             1 B
-\f[R]
-.fi
-.PP
-You may need to explicitly set a commodity\[aq]s display style, when
-reverse prices are used.
-Eg this output might be surprising:
-.IP
-.nf
-\f[C]
-P 2000-01-01 A 2B
-
-2000-01-01
-  a  1B
-  b
-\f[R]
-.fi
-.IP
-.nf
-\f[C]
-$ hledger print -x -X A
-2000/01/01
-    a               0
-    b               0
-\f[R]
-.fi
-.PP
-Explanation: because there\[aq]s no amount or commodity directive
-specifying a display style for A, 0.5A gets the default style, which
-shows no decimal digits.
-Because the displayed amount looks like zero, the commodity symbol and
-minus sign are not displayed either.
-Adding a commodity directive sets a more useful display style for A:
-.IP
-.nf
-\f[C]
-P 2000-01-01 A 2B
-commodity 0.00A
-
-2000-01-01
-  a  1B
-  b
-\f[R]
-.fi
-.IP
-.nf
-\f[C]
-$ hledger print -X A
-2000/01/01
-    a           0.50A
-    b          -0.50A
-\f[R]
-.fi
-.SS Effect of --value on reports
-.PP
-Here is a reference for how \f[C]--value\f[R] currently affects each
-part of hledger\[aq]s reports.
-It\[aq]s work in progress, but may be useful for troubleshooting or
-reporting bugs.
-See also the definitions and notes below.
-If you find problems, please report them, ideally with a reproducible
-example.
-Related: #329, #1083.
-.PP
-.TS
-tab(@);
-lw(14.4n) lw(13.8n) lw(14.6n) lw(15.2n) lw(12.0n).
-T{
-Report type
-T}@T{
-\f[C]-B\f[R], \f[C]--value=cost\f[R]
-T}@T{
-\f[C]-V\f[R], \f[C]-X\f[R]
-T}@T{
-\f[C]--value=end\f[R]
-T}@T{
-\f[C]--value=DATE\f[R], \f[C]--value=now\f[R]
-T}
-_
-T{
-\f[B]print\f[R]
-T}@T{
-T}@T{
-T}@T{
-T}@T{
-T}
-T{
-posting amounts
-T}@T{
-cost
-T}@T{
-value at report end or today
-T}@T{
-value at report or journal end
-T}@T{
-value at DATE/today
-T}
-T{
-balance assertions / assignments
-T}@T{
-unchanged
-T}@T{
-unchanged
-T}@T{
-unchanged
-T}@T{
-unchanged
-T}
-T{
-T}@T{
-T}@T{
-T}@T{
-T}@T{
-T}
-T{
-\f[B]register\f[R]
-T}@T{
-T}@T{
-T}@T{
-T}@T{
-T}
-T{
-starting balance (with -H)
-T}@T{
-cost
-T}@T{
-value at day before report or journal start
-T}@T{
-value at day before report or journal start
-T}@T{
-value at DATE/today
-T}
-T{
-posting amounts (no report interval)
-T}@T{
-cost
-T}@T{
-value at report end or today
-T}@T{
-value at report or journal end
-T}@T{
-value at DATE/today
-T}
-T{
-summary posting amounts (with report interval)
-T}@T{
-summarised cost
-T}@T{
-value at period ends
-T}@T{
-value at period ends
-T}@T{
-value at DATE/today
-T}
-T{
-running total/average
-T}@T{
-sum/average of displayed values
-T}@T{
-sum/average of displayed values
-T}@T{
-sum/average of displayed values
-T}@T{
-sum/average of displayed values
-T}
-T{
-T}@T{
-T}@T{
-T}@T{
-T}@T{
-T}
-T{
-\f[B]balance (bs, bse, cf, is..)\f[R]
-T}@T{
-T}@T{
-T}@T{
-T}@T{
-T}
-T{
-balances (no report interval)
-T}@T{
-sums of costs
-T}@T{
-value at report end or today of sums of postings
-T}@T{
-value at report or journal end of sums of postings
-T}@T{
-value at DATE/today of sums of postings
-T}
-T{
-balances (with report interval)
-T}@T{
-sums of costs
-T}@T{
-value at period ends of sums of postings
-T}@T{
-value at period ends of sums of postings
-T}@T{
-value at DATE/today of sums of postings
-T}
-T{
-starting balances (with report interval and -H)
-T}@T{
-sums of costs of postings before report start
-T}@T{
-sums of postings before report start
-T}@T{
-sums of postings before report start
-T}@T{
-sums of postings before report start
-T}
-T{
-budget amounts with --budget
-T}@T{
-like balances
-T}@T{
-like balances
-T}@T{
-like balances
-T}@T{
-like balances
-T}
-T{
-grand total (no report interval)
-T}@T{
-sum of displayed values
-T}@T{
-sum of displayed values
-T}@T{
-sum of displayed values
-T}@T{
-sum of displayed values
-T}
-T{
-row totals/averages (with report interval)
-T}@T{
-sums/averages of displayed values
-T}@T{
-sums/averages of displayed values
-T}@T{
-sums/averages of displayed values
-T}@T{
-sums/averages of displayed values
-T}
-T{
-column totals
-T}@T{
-sums of displayed values
-T}@T{
-sums of displayed values
-T}@T{
-sums of displayed values
-T}@T{
-sums of displayed values
-T}
-T{
-grand total/average
-T}@T{
-sum/average of column totals
-T}@T{
-sum/average of column totals
-T}@T{
-sum/average of column totals
-T}@T{
-sum/average of column totals
-T}
-T{
-T}@T{
-T}@T{
-T}@T{
-T}@T{
-T}
-.TE
-.PP
-\f[B]Additional notes\f[R]
-.TP
-\f[I]cost\f[R]
-calculated using price(s) recorded in the transaction(s).
-.TP
-\f[I]value\f[R]
-market value using available market price declarations, or the unchanged
-amount if no conversion rate can be found.
-.TP
-\f[I]report start\f[R]
-the first day of the report period specified with -b or -p or date:,
-otherwise today.
-.TP
-\f[I]report or journal start\f[R]
-the first day of the report period specified with -b or -p or date:,
-otherwise the earliest transaction date in the journal, otherwise today.
-.TP
-\f[I]report end\f[R]
-the last day of the report period specified with -e or -p or date:,
-otherwise today.
-.TP
-\f[I]report or journal end\f[R]
-the last day of the report period specified with -e or -p or date:,
-otherwise the latest transaction date in the journal, otherwise today.
-.TP
-\f[I]report interval\f[R]
-a flag (-D/-W/-M/-Q/-Y) or period expression that activates the
-report\[aq]s multi-period mode (whether showing one or many subperiods).
-.SS Combining -B, -V, -X, --value
-.PP
-The rightmost of these flags wins.
-.SS Output destination
-.PP
-Some commands (print, register, stats, the balance commands) can write
-their output to a destination other than the console.
-This is controlled by the \f[C]-o/--output-file\f[R] option.
-.IP
-.nf
-\f[C]
-$ hledger balance -o -     # write to stdout (the default)
-$ hledger balance -o FILE  # write to FILE
-\f[R]
-.fi
-.SS Output format
-.PP
-Some commands can write their output in other formats.
-Eg print and register can output CSV, and the balance commands can
-output CSV or HTML.
-This is controlled by the \f[C]-O/--output-format\f[R] option, or by
-specifying a \f[C].csv\f[R] or \f[C].html\f[R] file extension with
-\f[C]-o/--output-file\f[R].
-.IP
-.nf
-\f[C]
-$ hledger balance -O csv       # write CSV to stdout
-$ hledger balance -o FILE.csv  # write CSV to FILE.csv
-\f[R]
-.fi
-.SS Regular expressions
-.PP
-hledger uses regular expressions in a number of places:
-.IP \[bu] 2
-query terms, on the command line and in the hledger-web search form:
-\f[C]REGEX\f[R], \f[C]desc:REGEX\f[R], \f[C]cur:REGEX\f[R],
-\f[C]tag:...=REGEX\f[R]
-.IP \[bu] 2
-CSV rules conditional blocks: \f[C]if REGEX ...\f[R]
-.IP \[bu] 2
-account alias directives and options:
-\f[C]alias /REGEX/ = REPLACEMENT\f[R],
-\f[C]--alias /REGEX/=REPLACEMENT\f[R]
-.PP
-hledger\[aq]s regular expressions come from the regex-tdfa library.
-In general they:
-.IP \[bu] 2
-are case insensitive
-.IP \[bu] 2
-are infix matching (do not need to match the entire thing being matched)
-.IP \[bu] 2
-are POSIX extended regular expressions
-.IP \[bu] 2
-also support GNU word boundaries (\[rs]<, \[rs]>, \[rs]b, \[rs]B)
-.IP \[bu] 2
-and parenthesised capturing groups and numeric backreferences in
-replacement strings
-.IP \[bu] 2
-do not support mode modifiers like (?s)
-.PP
-Some things to note:
-.IP \[bu] 2
-In the \f[C]alias\f[R] directive and \f[C]--alias\f[R] option, regular
-expressions must be enclosed in forward slashes (\f[C]/REGEX/\f[R]).
-Elsewhere in hledger, these are not required.
-.IP \[bu] 2
-In queries, to match a regular expression metacharacter like \f[C]$\f[R]
-as a literal character, prepend a backslash.
-Eg to search for amounts with the dollar sign in hledger-web, write
-\f[C]cur:\[rs]$\f[R].
-.IP \[bu] 2
-On the command line, some metacharacters like \f[C]$\f[R] have a special
-meaning to the shell and so must be escaped at least once more.
-See Special characters.
-.SH QUERIES
-.PP
-One of hledger\[aq]s strengths is being able to quickly report on
-precise subsets of your data.
-Most commands accept an optional query expression, written as arguments
-after the command name, to filter the data by date, account name or
-other criteria.
-The syntax is similar to a web search: one or more space-separated
-search terms, quotes to enclose whitespace, prefixes to match specific
-fields, a not: prefix to negate the match.
-.PP
-We do not yet support arbitrary boolean combinations of search terms;
-instead most commands show transactions/postings/accounts which match
-(or negatively match):
-.IP \[bu] 2
-any of the description terms AND
-.IP \[bu] 2
-any of the account terms AND
-.IP \[bu] 2
-any of the status terms AND
-.IP \[bu] 2
-all the other terms.
-.PP
-The print command instead shows transactions which:
-.IP \[bu] 2
-match any of the description terms AND
-.IP \[bu] 2
-have any postings matching any of the positive account terms AND
-.IP \[bu] 2
-have no postings matching any of the negative account terms AND
-.IP \[bu] 2
-match all the other terms.
-.PP
-The following kinds of search terms can be used.
-Remember these can also be prefixed with \f[B]\f[CB]not:\f[B]\f[R], eg
-to exclude a particular subaccount.
-.TP
-\f[B]\f[R]\f[C]REGEX\f[R]\f[B], \f[R]\f[C]acct:REGEX\f[R]\f[B]\f[R]
-match account names by this regular expression.
-(With no prefix, \f[C]acct:\f[R] is assumed.)
-same as above
-.TP
-\f[B]\f[R]\f[C]amt:N, amt:<N, amt:<=N, amt:>N, amt:>=N\f[R]\f[B]\f[R]
-match postings with a single-commodity amount that is equal to, less
-than, or greater than N.
-(Multi-commodity amounts are not tested, and will always match.) The
-comparison has two modes: if N is preceded by a + or - sign (or is 0),
-the two signed numbers are compared.
-Otherwise, the absolute magnitudes are compared, ignoring sign.
-.TP
-\f[B]\f[R]\f[C]code:REGEX\f[R]\f[B]\f[R]
-match by transaction code (eg check number)
-.TP
-\f[B]\f[R]\f[C]cur:REGEX\f[R]\f[B]\f[R]
-match postings or transactions including any amounts whose
-currency/commodity symbol is fully matched by REGEX.
-(For a partial match, use \f[C].*REGEX.*\f[R]).
-Note, to match characters which are regex-significant, like the dollar
-sign (\f[C]$\f[R]), you need to prepend \f[C]\[rs]\f[R].
-And when using the command line you need to add one more level of
-quoting to hide it from the shell, so eg do:
-\f[C]hledger print cur:\[aq]\[rs]$\[aq]\f[R] or
-\f[C]hledger print cur:\[rs]\[rs]$\f[R].
-.TP
-\f[B]\f[R]\f[C]desc:REGEX\f[R]\f[B]\f[R]
-match transaction descriptions.
-.TP
-\f[B]\f[R]\f[C]date:PERIODEXPR\f[R]\f[B]\f[R]
-match dates within the specified period.
-PERIODEXPR is a period expression (with no report interval).
-Examples: \f[C]date:2016\f[R], \f[C]date:thismonth\f[R],
-\f[C]date:2000/2/1-2/15\f[R], \f[C]date:lastweek-\f[R].
-If the \f[C]--date2\f[R] command line flag is present, this matches
-secondary dates instead.
-.TP
-\f[B]\f[R]\f[C]date2:PERIODEXPR\f[R]\f[B]\f[R]
-match secondary dates within the specified period.
-.TP
-\f[B]\f[R]\f[C]depth:N\f[R]\f[B]\f[R]
-match (or display, depending on command) accounts at or above this depth
-.TP
-\f[B]\f[R]\f[C]note:REGEX\f[R]\f[B]\f[R]
-match transaction notes (part of description right of \f[C]|\f[R], or
-whole description when there\[aq]s no \f[C]|\f[R])
-.TP
-\f[B]\f[R]\f[C]payee:REGEX\f[R]\f[B]\f[R]
-match transaction payee/payer names (part of description left of
-\f[C]|\f[R], or whole description when there\[aq]s no \f[C]|\f[R])
-.TP
-\f[B]\f[R]\f[C]real:, real:0\f[R]\f[B]\f[R]
-match real or virtual postings respectively
-.TP
-\f[B]\f[R]\f[C]status:, status:!, status:*\f[R]\f[B]\f[R]
-match unmarked, pending, or cleared transactions respectively
-.TP
-\f[B]\f[R]\f[C]tag:REGEX[=REGEX]\f[R]\f[B]\f[R]
-match by tag name, and optionally also by tag value.
-Note a tag: query is considered to match a transaction if it matches any
-of the postings.
-Also remember that postings inherit the tags of their parent
-transaction.
-.PP
-The following special search term is used automatically in hledger-web,
-only:
-.TP
-\f[B]\f[R]\f[C]inacct:ACCTNAME\f[R]\f[B]\f[R]
-tells hledger-web to show the transaction register for this account.
-Can be filtered further with \f[C]acct\f[R] etc.
-.PP
-Some of these can also be expressed as command-line options (eg
-\f[C]depth:2\f[R] is equivalent to \f[C]--depth 2\f[R]).
-Generally you can mix options and query arguments, and the resulting
-query will be their intersection (perhaps excluding the
-\f[C]-p/--period\f[R] option).
-.SH COMMANDS
-.PP
-hledger provides a number of subcommands; \f[C]hledger\f[R] with no
-arguments shows a list.
-.PP
-If you install additional \f[C]hledger-*\f[R] packages, or if you put
-programs or scripts named \f[C]hledger-NAME\f[R] in your PATH, these
-will also be listed as subcommands.
-.PP
-Run a subcommand by writing its name as first argument (eg
-\f[C]hledger incomestatement\f[R]).
-You can also write one of the standard short aliases displayed in
-parentheses in the command list (\f[C]hledger b\f[R]), or any any
-unambiguous prefix of a command name (\f[C]hledger inc\f[R]).
-.PP
-Here are all the builtin commands in alphabetical order.
-See also \f[C]hledger\f[R] for a more organised command list, and
-\f[C]hledger CMD -h\f[R] for detailed command help.
-.SS accounts
-.PP
-accounts, a
-.PD 0
-.P
-.PD
-Show account names.
-.PP
-This command lists account names, either declared with account
-directives (--declared), posted to (--used), or both (the default).
-With query arguments, only matched account names and account names
-referenced by matched postings are shown.
-It shows a flat list by default.
-With \f[C]--tree\f[R], it uses indentation to show the account
-hierarchy.
-In flat mode you can add \f[C]--drop N\f[R] to omit the first few
-account name components.
-Account names can be depth-clipped with \f[C]depth:N\f[R] or
-\f[C]--depth N\f[R] or \f[C]-N\f[R].
-.PP
-Examples:
-.IP
-.nf
-\f[C]
-$ hledger accounts
-assets:bank:checking
-assets:bank:saving
-assets:cash
-expenses:food
-expenses:supplies
-income:gifts
-income:salary
-liabilities:debts
-\f[R]
-.fi
-.SS activity
-.PP
-activity
-.PD 0
-.P
-.PD
-Show an ascii barchart of posting counts per interval.
-.PP
-The activity command displays an ascii histogram showing transaction
-counts by day, week, month or other reporting interval (by day is the
-default).
-With query arguments, it counts only matched transactions.
-.PP
-Examples:
-.IP
-.nf
-\f[C]
-$ hledger activity --quarterly
-2008-01-01 **
-2008-04-01 *******
-2008-07-01 
-2008-10-01 **
-\f[R]
-.fi
-.SS add
-.PP
-add
-.PD 0
-.P
-.PD
-Prompt for transactions and add them to the journal.
-.PP
-Many hledger users edit their journals directly with a text editor, or
-generate them from CSV.
-For more interactive data entry, there is the \f[C]add\f[R] command,
-which prompts interactively on the console for new transactions, and
-appends them to the journal file (if there are multiple
-\f[C]-f FILE\f[R] options, the first file is used.) Existing
-transactions are not changed.
-This is the only hledger command that writes to the journal file.
-.PP
-To use it, just run \f[C]hledger add\f[R] and follow the prompts.
-You can add as many transactions as you like; when you are finished,
-enter \f[C].\f[R] or press control-d or control-c to exit.
-.PP
-Features:
-.IP \[bu] 2
-add tries to provide useful defaults, using the most similar (by
-description) recent transaction (filtered by the query, if any) as a
-template.
-.IP \[bu] 2
-You can also set the initial defaults with command line arguments.
-.IP \[bu] 2
-Readline-style edit keys can be used during data entry.
-.IP \[bu] 2
-The tab key will auto-complete whenever possible - accounts,
-descriptions, dates (\f[C]yesterday\f[R], \f[C]today\f[R],
-\f[C]tomorrow\f[R]).
-If the input area is empty, it will insert the default value.
-.IP \[bu] 2
-If the journal defines a default commodity, it will be added to any bare
-numbers entered.
-.IP \[bu] 2
-A parenthesised transaction code may be entered following a date.
-.IP \[bu] 2
-Comments and tags may be entered following a description or amount.
-.IP \[bu] 2
-If you make a mistake, enter \f[C]<\f[R] at any prompt to restart the
-transaction.
-.IP \[bu] 2
-Input prompts are displayed in a different colour when the terminal
-supports it.
-.PP
-Example (see the tutorial for a detailed explanation):
-.IP
-.nf
-\f[C]
-$ hledger add
-Adding transactions to journal file /src/hledger/examples/sample.journal
-Any command line arguments will be used as defaults.
-Use tab key to complete, readline keys to edit, enter to accept defaults.
-An optional (CODE) may follow transaction dates.
-An optional ; COMMENT may follow descriptions or amounts.
-If you make a mistake, enter < at any prompt to restart the transaction.
-To end a transaction, enter . when prompted.
-To quit, enter . at a date prompt or press control-d or control-c.
-Date [2015/05/22]: 
-Description: supermarket
-Account 1: expenses:food
-Amount  1: $10
-Account 2: assets:checking
-Amount  2 [$-10.0]: 
-Account 3 (or . or enter to finish this transaction): .
-2015/05/22 supermarket
-    expenses:food             $10
-    assets:checking        $-10.0
-
-Save this transaction to the journal ? [y]: 
-Saved.
-Starting the next transaction (. or ctrl-D/ctrl-C to quit)
-Date [2015/05/22]: <CTRL-D> $
-\f[R]
-.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).
-.SS balance
-.PP
-balance, bal, b
-.PD 0
-.P
-.PD
-Show accounts and their balances.
-.PP
-The balance command is hledger\[aq]s most versatile command.
-Note, despite the name, it is not always used for showing real-world
-account balances; the more accounting-aware balancesheet and
-incomestatement may be more convenient for that.
-.PP
-By default, it displays all accounts, and each account\[aq]s change in
-balance during the entire period of the journal.
-Balance changes are calculated by adding up the postings in each
-account.
-You can limit the postings matched, by a query, to see fewer accounts,
-changes over a different time period, changes from only cleared
-transactions, etc.
-.PP
-If you include an account\[aq]s complete history of postings in the
-report, the balance change is equivalent to the account\[aq]s current
-ending balance.
-For a real-world account, typically you won\[aq]t have all transactions
-in the journal; instead you\[aq]ll have all transactions after a certain
-date, and an \[dq]opening balances\[dq] transaction setting the correct
-starting balance on that date.
-Then the balance command will show real-world account balances.
-In some cases the -H/--historical flag is used to ensure this (more
-below).
-.PP
-The balance command can produce several styles of report:
-.SS Classic balance report
-.PP
-This is the original balance report, as found in Ledger.
-It usually looks like this:
-.IP
-.nf
-\f[C]
-$ hledger balance
-                 $-1  assets
-                  $1    bank:saving
-                 $-2    cash
-                  $2  expenses
-                  $1    food
-                  $1    supplies
-                 $-2  income
-                 $-1    gifts
-                 $-1    salary
-                  $1  liabilities:debts
---------------------
-                   0
-\f[R]
-.fi
-.PP
-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 \f[C]-S/--sort-amount\f[R], by their balance amount.
-.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
-compact output.
-(Eg above, the \[dq]liabilities\[dq] account.) Use \f[C]--no-elide\f[R]
-to prevent this.
-.PP
-Account balances are \[dq]inclusive\[dq] - they include the balances of
-any subaccounts.
-.PP
-Accounts which have zero balance (and no non-zero subaccounts) are
-omitted.
-Use \f[C]-E/--empty\f[R] to show them.
-.PP
-A final total is displayed by default; use \f[C]-N/--no-total\f[R] to
-suppress it, eg:
-.IP
-.nf
-\f[C]
-$ hledger balance -p 2008/6 expenses --no-total
-                  $2  expenses
-                  $1    food
-                  $1    supplies
-\f[R]
-.fi
-.SS Customising the classic balance report
-.PP
-You can customise the layout of classic balance reports with
-\f[C]--format FMT\f[R]:
-.IP
-.nf
-\f[C]
-$ hledger balance --format \[dq]%20(account) %12(total)\[dq]
-              assets          $-1
-         bank:saving           $1
-                cash          $-2
-            expenses           $2
-                food           $1
-            supplies           $1
-              income          $-2
-               gifts          $-1
-              salary          $-1
-   liabilities:debts           $1
----------------------------------
-                                0
-\f[R]
-.fi
-.PP
-The FMT format string (plus a newline) specifies the formatting applied
-to each account/balance pair.
-It may contain any suitable text, with data fields interpolated like so:
-.PP
-\f[C]%[MIN][.MAX](FIELDNAME)\f[R]
-.IP \[bu] 2
-MIN pads with spaces to at least this width (optional)
-.IP \[bu] 2
-MAX truncates at this width (optional)
-.IP \[bu] 2
-FIELDNAME must be enclosed in parentheses, and can be one of:
-.RS 2
-.IP \[bu] 2
-\f[C]depth_spacer\f[R] - a number of spaces equal to the account\[aq]s
-depth, or if MIN is specified, MIN * depth spaces.
-.IP \[bu] 2
-\f[C]account\f[R] - the account\[aq]s name
-.IP \[bu] 2
-\f[C]total\f[R] - the account\[aq]s balance/posted total, right
-justified
-.RE
-.PP
-Also, FMT can begin with an optional prefix to control how
-multi-commodity amounts are rendered:
-.IP \[bu] 2
-\f[C]%_\f[R] - render on multiple lines, bottom-aligned (the default)
-.IP \[bu] 2
-\f[C]%\[ha]\f[R] - render on multiple lines, top-aligned
-.IP \[bu] 2
-\f[C]%,\f[R] - render on one line, comma-separated
-.PP
-There are some quirks.
-Eg in one-line mode, \f[C]%(depth_spacer)\f[R] has no effect, instead
-\f[C]%(account)\f[R] has indentation built in.
-Experimentation may be needed to get pleasing results.
-.PP
-Some example formats:
-.IP \[bu] 2
-\f[C]%(total)\f[R] - the account\[aq]s total
-.IP \[bu] 2
-\f[C]%-20.20(account)\f[R] - the account\[aq]s name, left justified,
-padded to 20 characters and clipped at 20 characters
-.IP \[bu] 2
-\f[C]%,%-50(account)  %25(total)\f[R] - account name padded to 50
-characters, total padded to 20 characters, with multiple commodities
-rendered on one line
-.IP \[bu] 2
-\f[C]%20(total)  %2(depth_spacer)%-(account)\f[R] - the default format
-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
-.SS Flat mode
-.PP
-To see a flat list instead of the default hierarchical display, use
-\f[C]--flat\f[R].
-In this mode, accounts (unless depth-clipped) show their full names and
-\[dq]exclusive\[dq] balance, excluding any subaccount balances.
-In this mode, you can also use \f[C]--drop N\f[R] to omit the first few
-account name components.
-.IP
-.nf
-\f[C]
-$ hledger balance -p 2008/6 expenses -N --flat --drop 1
-                  $1  food
-                  $1  supplies
-\f[R]
-.fi
-.SS Depth limited balance reports
-.PP
-With \f[C]--depth N\f[R] or \f[C]depth:N\f[R] or just \f[C]-N\f[R],
-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.
-.IP
-.nf
-\f[C]
-$ hledger balance -N -1
-                 $-1  assets
-                  $2  expenses
-                 $-2  income
-                  $1  liabilities
-\f[R]
-.fi
-.PP
-Flat-mode balance reports, which normally show exclusive balances, show
-inclusive balances at the depth limit.
-.SS Percentages
-.PP
-With \f[C]-%\f[R] or \f[C]--percent\f[R], balance reports show each
-account\[aq]s value expressed as a percentage of the column\[aq]s total.
-This is useful to get an overview of the relative sizes of account
-balances.
-For example to obtain an overview of expenses:
-.IP
-.nf
-\f[C]
-$ hledger balance expenses -%
-             100.0 %  expenses
-              50.0 %    food
-              50.0 %    supplies
---------------------
-             100.0 %
-\f[R]
-.fi
-.PP
-Note that \f[C]--tree\f[R] does not have an effect on \f[C]-%\f[R].
-The percentages are always relative to the total sum of each column,
-they are never relative to the parent account.
-.PP
-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
-\f[C]hledger balance -B\f[R]) all percentage values will be zero.
-.PP
-This flag does not work if the report contains any mixed commodity
-accounts.
-If there are mixed commodity accounts in the report be sure to use
-\f[C]-V\f[R] or \f[C]-B\f[R] to coerce the report into using a single
-commodity.
-.SS Multicolumn balance report
-.PP
-Multicolumn or tabular balance reports are a very useful hledger
-feature, and usually the preferred style.
-They share many of the above features, but they show the report as a
-table, with columns representing time periods.
-This mode is activated by providing a reporting interval.
-.PP
-There are three types of multicolumn balance report, showing different
-information:
-.IP "1." 3
-By default: each column shows the sum of postings in that period, ie the
-account\[aq]s change of balance in that period.
-This is useful eg for a monthly income statement:
-.RS 4
-.IP
-.nf
-\f[C]
-$ hledger balance --quarterly income expenses -E
-Balance changes in 2008:
-
-                   ||  2008q1  2008q2  2008q3  2008q4 
-===================++=================================
- expenses:food     ||       0      $1       0       0 
- expenses:supplies ||       0      $1       0       0 
- income:gifts      ||       0     $-1       0       0 
- income:salary     ||     $-1       0       0       0 
--------------------++---------------------------------
-                   ||     $-1      $1       0       0 
-\f[R]
-.fi
-.RE
-.IP "2." 3
-With \f[C]--cumulative\f[R]: each column shows the ending balance for
-that period, accumulating the changes across periods, starting from 0 at
-the report start date:
-.RS 4
-.IP
-.nf
-\f[C]
-$ hledger balance --quarterly income expenses -E --cumulative
-Ending balances (cumulative) in 2008:
-
-                   ||  2008/03/31  2008/06/30  2008/09/30  2008/12/31 
-===================++=================================================
- expenses:food     ||           0          $1          $1          $1 
- expenses:supplies ||           0          $1          $1          $1 
- income:gifts      ||           0         $-1         $-1         $-1 
- income:salary     ||         $-1         $-1         $-1         $-1 
--------------------++-------------------------------------------------
-                   ||         $-1           0           0           0 
-\f[R]
-.fi
-.RE
-.IP "3." 3
-With \f[C]--historical/-H\f[R]: 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 useful eg for a multi-period balance sheet, and when you are
-showing only the data after a certain start date:
-.RS 4
-.IP
-.nf
-\f[C]
-$ hledger balance \[ha]assets \[ha]liabilities --quarterly --historical --begin 2008/4/1
-Ending balances (historical) in 2008/04/01-2008/12/31:
-
-                      ||  2008/06/30  2008/09/30  2008/12/31 
-======================++=====================================
- assets:bank:checking ||          $1          $1           0 
- assets:bank:saving   ||          $1          $1          $1 
- assets:cash          ||         $-2         $-2         $-2 
- liabilities:debts    ||           0           0          $1 
-----------------------++-------------------------------------
-                      ||           0           0           0 
-\f[R]
-.fi
-.RE
-.PP
-Note that \f[C]--cumulative\f[R] or \f[C]--historical/-H\f[R] disable
-\f[C]--row-total/-T\f[R], since summing end balances generally does not
-make sense.
-.PP
-Multicolumn balance reports display accounts in flat mode by default; to
-see the hierarchy, use \f[C]--tree\f[R].
-.PP
-With a reporting interval (like \f[C]--quarterly\f[R] 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 periods will be \[dq]full\[dq] and
-comparable to the others.
-.PP
-The \f[C]-E/--empty\f[R] flag does two things in multicolumn balance
-reports: first, the report will show all columns within the specified
-report period (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).
-.PP
-The \f[C]-T/--row-total\f[R] flag adds an additional column showing the
-total for each row.
-.PP
-The \f[C]-A/--average\f[R] flag adds a column showing the average value
-in each row.
-.PP
-Here\[aq]s an example of all three:
-.IP
-.nf
-\f[C]
-$ hledger balance -Q income expenses --tree -ETA
-Balance changes in 2008:
-
-            ||  2008q1  2008q2  2008q3  2008q4    Total  Average 
-============++===================================================
- expenses   ||       0      $2       0       0       $2       $1 
-   food     ||       0      $1       0       0       $1        0 
-   supplies ||       0      $1       0       0       $1        0 
- income     ||     $-1     $-1       0       0      $-2      $-1 
-   gifts    ||       0     $-1       0       0      $-1        0 
-   salary   ||     $-1       0       0       0      $-1        0 
-------------++---------------------------------------------------
-            ||     $-1      $1       0       0        0        0 
-
-# Average is rounded to the dollar here since all journal amounts are
-\f[R]
-.fi
-.PP
-Limitations:
-.PP
-In multicolumn reports the \f[C]-V/--value\f[R] flag uses the market
-price on the report end date, for all columns (not the price on each
-column\[aq]s end date).
-.PP
-Eliding of boring parent accounts in tree mode, as in the classic
-balance report, is not yet supported in multicolumn reports.
-.SS Budget report
-.PP
-With \f[C]--budget\f[R], 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 income, expenses,
-time usage, etc.
---budget is most often combined with a report interval.
-.PP
-For example, you can take average monthly expenses in the common expense
-categories to construct a minimal monthly budget:
-.IP
-.nf
-\f[C]
-;; Budget
-\[ti] monthly
-  income  $2000
-  expenses:food    $400
-  expenses:bus     $50
-  expenses:movies  $30
-  assets:bank:checking
-
-;; Two months worth of expenses
-2017-11-01
-  income  $1950
-  expenses:food    $396
-  expenses:bus     $49
-  expenses:movies  $30
-  expenses:supplies  $20
-  assets:bank:checking
-
-2017-12-01
-  income  $2100
-  expenses:food    $412
-  expenses:bus     $53
-  expenses:gifts   $100
-  assets:bank:checking
-\f[R]
-.fi
-.PP
-You can now see a monthly budget report:
-.IP
-.nf
-\f[C]
-$ hledger balance -M --budget
-Budget performance in 2017/11/01-2017/12/31:
-
-                      ||                      Nov                       Dec 
-======================++====================================================
- assets               || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
- assets:bank          || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
- assets:bank:checking || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
- expenses             ||   $495 [ 103% of   $480]    $565 [ 118% of   $480] 
- expenses:bus         ||    $49 [  98% of    $50]     $53 [ 106% of    $50] 
- expenses:food        ||   $396 [  99% of   $400]    $412 [ 103% of   $400] 
- expenses:movies      ||    $30 [ 100% of    $30]       0 [   0% of    $30] 
- income               ||  $1950 [  98% of  $2000]   $2100 [ 105% of  $2000] 
-----------------------++----------------------------------------------------
-                      ||      0 [              0]       0 [              0] 
-\f[R]
-.fi
-.PP
-Note this is different from a normal balance report in several ways:
-.IP \[bu] 2
-Only accounts with budget goals during the report period are shown, by
-default.
-.IP \[bu] 2
-In each column, in square brackets after the actual amount, budgeted
-amounts are shown, along with the percentage of budget used.
-.IP \[bu] 2
-All parent accounts are always shown, even in flat mode.
-Eg assets, assets:bank, and expenses above.
-.IP \[bu] 2
-Amounts always include all subaccounts, budgeted or unbudgeted, even in
-flat mode.
-.PP
-This means that the numbers displayed will not always add up! Eg above,
-the \f[C]expenses\f[R] actual amount includes the gifts and supplies
-transactions, but the \f[C]expenses:gifts\f[R] and
-\f[C]expenses:supplies\f[R] accounts are not shown, as they have no
-budget amounts declared.
-.PP
-This can be confusing.
-When you need to make things clearer, use the \f[C]-E/--empty\f[R] flag,
-which will reveal all accounts including unbudgeted ones, giving the
-full picture.
-Eg:
-.IP
-.nf
-\f[C]
-$ hledger balance -M --budget --empty
-Budget performance in 2017/11/01-2017/12/31:
-
-                      ||                      Nov                       Dec 
-======================++====================================================
- assets               || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
- assets:bank          || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
- assets:bank:checking || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
- expenses             ||   $495 [ 103% of   $480]    $565 [ 118% of   $480] 
- expenses:bus         ||    $49 [  98% of    $50]     $53 [ 106% of    $50] 
- expenses:food        ||   $396 [  99% of   $400]    $412 [ 103% of   $400] 
- expenses:gifts       ||      0                      $100                   
- expenses:movies      ||    $30 [ 100% of    $30]       0 [   0% of    $30] 
- expenses:supplies    ||    $20                         0                   
- income               ||  $1950 [  98% of  $2000]   $2100 [ 105% of  $2000] 
-----------------------++----------------------------------------------------
-                      ||      0 [              0]       0 [              0] 
-\f[R]
-.fi
-.PP
-You can roll over unspent budgets to next period with
-\f[C]--cumulative\f[R]:
-.IP
-.nf
-\f[C]
-$ hledger balance -M --budget --cumulative
-Budget performance in 2017/11/01-2017/12/31:
-
-                      ||                      Nov                       Dec 
-======================++====================================================
- assets               || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960] 
- assets:bank          || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960] 
- assets:bank:checking || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960] 
- expenses             ||   $495 [ 103% of   $480]   $1060 [ 110% of   $960] 
- expenses:bus         ||    $49 [  98% of    $50]    $102 [ 102% of   $100] 
- expenses:food        ||   $396 [  99% of   $400]    $808 [ 101% of   $800] 
- expenses:movies      ||    $30 [ 100% of    $30]     $30 [  50% of    $60] 
- income               ||  $1950 [  98% of  $2000]   $4050 [ 101% of  $4000] 
-----------------------++----------------------------------------------------
-                      ||      0 [              0]       0 [              0] 
-\f[R]
-.fi
-.PP
-For more examples, see Budgeting and Forecasting.
-.SS Nested budgets
-.PP
-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 budget(s) of the child account(s) would be added to the budget of
-their parent, much like account balances behave.
-.PP
-In the most simple case this means that once you add a budget to any
-account, all its parents would have budget as well.
-.PP
-To illustrate this, consider the following budget:
-.IP
-.nf
-\f[C]
-\[ti] monthly from 2019/01
-    expenses:personal             $1,000.00
-    expenses:personal:electronics    $100.00
-    liabilities
-\f[R]
-.fi
-.PP
-With this, monthly budget for electronics is defined to be $100 and
-budget for personal expenses is an additional $1000, which implicity
-means that budget for both \f[C]expenses:personal\f[R] and
-\f[C]expenses\f[R] is $1100.
-.PP
-Transactions in \f[C]expenses:personal:electronics\f[R] will be counted
-both towards its $100 budget and $1100 of \f[C]expenses:personal\f[R] ,
-and transactions in any other subaccount of \f[C]expenses:personal\f[R]
-would be counted towards only towards the budget of
-\f[C]expenses:personal\f[R].
-.PP
-For example, let\[aq]s consider these transactions:
-.IP
-.nf
-\f[C]
-\[ti] monthly from 2019/01
-    expenses:personal             $1,000.00
-    expenses:personal:electronics    $100.00
-    liabilities
-
-2019/01/01 Google home hub
-    expenses:personal:electronics          $90.00
-    liabilities                           $-90.00
-
-2019/01/02 Phone screen protector
-    expenses:personal:electronics:upgrades          $10.00
-    liabilities
-
-2019/01/02 Weekly train ticket
-    expenses:personal:train tickets       $153.00
-    liabilities
-
-2019/01/03 Flowers
-    expenses:personal          $30.00
-    liabilities
-\f[R]
-.fi
-.PP
-As you can see, we have transactions in
-\f[C]expenses:personal:electronics:upgrades\f[R] and
-\f[C]expenses:personal:train tickets\f[R], and since both of these
-accounts are without explicitly defined budget, these transactions would
-be counted towards budgets of \f[C]expenses:personal:electronics\f[R]
-and \f[C]expenses:personal\f[R] accordingly:
-.IP
-.nf
-\f[C]
-$ hledger balance --budget -M
-Budget performance in 2019/01:
-
-                               ||                           Jan 
-===============================++===============================
- expenses                      ||  $283.00 [  26% of  $1100.00] 
- expenses:personal             ||  $283.00 [  26% of  $1100.00] 
- expenses:personal:electronics ||  $100.00 [ 100% of   $100.00] 
- liabilities                   || $-283.00 [  26% of $-1100.00] 
--------------------------------++-------------------------------
-                               ||        0 [                 0] 
-\f[R]
-.fi
-.PP
-And with \f[C]--empty\f[R], we can get a better picture of budget
-allocation and consumption:
-.IP
-.nf
-\f[C]
-$ hledger balance --budget -M --empty
-Budget performance in 2019/01:
-
-                                        ||                           Jan 
-========================================++===============================
- expenses                               ||  $283.00 [  26% of  $1100.00] 
- expenses:personal                      ||  $283.00 [  26% of  $1100.00] 
- expenses:personal:electronics          ||  $100.00 [ 100% of   $100.00] 
- expenses:personal:electronics:upgrades ||   $10.00                      
- expenses:personal:train tickets        ||  $153.00                      
- liabilities                            || $-283.00 [  26% of $-1100.00] 
-----------------------------------------++-------------------------------
-                                        ||        0 [                 0] 
-\f[R]
-.fi
-.SS Output format
-.PP
-The balance command supports output destination and output format
-selection.
-.SS balancesheet
-.PP
-balancesheet, bs
-.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).
-.PP
-Note this report shows all account balances with normal positive sign
-(like conventional financial statements, unlike balance/print/register)
-(experimental).
-.PP
-Example:
-.IP
-.nf
-\f[C]
-$ hledger balancesheet
-Balance Sheet
-
-Assets:
-                 $-1  assets
-                  $1    bank:saving
-                 $-2    cash
---------------------
-                 $-1
-
-Liabilities:
-                  $1  liabilities:debts
---------------------
-                  $1
-
-Total:
---------------------
-                   0
-\f[R]
-.fi
-.PP
-With a reporting interval, multiple columns will be shown, one for each
-report period.
-As with multicolumn balance reports, you can alter the report mode with
-\f[C]--change\f[R]/\f[C]--cumulative\f[R]/\f[C]--historical\f[R].
-Normally balancesheet shows historical ending balances, which is what
-you need for a balance sheet; note this means it ignores report begin
-dates (and \f[C]-T/--row-total\f[R], since summing end balances
-generally does not make sense).
-Instead of absolute values percentages can be displayed with
-\f[C]-%\f[R].
-.PP
-This command also supports output destination and output format
-selection.
-.SS balancesheetequity
-.PP
-balancesheetequity, bse
-.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).
-.PP
-Example:
-.IP
-.nf
-\f[C]
-$ hledger balancesheetequity
-Balance Sheet With Equity
-
-Assets:
-                 $-2  assets
-                  $1    bank:saving
-                 $-3    cash
---------------------
-                 $-2
-
-Liabilities:
-                  $1  liabilities:debts
---------------------
-                  $1
-
-Equity:
-          $1  equity:owner
---------------------
-          $1
-
-Total:
---------------------
-                   0
-\f[R]
-.fi
-.SS cashflow
-.PP
-cashflow, cf
-.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).
-.PP
-Example:
-.IP
-.nf
-\f[C]
-$ hledger cashflow
-Cashflow Statement
-
-Cash flows:
-                 $-1  assets
-                  $1    bank:saving
-                 $-2    cash
---------------------
-                 $-1
-
-Total:
---------------------
-                 $-1
-\f[R]
-.fi
-.PP
-With a reporting interval, multiple columns will be shown, one for each
-report period.
-Normally cashflow shows changes in assets per period, though as with
-multicolumn balance reports you can alter the report mode with
-\f[C]--change\f[R]/\f[C]--cumulative\f[R]/\f[C]--historical\f[R].
-Instead of absolute values percentages can be displayed with
-\f[C]-%\f[R].
-.PP
-This command also supports output destination and output format
-selection.
-.SS check-dates
-.PP
-check-dates
-.PD 0
-.P
-.PD
-Check that transactions are sorted by increasing date.
-With --date2, checks secondary dates instead.
-With --strict, dates must also be unique.
-With a query, only matched transactions\[aq] dates are checked.
-Reads the default journal file, or another specified with -f.
-.SS check-dupes
-.PP
-check-dupes
-.PD 0
-.P
-.PD
-Reports account names having the same leaf but different prefixes.
-In other words, two or more leaves that are categorized differently.
-Reads the default journal file, or another specified as an argument.
-.PP
-An example: http://stefanorodighiero.net/software/hledger-dupes.html
-.SS close
-.PP
-close, equity
-.PD 0
-.P
-.PD
-Prints a \[dq]closing balances\[dq] transaction and an \[dq]opening
-balances\[dq] transaction that bring account balances to and from zero,
-respectively.
-Useful for bringing asset/liability balances forward into a new journal
-file, or for closing out revenues/expenses to retained earnings at the
-end of a period.
-.PP
-The closing transaction transfers balances to \[dq]equity:closing
-balances\[dq], and the opening transaction transfers balances from
-\[dq]equity:opening balances\[dq], or you can customise these with the
-\f[C]--close-to\f[R] and \f[C]--open-from\f[R] options.
-You can choose to print just one of the transactions by using the
-\f[C]--opening\f[R] or \f[C]--closing\f[R] flag.
-.PP
-If you split your journal files by time (eg yearly), you will typically
-run this command at the end of the year, and save the closing
-transaction as last entry of the old file, and the opening transaction
-as the first entry of the new file.
-This makes the files self contained, so that correct balances are
-reported no matter which of them are loaded.
-Ie, if you load just one file, the balances are initialised correctly;
-or if you load several files, the redundant closing/opening transactions
-cancel each other out.
-(They will show up in print or register reports; you can exclude them
-with a query like
-\f[C]not:desc:\[aq](opening|closing) balances\[aq]\f[R].)
-.PP
-If you\[aq]re running a business, you might also use this command to
-\[dq]close the books\[dq] at the end of an accounting period,
-transferring income statement account balances to retained earnings.
-(You may want to change the equity account name to something like
-\[dq]equity:retained earnings\[dq].)
-.PP
-By default, the closing transaction is dated yesterday, the balances are
-calculated as of end of yesterday, and the opening transaction is dated
-today.
-To close on some other date, use:
-\f[C]hledger close -e OPENINGDATE\f[R].
-Eg, to close/open on the 2018/2019 boundary, use \f[C]-e 2019\f[R].
-You can also use -p or \f[C]date:PERIOD\f[R] (any starting date is
-ignored).
-.PP
-Both transactions will include balance assertions for the
-closed/reopened accounts.
-You probably shouldn\[aq]t use status or realness filters (like -C or -R
-or \f[C]status:\f[R]) with this command, or the generated balance
-assertions will depend on these flags.
-Likewise, if you run this command with --auto, the balance assertions
-will probably always require --auto.
-.PP
-When account balances have cost information (transaction prices), the
-closing/opening transactions will preserve it, so that eg balance -B
-reports will not be affected.
-.PP
-Examples:
-.PP
-Carrying asset/liability balances into a new file for 2019, all from
-command line:
-.PP
-\f[I]Warning: we use \f[CI]>>\f[I] here to append; be careful not to
-type a single \f[CI]>\f[I] which would wipe your journal!\f[R]
-.IP
-.nf
-\f[C]
-$ hledger close -f 2018.journal -e 2019 assets liabilities --opening >>2019.journal
-$ hledger close -f 2018.journal -e 2019 assets liabilities --closing >>2018.journal
-\f[R]
-.fi
-.PP
-Now:
-.IP
-.nf
-\f[C]
-$ hledger bs -f 2019.journal                   # one file - balances are correct
-$ hledger bs -f 2018.journal -f 2019.journal   # two files - balances still correct
-$ hledger bs -f 2018.journal not:desc:closing  # to see year-end balances, must exclude closing txn
-\f[R]
-.fi
-.PP
-Transactions spanning the closing date can complicate matters, breaking
-balance assertions:
-.IP
-.nf
-\f[C]
-2018/12/30 a purchase made in 2018, clearing the following year
-    expenses:food          5
-    assets:bank:checking  -5  ; [2019/1/2]
-\f[R]
-.fi
-.PP
-Here\[aq]s one way to resolve that:
-.IP
-.nf
-\f[C]
-; in 2018.journal:
-2018/12/30 a purchase made in 2018, clearing the following year
-    expenses:food          5
-    liabilities:pending
-
-; in 2019.journal:
-2019/1/2 clearance of last year\[aq]s pending transactions
-    liabilities:pending    5 = 0
-    assets:checking
-\f[R]
-.fi
-.SS commodities
-.PP
-commodities
-.PD 0
-.P
-.PD
-List all commodity/currency symbols used or declared in the journal.
-.SS descriptions
-.PP
-descriptions Show descriptions.
-.PP
-This command lists all descriptions that appear in transactions.
-.PP
-Examples:
-.IP
-.nf
-\f[C]
-$ hledger descriptions
-Store Name
-Gas Station | Petrol
-Person A
-\f[R]
-.fi
-.SS diff
-.PP
-diff
-.PD 0
-.P
-.PD
-Compares a particular account\[aq]s transactions in two input files.
-It shows any transactions to this account which are in one file but not
-in the other.
-.PP
-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.) Since
-postings not transactions are compared, this also works when multiple
-bank transactions have been combined into a single journal entry.
-.PP
-This is useful eg if you have downloaded an account\[aq]s transactions
-from 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.
-.PP
-Examples:
-.IP
-.nf
-\f[C]
-$ hledger diff -f $LEDGER_FILE -f bank.csv assets:bank:giro 
-These transactions are in the first file only:
-
-2014/01/01 Opening Balances
-    assets:bank:giro              EUR ...
-    ...
-    equity:opening balances       EUR -...
-
-These transactions are in the second file only:
-\f[R]
-.fi
-.SS files
-.PP
-files
-.PD 0
-.P
-.PD
-List all files included in the journal.
-With a REGEX argument, only file names matching the regular expression
-(case sensitive) are shown.
-.SS help
-.PP
-help
-.PD 0
-.P
-.PD
-Show any of the hledger manuals.
-.PP
-The \f[C]help\f[R] 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.
-.PP
-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 \f[C]--info\f[R],
-\f[C]--man\f[R], \f[C]--pager\f[R], \f[C]--cat\f[R] flags.
-.PP
-Examples:
-.IP
-.nf
-\f[C]
-$ hledger help
-Please choose a manual by typing \[dq]hledger help MANUAL\[dq] (a substring is ok).
-Manuals: hledger hledger-ui hledger-web journal csv timeclock timedot
-\f[R]
-.fi
-.IP
-.nf
-\f[C]
-$ hledger help h --man
-
-hledger(1)                    hledger User Manuals                    hledger(1)
-
-NAME
-       hledger - a command-line accounting tool
-
-SYNOPSIS
-       hledger [-f FILE] COMMAND [OPTIONS] [ARGS]
-       hledger [-f FILE] ADDONCMD -- [OPTIONS] [ARGS]
-       hledger
-
-DESCRIPTION
-       hledger  is  a  cross-platform  program  for tracking money, time, or any
-\&...
-\f[R]
-.fi
-.SS import
-.PP
-import
-.PD 0
-.P
-.PD
-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 transactions that would be added.
-Or with --catchup, just mark all of the FILEs\[aq] transactions as
-imported, without actually importing any.
-.PP
-The input files are specified as arguments - no need to write -f before
-each one.
-So eg to add new transactions from all CSV files to the main journal,
-it\[aq]s just: \f[C]hledger import *.csv\f[R]
-.PP
-New transactions are detected in the same way as print --new: by
-assuming transactions are always added to the input files in increasing
-date order, and by saving \f[C].latest.FILE\f[R] state files.
-.PP
-The --dry-run output is in journal format, so you can filter it, eg to
-see only uncategorised transactions:
-.IP
-.nf
-\f[C]
-$ hledger import --dry ... | hledger -f- print unknown --ignore-assertions
-\f[R]
-.fi
-.SS Importing balance assignments
-.PP
-Entries added by import will have their posting amounts made explicit
-(like \f[C]hledger print -x\f[R]).
-This means that any balance assignments in imported files must be
-evaluated; but, imported files don\[aq]t get to see the main file\[aq]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 amounts.
-To avoid this problem, use print instead of import:
-.IP
-.nf
-\f[C]
-$ hledger print IMPORTFILE [--new] >> $LEDGER_FILE
-\f[R]
-.fi
-.PP
-(If you think import should leave amounts implicit like print does,
-please test it and send a pull request.)
-.SS incomestatement
-.PP
-incomestatement, is
-.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.)
-.IP
-.nf
-\f[C]
-$ hledger incomestatement
-Income Statement
-
-Revenues:
-                 $-2  income
-                 $-1    gifts
-                 $-1    salary
---------------------
-                 $-2
-
-Expenses:
-                  $2  expenses
-                  $1    food
-                  $1    supplies
---------------------
-                  $2
-
-Total:
---------------------
-                   0
-\f[R]
-.fi
-.PP
-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
-\f[C]--change\f[R]/\f[C]--cumulative\f[R]/\f[C]--historical\f[R].
-Instead of absolute values percentages can be displayed with
-\f[C]-%\f[R].
-.PP
-This command also supports output destination and output format
-selection.
-.SS notes
-.PP
-notes Show notes.
-.PP
-This command lists all notes that appear in transactions.
-.PP
-Examples:
-.IP
-.nf
-\f[C]
-$ hledger notes
-Petrol
-Snacks
-\f[R]
-.fi
-.SS payees
-.PP
-payees Show payee names.
-.PP
-This command lists all payee names that appear in transactions.
-.PP
-Examples:
-.IP
-.nf
-\f[C]
-$ hledger payees
-Store Name
-Gas Station
-Person A
-\f[R]
-.fi
-.SS prices
-.PP
-prices
-.PD 0
-.P
-.PD
-Print market price directives from the journal.
-With --costs, also print synthetic market prices based on transaction
-prices.
-With --inverted-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.
-.SS print
-.PP
-print, txns, p
-.PD 0
-.P
-.PD
-Show transaction journal entries, sorted by date.
-.PP
-The print command displays full journal entries (transactions) from the
-journal file in date order, tidily formatted.
-With --date2, transactions are sorted by secondary date instead.
-.PP
-print\[aq]s output is always a valid hledger journal.
-.PD 0
-.P
-.PD
-It preserves all transaction information, but it does not preserve
-directives or inter-transaction comments
-.IP
-.nf
-\f[C]
-$ hledger print
-2008/01/01 income
-    assets:bank:checking            $1
-    income:salary                  $-1
-
-2008/06/01 gift
-    assets:bank:checking            $1
-    income:gifts                   $-1
-
-2008/06/02 save
-    assets:bank:saving              $1
-    assets:bank:checking           $-1
-
-2008/06/03 * eat & shop
-    expenses:food                $1
-    expenses:supplies            $1
-    assets:cash                 $-2
-
-2008/12/31 * pay off
-    liabilities:debts               $1
-    assets:bank:checking           $-1
-\f[R]
-.fi
-.PP
-Normally, the journal entry\[aq]s explicit or implicit amount style is
-preserved.
-Ie when an amount is omitted in the journal, it will be omitted in the
-output.
-You can use the \f[C]-x\f[R]/\f[C]--explicit\f[R] flag to make all
-amounts explicit, which can be useful for troubleshooting or for making
-your journal more readable and robust against data entry errors.
-Note, \f[C]-x\f[R] will cause postings with a multi-commodity amount
-(these can arise when a multi-commodity transaction has an implicit
-amount) will be split into multiple single-commodity postings, for valid
-journal output.
-.PP
-With \f[C]-B\f[R]/\f[C]--cost\f[R], amounts with transaction prices are
-converted to cost using that price.
-This can be used for troubleshooting.
-.PP
-With \f[C]-m\f[R]/\f[C]--match\f[R] and a STR argument, print will show
-at most one transaction: 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.
-.PP
-With \f[C]--new\f[R], for each FILE being read, hledger reads (and
-writes) a special state file (\f[C].latest.FILE\f[R] 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 ignoring already-seen entries in import data, such as
-downloaded CSV files.
-Eg:
-.IP
-.nf
-\f[C]
-$ hledger -f bank1.csv print --new
-# shows transactions added since last print --new on this file
-\f[R]
-.fi
-.PP
-This assumes that transactions added to FILE always have same or
-increasing dates, and that transactions on the same day do not get
-reordered.
-See also the import command.
-.PP
-This command also supports output destination and output format
-selection.
-Here\[aq]s an example of print\[aq]s CSV output:
-.IP
-.nf
-\f[C]
-$ hledger print -Ocsv
-\[dq]txnidx\[dq],\[dq]date\[dq],\[dq]date2\[dq],\[dq]status\[dq],\[dq]code\[dq],\[dq]description\[dq],\[dq]comment\[dq],\[dq]account\[dq],\[dq]amount\[dq],\[dq]commodity\[dq],\[dq]credit\[dq],\[dq]debit\[dq],\[dq]posting-status\[dq],\[dq]posting-comment\[dq]
-\[dq]1\[dq],\[dq]2008/01/01\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]income\[dq],\[dq]\[dq],\[dq]assets:bank:checking\[dq],\[dq]1\[dq],\[dq]$\[dq],\[dq]\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq]
-\[dq]1\[dq],\[dq]2008/01/01\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]income\[dq],\[dq]\[dq],\[dq]income:salary\[dq],\[dq]-1\[dq],\[dq]$\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq]
-\[dq]2\[dq],\[dq]2008/06/01\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]gift\[dq],\[dq]\[dq],\[dq]assets:bank:checking\[dq],\[dq]1\[dq],\[dq]$\[dq],\[dq]\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq]
-\[dq]2\[dq],\[dq]2008/06/01\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]gift\[dq],\[dq]\[dq],\[dq]income:gifts\[dq],\[dq]-1\[dq],\[dq]$\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq]
-\[dq]3\[dq],\[dq]2008/06/02\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]save\[dq],\[dq]\[dq],\[dq]assets:bank:saving\[dq],\[dq]1\[dq],\[dq]$\[dq],\[dq]\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq]
-\[dq]3\[dq],\[dq]2008/06/02\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]save\[dq],\[dq]\[dq],\[dq]assets:bank:checking\[dq],\[dq]-1\[dq],\[dq]$\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq]
-\[dq]4\[dq],\[dq]2008/06/03\[dq],\[dq]\[dq],\[dq]*\[dq],\[dq]\[dq],\[dq]eat & shop\[dq],\[dq]\[dq],\[dq]expenses:food\[dq],\[dq]1\[dq],\[dq]$\[dq],\[dq]\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq]
-\[dq]4\[dq],\[dq]2008/06/03\[dq],\[dq]\[dq],\[dq]*\[dq],\[dq]\[dq],\[dq]eat & shop\[dq],\[dq]\[dq],\[dq]expenses:supplies\[dq],\[dq]1\[dq],\[dq]$\[dq],\[dq]\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq]
-\[dq]4\[dq],\[dq]2008/06/03\[dq],\[dq]\[dq],\[dq]*\[dq],\[dq]\[dq],\[dq]eat & shop\[dq],\[dq]\[dq],\[dq]assets:cash\[dq],\[dq]-2\[dq],\[dq]$\[dq],\[dq]2\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq]
-\[dq]5\[dq],\[dq]2008/12/31\[dq],\[dq]\[dq],\[dq]*\[dq],\[dq]\[dq],\[dq]pay off\[dq],\[dq]\[dq],\[dq]liabilities:debts\[dq],\[dq]1\[dq],\[dq]$\[dq],\[dq]\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq]
-\[dq]5\[dq],\[dq]2008/12/31\[dq],\[dq]\[dq],\[dq]*\[dq],\[dq]\[dq],\[dq]pay off\[dq],\[dq]\[dq],\[dq]assets:bank:checking\[dq],\[dq]-1\[dq],\[dq]$\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq]
-\f[R]
-.fi
-.IP \[bu] 2
-There is one CSV record per posting, with the parent transaction\[aq]s
-fields repeated.
-.IP \[bu] 2
-The \[dq]txnidx\[dq] (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 order, etc.)
-.IP \[bu] 2
-The amount is separated into \[dq]commodity\[dq] (the symbol) and
-\[dq]amount\[dq] (numeric quantity) fields.
-.IP \[bu] 2
-The numeric amount is repeated in either the \[dq]credit\[dq] or
-\[dq]debit\[dq] column, for convenience.
-(Those names are not accurate in the accounting sense; it just puts
-negative amounts under credit and zero or greater amounts under debit.)
-.SS print-unique
-.PP
-print-unique
-.PD 0
-.P
-.PD
-Print transactions which do not reuse an already-seen description.
-.PP
-Example:
-.IP
-.nf
-\f[C]
-$ cat unique.journal
-1/1 test
- (acct:one)  1
-2/2 test
- (acct:two)  2
-$ LEDGER_FILE=unique.journal hledger print-unique
-(-f option not supported)
-2015/01/01 test
-    (acct:one)             1
-\f[R]
-.fi
-.SS register
-.PP
-register, reg, r
-.PD 0
-.P
-.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:
-.IP
-.nf
-\f[C]
-$ hledger register checking
-2008/01/01 income               assets:bank:checking            $1           $1
-2008/06/01 gift                 assets:bank:checking            $1           $2
-2008/06/02 save                 assets:bank:checking           $-1           $1
-2008/12/31 pay off              assets:bank:checking           $-1            0
-\f[R]
-.fi
-.PP
-With --date2, it shows and sorts by secondary date instead.
-.PP
-The \f[C]--historical\f[R]/\f[C]-H\f[R] flag adds the balance from any
-undisplayed prior postings to the running total.
-This is useful when you want to see only recent activity, with a
-historically accurate running balance:
-.IP
-.nf
-\f[C]
-$ hledger register checking -b 2008/6 --historical
-2008/06/01 gift                 assets:bank:checking            $1           $2
-2008/06/02 save                 assets:bank:checking           $-1           $1
-2008/12/31 pay off              assets:bank:checking           $-1            0
-\f[R]
-.fi
-.PP
-The \f[C]--depth\f[R] option limits the amount of sub-account detail
-displayed.
-.PP
-The \f[C]--average\f[R]/\f[C]-A\f[R] flag shows the running average
-posting amount instead of the running total (so, the final number
-displayed is the average for the whole report period).
-This flag implies \f[C]--empty\f[R] (see below).
-It is affected by \f[C]--historical\f[R].
-It works best when showing just one account and one commodity.
-.PP
-The \f[C]--related\f[R]/\f[C]-r\f[R] flag shows the \f[I]other\f[R]
-postings in the transactions of the postings which would normally be
-shown.
-.PP
-The \f[C]--invert\f[R] flag negates all amounts.
-For example, it can be used on an income account where amounts are
-normally displayed as negative numbers.
-It\[aq]s also useful to show postings on the checking account together
-with the related account:
-.IP
-.nf
-\f[C]
-$ hledger register --related --invert assets:checking
-\f[R]
-.fi
-.PP
-With a reporting interval, register shows summary postings, one per
-interval, aggregating the postings to each account:
-.IP
-.nf
-\f[C]
-$ hledger register --monthly income
-2008/01                 income:salary                          $-1          $-1
-2008/06                 income:gifts                           $-1          $-2
-\f[R]
-.fi
-.PP
-Periods with no activity, and summary postings with a zero amount, are
-not shown by default; use the \f[C]--empty\f[R]/\f[C]-E\f[R] flag to see
-them:
-.IP
-.nf
-\f[C]
-$ hledger register --monthly income -E
-2008/01                 income:salary                          $-1          $-1
-2008/02                                                          0          $-1
-2008/03                                                          0          $-1
-2008/04                                                          0          $-1
-2008/05                                                          0          $-1
-2008/06                 income:gifts                           $-1          $-2
-2008/07                                                          0          $-2
-2008/08                                                          0          $-2
-2008/09                                                          0          $-2
-2008/10                                                          0          $-2
-2008/11                                                          0          $-2
-2008/12                                                          0          $-2
-\f[R]
-.fi
-.PP
-Often, you\[aq]ll want to see just one line per interval.
-The \f[C]--depth\f[R] option helps with this, causing subaccounts to be
-aggregated:
-.IP
-.nf
-\f[C]
-$ hledger register --monthly assets --depth 1h
-2008/01                 assets                                  $1           $1
-2008/06                 assets                                 $-1            0
-2008/12                 assets                                 $-1          $-1
-\f[R]
-.fi
-.PP
-Note when using report intervals, if you specify start/end dates these
-will be adjusted outward if necessary to contain a whole number of
-intervals.
-This ensures that the first and last intervals are full length and
-comparable to the others in the report.
-.SS Custom register output
-.PP
-register uses the full terminal width by default, except on windows.
-You can override this by setting the \f[C]COLUMNS\f[R] environment
-variable (not a bash shell variable) or by using the
-\f[C]--width\f[R]/\f[C]-w\f[R] option.
-.PP
-The description and account columns normally share the space equally
-(about half of (width - 40) each).
-You can adjust this by adding a description width as part of
---width\[aq]s argument, comma-separated: \f[C]--width W,D\f[R] .
-Here\[aq]s a diagram (won\[aq]t display correctly in --help):
-.IP
-.nf
-\f[C]
-<--------------------------------- width (W) ---------------------------------->
-date (10)  description (D)       account (W-41-D)     amount (12)   balance (12)
-DDDDDDDDDD dddddddddddddddddddd  aaaaaaaaaaaaaaaaaaa  AAAAAAAAAAAA  AAAAAAAAAAAA
-\f[R]
-.fi
-.PP
-and some examples:
-.IP
-.nf
-\f[C]
-$ hledger reg                     # use terminal width (or 80 on windows)
-$ hledger reg -w 100              # use width 100
-$ COLUMNS=100 hledger reg         # set with one-time environment variable
-$ export COLUMNS=100; hledger reg # set till session end (or window resize)
-$ hledger reg -w 100,40           # set overall width 100, description width 40
-$ hledger reg -w $COLUMNS,40      # use terminal width, & description width 40
-\f[R]
-.fi
-.PP
-This command also supports output destination and output format
-selection.
-.SS register-match
-.PP
-register-match
-.PD 0
-.P
-.PD
-Print the one posting whose transaction description is closest to DESC,
-in the style of the register command.
-If there are multiple equally good matches, it shows the most recent.
-Query options (options, not arguments) can be used to restrict the
-search space.
-Helps ledger-autosync detect already-seen transactions when importing.
-.SS rewrite
-.PP
-rewrite
-.PD 0
-.P
-.PD
-Print all transactions, rewriting the postings of matched transactions.
-For now the only rewrite available is adding new postings, like print
---auto.
-.PP
-This is a start at a generic rewriter of transaction entries.
-It reads the default journal and prints the transactions, like print,
-but adds one or more specified postings to any transactions matching
-QUERY.
-The posting amounts can be fixed, or a multiplier of the existing
-transaction\[aq]s first posting amount.
-.PP
-Examples:
-.IP
-.nf
-\f[C]
-$ hledger-rewrite.hs \[ha]income --add-posting \[aq](liabilities:tax)  *.33  ; income tax\[aq] --add-posting \[aq](reserve:gifts)  $100\[aq]
-$ hledger-rewrite.hs expenses:gifts --add-posting \[aq](reserve:gifts)  *-1\[dq]\[aq]
-$ hledger-rewrite.hs -f rewrites.hledger
-\f[R]
-.fi
-.PP
-rewrites.hledger may consist of entries like:
-.IP
-.nf
-\f[C]
-= \[ha]income amt:<0 date:2017
-  (liabilities:tax)  *0.33  ; tax on income
-  (reserve:grocery)  *0.25  ; reserve 25% for grocery
-  (reserve:)  *0.25  ; reserve 25% for grocery
-\f[R]
-.fi
-.PP
-Note the single quotes to protect the dollar sign from bash, and the two
-spaces between account and amount.
-.PP
-More:
-.IP
-.nf
-\f[C]
-$ hledger rewrite -- [QUERY]        --add-posting \[dq]ACCT  AMTEXPR\[dq] ...
-$ hledger rewrite -- \[ha]income        --add-posting \[aq](liabilities:tax)  *.33\[aq]
-$ hledger rewrite -- expenses:gifts --add-posting \[aq](budget:gifts)  *-1\[dq]\[aq]
-$ hledger rewrite -- \[ha]income        --add-posting \[aq](budget:foreign currency)  *0.25 JPY; diversify\[aq]
-\f[R]
-.fi
-.PP
-Argument for \f[C]--add-posting\f[R] option is a usual posting of
-transaction with an exception for amount specification.
-More precisely, you can use \f[C]\[aq]*\[aq]\f[R] (star symbol) before
-the amount to indicate that that this is a factor for an amount of
-original matched posting.
-If the amount includes a commodity name, the new posting amount will be
-in the new commodity; otherwise, it will be in the matched posting
-amount\[aq]s commodity.
-.SS Re-write rules in a file
-.PP
-During the run this tool will execute so called \[dq]Automated
-Transactions\[dq] found in any journal it process.
-I.e instead of specifying this operations in command line you can put
-them in a journal file.
-.IP
-.nf
-\f[C]
-$ rewrite-rules.journal
-\f[R]
-.fi
-.PP
-Make contents look like this:
-.IP
-.nf
-\f[C]
-= \[ha]income
-    (liabilities:tax)  *.33
-
-= expenses:gifts
-    budget:gifts  *-1
-    assets:budget  *1
-\f[R]
-.fi
-.PP
-Note that \f[C]\[aq]=\[aq]\f[R] (equality symbol) that is used instead
-of date in transactions you usually write.
-It indicates the query by which you want to match the posting to add new
-ones.
-.IP
-.nf
-\f[C]
-$ hledger rewrite -- -f input.journal -f rewrite-rules.journal > rewritten-tidy-output.journal
-\f[R]
-.fi
-.PP
-This is something similar to the commands pipeline:
-.IP
-.nf
-\f[C]
-$ hledger rewrite -- -f input.journal \[aq]\[ha]income\[aq] --add-posting \[aq](liabilities:tax)  *.33\[aq] \[rs]
-  | hledger rewrite -- -f - expenses:gifts      --add-posting \[aq]budget:gifts  *-1\[aq]       \[rs]
-                                                --add-posting \[aq]assets:budget  *1\[aq]       \[rs]
-  > rewritten-tidy-output.journal
-\f[R]
-.fi
-.PP
-It is important to understand that relative order of such entries in
-journal is important.
-You can re-use result of previously added postings.
-.SS Diff output format
-.PP
-To use this tool for batch modification of your journal files you may
-find useful output in form of unified diff.
-.IP
-.nf
-\f[C]
-$ hledger rewrite -- --diff -f examples/sample.journal \[aq]\[ha]income\[aq] --add-posting \[aq](liabilities:tax)  *.33\[aq]
-\f[R]
-.fi
-.PP
-Output might look like:
-.IP
-.nf
-\f[C]
---- /tmp/examples/sample.journal
-+++ /tmp/examples/sample.journal
-\[at]\[at] -18,3 +18,4 \[at]\[at]
- 2008/01/01 income
--    assets:bank:checking  $1
-+    assets:bank:checking            $1
-     income:salary
-+    (liabilities:tax)                0
-\[at]\[at] -22,3 +23,4 \[at]\[at]
- 2008/06/01 gift
--    assets:bank:checking  $1
-+    assets:bank:checking            $1
-     income:gifts
-+    (liabilities:tax)                0
-\f[R]
-.fi
-.PP
-If you\[aq]ll pass this through \f[C]patch\f[R] tool you\[aq]ll get
-transactions containing the posting that matches your query be updated.
-Note that multiple files might be update according to list of input
-files specified via \f[C]--file\f[R] options and \f[C]include\f[R]
-directives inside of these files.
-.PP
-Be careful.
-Whole transaction being re-formatted in a style of output from
-\f[C]hledger print\f[R].
-.PP
-See also:
-.PP
-https://github.com/simonmichael/hledger/issues/99
-.SS rewrite vs. print --auto
-.PP
-This command predates print --auto, and currently does much the same
-thing, but with these differences:
-.IP \[bu] 2
-with multiple files, rewrite lets rules in any file affect all other
-files.
-print --auto uses standard directive scoping; rules affect only child
-files.
-.IP \[bu] 2
-rewrite\[aq]s query limits which transactions can be rewritten; all are
-printed.
-print --auto\[aq]s query limits which transactions are printed.
-.IP \[bu] 2
-rewrite applies rules specified on command line or in the journal.
-print --auto applies rules specified in the journal.
-.SS roi
-.PP
-roi
-.PD 0
-.P
-.PD
-Shows the time-weighted (TWR) and money-weighted (IRR) rate of return on
-your investments.
-.PP
-This command assumes that you have account(s) that hold nothing but your
-investments and whenever you record current appraisal/valuation of these
-investments you offset unrealized profit and loss into account(s) that,
-again, hold nothing but unrealized profit and loss.
-.PP
-Any transactions affecting balance of investment account(s) and not
-originating from unrealized profit and loss account(s) are assumed to be
-your investments or withdrawals.
-.PP
-At a minimum, you need to supply a query (which could be just an account
-name) to select your investments with \f[C]--inv\f[R], and another query
-to identify your profit and loss transactions with \f[C]--pnl\f[R].
-.PP
-It will compute and display the internalized rate of return (IRR) and
-time-weighted rate of return (TWR) for your investments for the time
-period requested.
-Both rates of return are annualized before display, regardless of the
-length of reporting interval.
-.SS stats
-.PP
-stats
-.PD 0
-.P
-.PD
-Show some journal statistics.
-.PP
-The stats command displays summary information for the whole journal, or
-a matched part of it.
-With a reporting interval, it shows a report for each report period.
-.PP
-Example:
-.IP
-.nf
-\f[C]
-$ hledger stats
-Main journal file        : /src/hledger/examples/sample.journal
-Included journal files   : 
-Transactions span        : 2008-01-01 to 2009-01-01 (366 days)
-Last transaction         : 2008-12-31 (2333 days ago)
-Transactions             : 5 (0.0 per day)
-Transactions last 30 days: 0 (0.0 per day)
-Transactions last 7 days : 0 (0.0 per day)
-Payees/descriptions      : 5
-Accounts                 : 8 (depth 3)
-Commodities              : 1 ($)
-Market prices            : 12 ($)
-\f[R]
-.fi
-.PP
-This command also supports output destination and output format
-selection.
-.SS tags
-.PP
-tags
-.PD 0
-.P
-.PD
-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\[aq] unique values are listed instead.
-.SS test
-.PP
-test
-.PD 0
-.P
-.PD
-Run built-in unit tests.
-.PP
-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.
-.PP
-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!
-.PP
-This command also accepts tasty test runner options, written after a --
-(double hyphen).
-Eg to run only the tests in Hledger.Data.Amount, with ANSI colour codes
-disabled:
-.IP
-.nf
-\f[C]
-$ hledger test -- -pData.Amount --color=never
-\f[R]
-.fi
-.PP
-For help on these, see https://github.com/feuerbach/tasty#options
-(\f[C]-- --help\f[R] currently doesn\[aq]t show them).
-.SH ADD-ON COMMANDS
-.PP
-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
-\f[C]hledger-\f[R] and ends with a recognised file extension (currently:
-no extension, \f[C]bat\f[R],\f[C]com\f[R],\f[C]exe\f[R],
-\f[C]hs\f[R],\f[C]lhs\f[R],\f[C]pl\f[R],\f[C]py\f[R],\f[C]rb\f[R],\f[C]rkt\f[R],\f[C]sh\f[R]).
-.PP
-Add-ons can be invoked like any hledger command, but there are a few
-things to be aware of.
-Eg if the \f[C]hledger-web\f[R] add-on is installed,
-.IP \[bu] 2
-\f[C]hledger -h web\f[R] shows hledger\[aq]s help, while
-\f[C]hledger web -h\f[R] shows hledger-web\[aq]s help.
-.IP \[bu] 2
-Flags specific to the add-on must have a preceding \f[C]--\f[R] to hide
-them from hledger.
-So \f[C]hledger web --serve --port 9000\f[R] will be rejected; you must
-use \f[C]hledger web -- --serve --port 9000\f[R].
-.IP \[bu] 2
-You can always run add-ons directly if preferred:
-\f[C]hledger-web --serve --port 9000\f[R].
-.PP
-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.
-.PP
-Here are some hledger add-ons available:
-.SS Official add-ons
-.PP
-These are maintained and released along with hledger.
-.SS ui
-.PP
-hledger-ui provides an efficient terminal interface.
-.SS web
-.PP
-hledger-web provides a simple web interface.
-.SS Third party add-ons
-.PP
-These are maintained separately, and usually updated shortly after a
-hledger release.
-.SS diff
-.PP
-hledger-diff shows differences in an account\[aq]s transactions between
-one journal file and another.
-.SS iadd
-.PP
-hledger-iadd is a more interactive, terminal UI replacement for the add
-command.
-.SS interest
-.PP
-hledger-interest generates interest transactions for an account
-according to various schemes.
-.SS irr
-.PP
-hledger-irr calculates the internal rate of return of an investment
-account, but it\[aq]s superseded now by the built-in roi command.
-.SS Experimental add-ons
-.PP
-These are available in source form in the hledger repo\[aq]s bin/
-directory.
-They may be less mature and documented than built-in commands.
-Reading and tweaking these is a good way to start making your own!
-.SS autosync
-.PP
-hledger-autosync is a symbolic link for easily running ledger-autosync,
-if installed.
-ledger-autosync does deduplicating conversion of OFX data and some CSV
-formats, and can also download the data if your bank offers OFX Direct
-Connect.
-.SS chart
-.PP
-hledger-chart.hs is an old pie chart generator, in need of some love.
-.SS check
-.PP
-hledger-check.hs checks more powerful account balance assertions.
-.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
-\f[C]C:/Users/USER/.hledger.journal\f[R]).
+.TH "hledger" "1" "March 2020" "hledger 1.17" "hledger User Manuals"
+
+
+
+.SH NAME
+.PP
+hledger - a command-line accounting tool
+.SH SYNOPSIS
+.PP
+\f[C]hledger [-f FILE] COMMAND [OPTIONS] [ARGS]\f[R]
+.PD 0
+.P
+.PD
+\f[C]hledger [-f FILE] ADDONCMD -- [OPTIONS] [ARGS]\f[R]
+.PD 0
+.P
+.PD
+\f[C]hledger\f[R]
+.SH DESCRIPTION
+.PP
+hledger is a reliable, cross-platform set of programs for tracking
+money, time, or any other commodity, using double-entry accounting and a
+simple, editable file format.
+hledger is inspired by and largely compatible with ledger(1).
+.PP
+This is hledger\[cq]s command-line interface (there are also terminal
+and web interfaces).
+Its basic function is to read a plain text file describing financial
+transactions (in accounting terms, a general journal) and print useful
+reports on standard output, or export them as CSV.
+hledger can also read some other file formats such as CSV files,
+translating them to journal format.
+Additionally, hledger lists other hledger-* executables found in the
+user\[cq]s $PATH and can invoke them as subcommands.
+.PP
+hledger reads data from one or more files in hledger journal, timeclock,
+timedot, or CSV format specified with \f[C]-f\f[R], or
+\f[C]$LEDGER_FILE\f[R], or \f[C]$HOME/.hledger.journal\f[R] (on windows,
+perhaps \f[C]C:/Users/USER/.hledger.journal\f[R]).
+If using \f[C]$LEDGER_FILE\f[R], note this must be a real environment
+variable, not a shell variable.
+You can specify standard input with \f[C]-f-\f[R].
+.PP
+Transactions are dated movements of money between two (or more) named
+accounts, and are recorded with journal entries like this:
+.IP
+.nf
+\f[C]
+2015/10/16 bought food
+ expenses:food          $10
+ assets:cash
+\f[R]
+.fi
+.PP
+For more about this format, see hledger_journal(5).
+.PP
+Most users use a text editor to edit the journal, usually with an editor
+mode such as ledger-mode for added convenience.
+hledger\[cq]s interactive add command is another way to record new
+transactions.
+hledger never changes existing transactions.
+.PP
+To get started, you can either save some entries like the above in
+\f[C]\[ti]/.hledger.journal\f[R], or run \f[C]hledger add\f[R] and
+follow the prompts.
+Then try some commands like \f[C]hledger print\f[R] or
+\f[C]hledger balance\f[R].
+Run \f[C]hledger\f[R] with no arguments for a list of commands.
+.SH COMMON TASKS
+.PP
+Here are some quick examples of how to do some basic tasks with hledger.
+For more details, see the reference section below, the
+hledger_journal(5) manual, or the more extensive docs at
+https://hledger.org.
+.SS Getting help
+.IP
+.nf
+\f[C]
+$ hledger                 # show available commands
+$ hledger --help          # show common options
+$ hledger CMD --help      # show common and command options, and command help
+$ hledger help            # show available manuals/topics
+$ hledger help hledger    # show hledger manual as info/man/text (auto-chosen)
+$ hledger help journal --man  # show the journal manual as a man page
+$ hledger help --help     # show more detailed help for the help command
+\f[R]
+.fi
+.PP
+Find more docs, chat, mail list, reddit, issue tracker:
+https://hledger.org#help-feedback
+.SS Constructing command lines
+.PP
+hledger has an extensive and powerful command line interface.
+We strive to keep it simple and ergonomic, but you may run into one of
+the confusing real world details described in OPTIONS, below.
+If that happens, here are some tips that may help:
+.IP \[bu] 2
+command-specific options must go after the command (it\[aq]s fine to put
+all options there) (\f[C]hledger CMD OPTS ARGS\f[R])
+.IP \[bu] 2
+running add-on executables directly simplifies command line parsing
+(\f[C]hledger-ui OPTS ARGS\f[R])
+.IP \[bu] 2
+enclose \[dq]problematic\[dq] args in single quotes
+.IP \[bu] 2
+if needed, also add a backslash to hide regular expression
+metacharacters from the shell
+.IP \[bu] 2
+to see how a misbehaving command is being parsed, add
+\f[C]--debug=2\f[R].
+.SS Starting a journal file
+.PP
+hledger looks for your accounting data in a journal file,
+\f[C]$HOME/.hledger.journal\f[R] by default:
+.IP
+.nf
+\f[C]
+$ hledger stats
+The hledger journal file \[dq]/Users/simon/.hledger.journal\[dq] was not found.
+Please create it first, eg with \[dq]hledger add\[dq] or a text editor.
+Or, specify an existing journal file with -f or LEDGER_FILE.
+\f[R]
+.fi
+.PP
+You can override this by setting the \f[C]LEDGER_FILE\f[R] environment
+variable.
+It\[aq]s a good practice to keep this important file under version
+control, and to start a new file each year.
+So you could do something like this:
+.IP
+.nf
+\f[C]
+$ mkdir \[ti]/finance
+$ cd \[ti]/finance
+$ git init
+Initialized empty Git repository in /Users/simon/finance/.git/
+$ touch 2020.journal
+$ echo \[dq]export LEDGER_FILE=$HOME/finance/2020.journal\[dq] >> \[ti]/.bashrc
+$ source \[ti]/.bashrc
+$ hledger stats
+Main file                : /Users/simon/finance/2020.journal
+Included files           : 
+Transactions span        :  to  (0 days)
+Last transaction         : none
+Transactions             : 0 (0.0 per day)
+Transactions last 30 days: 0 (0.0 per day)
+Transactions last 7 days : 0 (0.0 per day)
+Payees/descriptions      : 0
+Accounts                 : 0 (depth 0)
+Commodities              : 0 ()
+Market prices            : 0 ()
+\f[R]
+.fi
+.SS Setting opening balances
+.PP
+Pick a starting date for which you can look up the balances of some
+real-world assets (bank accounts, wallet..) and liabilities (credit
+cards..).
+.PP
+To avoid a lot of data entry, you may want to start with just one or two
+accounts, like your checking account or cash wallet; and pick a recent
+starting date, like today or the start of the week.
+You can always come back later and add more accounts and older
+transactions, eg going back to january 1st.
+.PP
+Add an opening balances transaction to the journal, declaring the
+balances on this date.
+Here are two ways to do it:
+.IP \[bu] 2
+The first way: open the journal in any text editor and save an entry
+like this:
+.RS 2
+.IP
+.nf
+\f[C]
+2020-01-01 * opening balances
+    assets:bank:checking                $1000   = $1000
+    assets:bank:savings                 $2000   = $2000
+    assets:cash                          $100   = $100
+    liabilities:creditcard               $-50   = $-50
+    equity:opening/closing balances
+\f[R]
+.fi
+.PP
+These are start-of-day balances, ie whatever was in the account at the
+end of the previous day.
+.PP
+The * after the date is an optional status flag.
+Here it means \[dq]cleared & confirmed\[dq].
+.PP
+The currency symbols are optional, but usually a good idea as you\[aq]ll
+be dealing with multiple currencies sooner or later.
+.PP
+The = amounts are optional balance assertions, providing extra error
+checking.
+.RE
+.IP \[bu] 2
+The second way: run \f[C]hledger add\f[R] and follow the prompts to
+record a similar transaction:
+.RS 2
+.IP
+.nf
+\f[C]
+$ hledger add
+Adding transactions to journal file /Users/simon/finance/2020.journal
+Any command line arguments will be used as defaults.
+Use tab key to complete, readline keys to edit, enter to accept defaults.
+An optional (CODE) may follow transaction dates.
+An optional ; COMMENT may follow descriptions or amounts.
+If you make a mistake, enter < at any prompt to go one step backward.
+To end a transaction, enter . when prompted.
+To quit, enter . at a date prompt or press control-d or control-c.
+Date [2020-02-07]: 2020-01-01
+Description: * opening balances
+Account 1: assets:bank:checking
+Amount  1: $1000
+Account 2: assets:bank:savings
+Amount  2 [$-1000]: $2000
+Account 3: assets:cash
+Amount  3 [$-3000]: $100
+Account 4: liabilities:creditcard
+Amount  4 [$-3100]: $-50
+Account 5: equity:opening/closing balances
+Amount  5 [$-3050]: 
+Account 6 (or . or enter to finish this transaction): .
+2020-01-01 * opening balances
+    assets:bank:checking                      $1000
+    assets:bank:savings                       $2000
+    assets:cash                                $100
+    liabilities:creditcard                     $-50
+    equity:opening/closing balances          $-3050
+
+Save this transaction to the journal ? [y]: 
+Saved.
+Starting the next transaction (. or ctrl-D/ctrl-C to quit)
+Date [2020-01-01]: .
+\f[R]
+.fi
+.RE
+.PP
+If you\[aq]re using version control, this could be a good time to commit
+the journal.
+Eg:
+.IP
+.nf
+\f[C]
+$ git commit -m \[aq]initial balances\[aq] 2020.journal
+\f[R]
+.fi
+.SS Recording transactions
+.PP
+As you spend or receive money, you can record these transactions using
+one of the methods above (text editor, hledger add) or by using the
+hledger-iadd or hledger-web add-ons, or by using the import command to
+convert CSV data downloaded from your bank.
+.PP
+Here are some simple transactions, see the hledger_journal(5) manual and
+hledger.org for more ideas:
+.IP
+.nf
+\f[C]
+2020/1/10 * gift received
+  assets:cash   $20
+  income:gifts
+
+2020.1.12 * farmers market
+  expenses:food    $13
+  assets:cash
+
+2020-01-15 paycheck
+  income:salary
+  assets:bank:checking    $1000
+\f[R]
+.fi
+.SS Reconciling
+.PP
+Periodically you should reconcile - compare your hledger-reported
+balances against external sources of truth, like bank statements or your
+bank\[aq]s website - to be sure that your ledger accurately represents
+the real-world balances (and, that the real-world institutions have not
+made a mistake!).
+This gets easy and fast with (1) practice and (2) frequency.
+If you do it daily, it can take 2-10 minutes.
+If you let it pile up, expect it to take longer as you hunt down errors
+and discrepancies.
+.PP
+A typical workflow:
+.IP "1." 3
+Reconcile cash.
+Count what\[aq]s in your wallet.
+Compare with what hledger reports (\f[C]hledger bal cash\f[R]).
+If they are different, try to remember the missing transaction, or look
+for the error in the already-recorded transactions.
+A register report can be helpful (\f[C]hledger reg cash\f[R]).
+If you can\[aq]t find the error, add an adjustment transaction.
+Eg if you have $105 after the above, and can\[aq]t explain the missing
+$2, it could be:
+.RS 4
+.IP
+.nf
+\f[C]
+2020-01-16 * adjust cash
+    assets:cash    $-2 = $105
+    expenses:misc
+\f[R]
+.fi
+.RE
+.IP "2." 3
+Reconcile checking.
+Log in to your bank\[aq]s website.
+Compare today\[aq]s (cleared) balance with hledger\[aq]s cleared balance
+(\f[C]hledger bal checking -C\f[R]).
+If they are different, track down the error or record the missing
+transaction(s) or add an adjustment transaction, similar to the above.
+Unlike the cash case, you can usually compare the transaction history
+and running balance from your bank with the one reported by
+\f[C]hledger reg checking -C\f[R].
+This will be easier if you generally record transaction dates quite
+similar to your bank\[aq]s clearing dates.
+.IP "3." 3
+Repeat for other asset/liability accounts.
+.PP
+Tip: instead of the register command, use hledger-ui to see a
+live-updating register while you edit the journal:
+\f[C]hledger-ui --watch --register checking -C\f[R]
+.PP
+After reconciling, it could be a good time to mark the reconciled
+transactions\[aq] status as \[dq]cleared and confirmed\[dq], if you want
+to track that, by adding the \f[C]*\f[R] marker.
+Eg in the paycheck transaction above, insert \f[C]*\f[R] between
+\f[C]2020-01-15\f[R] and \f[C]paycheck\f[R]
+.PP
+If you\[aq]re using version control, this can be another good time to
+commit:
+.IP
+.nf
+\f[C]
+$ git commit -m \[aq]txns\[aq] 2020.journal
+\f[R]
+.fi
+.SS Reporting
+.PP
+Here are some basic reports.
+.PP
+Show all transactions:
+.IP
+.nf
+\f[C]
+$ hledger print
+2020-01-01 * opening balances
+    assets:bank:checking                      $1000
+    assets:bank:savings                       $2000
+    assets:cash                                $100
+    liabilities:creditcard                     $-50
+    equity:opening/closing balances          $-3050
+
+2020-01-10 * gift received
+    assets:cash              $20
+    income:gifts
+
+2020-01-12 * farmers market
+    expenses:food             $13
+    assets:cash
+
+2020-01-15 * paycheck
+    income:salary
+    assets:bank:checking           $1000
+
+2020-01-16 * adjust cash
+    assets:cash               $-2 = $105
+    expenses:misc
+\f[R]
+.fi
+.PP
+Show account names, and their hierarchy:
+.IP
+.nf
+\f[C]
+$ hledger accounts --tree
+assets
+  bank
+    checking
+    savings
+  cash
+equity
+  opening/closing balances
+expenses
+  food
+  misc
+income
+  gifts
+  salary
+liabilities
+  creditcard
+\f[R]
+.fi
+.PP
+Show all account totals:
+.IP
+.nf
+\f[C]
+$ hledger balance
+               $4105  assets
+               $4000    bank
+               $2000      checking
+               $2000      savings
+                $105    cash
+              $-3050  equity:opening/closing balances
+                 $15  expenses
+                 $13    food
+                  $2    misc
+              $-1020  income
+                $-20    gifts
+              $-1000    salary
+                $-50  liabilities:creditcard
+--------------------
+                   0
+\f[R]
+.fi
+.PP
+Show only asset and liability balances, as a flat list, limited to depth
+2:
+.IP
+.nf
+\f[C]
+$ hledger bal assets liabilities --flat -2
+               $4000  assets:bank
+                $105  assets:cash
+                $-50  liabilities:creditcard
+--------------------
+               $4055
+\f[R]
+.fi
+.PP
+Show the same thing without negative numbers, formatted as a simple
+balance sheet:
+.IP
+.nf
+\f[C]
+$ hledger bs --flat -2
+Balance Sheet 2020-01-16
+
+                        || 2020-01-16 
+========================++============
+ Assets                 ||            
+------------------------++------------
+ assets:bank            ||      $4000 
+ assets:cash            ||       $105 
+------------------------++------------
+                        ||      $4105 
+========================++============
+ Liabilities            ||            
+------------------------++------------
+ liabilities:creditcard ||        $50 
+------------------------++------------
+                        ||        $50 
+========================++============
+ Net:                   ||      $4055 
+\f[R]
+.fi
+.PP
+The final total is your \[dq]net worth\[dq] on the end date.
+(Or use \f[C]bse\f[R] for a full balance sheet with equity.)
+.PP
+Show income and expense totals, formatted as an income statement:
+.IP
+.nf
+\f[C]
+hledger is 
+Income Statement 2020-01-01-2020-01-16
+
+               || 2020-01-01-2020-01-16 
+===============++=======================
+ Revenues      ||                       
+---------------++-----------------------
+ income:gifts  ||                   $20 
+ income:salary ||                 $1000 
+---------------++-----------------------
+               ||                 $1020 
+===============++=======================
+ Expenses      ||                       
+---------------++-----------------------
+ expenses:food ||                   $13 
+ expenses:misc ||                    $2 
+---------------++-----------------------
+               ||                   $15 
+===============++=======================
+ Net:          ||                 $1005 
+\f[R]
+.fi
+.PP
+The final total is your net income during this period.
+.PP
+Show transactions affecting your wallet, with running total:
+.IP
+.nf
+\f[C]
+$ hledger register cash
+2020-01-01 opening balances     assets:cash                   $100          $100
+2020-01-10 gift received        assets:cash                    $20          $120
+2020-01-12 farmers market       assets:cash                   $-13          $107
+2020-01-16 adjust cash          assets:cash                    $-2          $105
+\f[R]
+.fi
+.PP
+Show weekly posting counts as a bar chart:
+.IP
+.nf
+\f[C]
+$ hledger activity -W
+2019-12-30 *****
+2020-01-06 ****
+2020-01-13 ****
+\f[R]
+.fi
+.SS Migrating to a new file
+.PP
+At the end of the year, you may want to continue your journal in a new
+file, so that old transactions don\[aq]t slow down or clutter your
+reports, and to help ensure the integrity of your accounting history.
+See the close command.
+.PP
+If using version control, don\[aq]t forget to \f[C]git add\f[R] the new
+file.
+.SH OPTIONS
+.SS General options
+.PP
+To see general usage help, including general options which are supported
+by most hledger commands, run \f[C]hledger -h\f[R].
+.PP
+General help options:
+.TP
+\f[B]\f[CB]-h --help\f[B]\f[R]
+show general usage (or after COMMAND, command usage)
+.TP
+\f[B]\f[CB]--version\f[B]\f[R]
+show version
+.TP
+\f[B]\f[CB]--debug[=N]\f[B]\f[R]
+show debug output (levels 1-9, default: 1)
+.PP
+General input options:
+.TP
+\f[B]\f[CB]-f FILE --file=FILE\f[B]\f[R]
+use a different input file.
+For stdin, use - (default: \f[C]$LEDGER_FILE\f[R] or
+\f[C]$HOME/.hledger.journal\f[R])
+.TP
+\f[B]\f[CB]--rules-file=RULESFILE\f[B]\f[R]
+Conversion rules file to use when reading CSV (default: FILE.rules)
+.TP
+\f[B]\f[CB]--separator=CHAR\f[B]\f[R]
+Field separator to expect when reading CSV (default: \[aq],\[aq])
+.TP
+\f[B]\f[CB]--alias=OLD=NEW\f[B]\f[R]
+rename accounts named OLD to NEW
+.TP
+\f[B]\f[CB]--anon\f[B]\f[R]
+anonymize accounts and payees
+.TP
+\f[B]\f[CB]--pivot FIELDNAME\f[B]\f[R]
+use some other field or tag for the account name
+.TP
+\f[B]\f[CB]-I --ignore-assertions\f[B]\f[R]
+disable balance assertion checks (note: does not disable balance
+assignments)
+.PP
+General reporting options:
+.TP
+\f[B]\f[CB]-b --begin=DATE\f[B]\f[R]
+include postings/txns on or after this date
+.TP
+\f[B]\f[CB]-e --end=DATE\f[B]\f[R]
+include postings/txns before this date
+.TP
+\f[B]\f[CB]-D --daily\f[B]\f[R]
+multiperiod/multicolumn report by day
+.TP
+\f[B]\f[CB]-W --weekly\f[B]\f[R]
+multiperiod/multicolumn report by week
+.TP
+\f[B]\f[CB]-M --monthly\f[B]\f[R]
+multiperiod/multicolumn report by month
+.TP
+\f[B]\f[CB]-Q --quarterly\f[B]\f[R]
+multiperiod/multicolumn report by quarter
+.TP
+\f[B]\f[CB]-Y --yearly\f[B]\f[R]
+multiperiod/multicolumn report by year
+.TP
+\f[B]\f[CB]-p --period=PERIODEXP\f[B]\f[R]
+set start date, end date, and/or reporting interval all at once using
+period expressions syntax
+.TP
+\f[B]\f[CB]--date2\f[B]\f[R]
+match the secondary date instead (see command help for other effects)
+.TP
+\f[B]\f[CB]-U --unmarked\f[B]\f[R]
+include only unmarked postings/txns (can combine with -P or -C)
+.TP
+\f[B]\f[CB]-P --pending\f[B]\f[R]
+include only pending postings/txns
+.TP
+\f[B]\f[CB]-C --cleared\f[B]\f[R]
+include only cleared postings/txns
+.TP
+\f[B]\f[CB]-R --real\f[B]\f[R]
+include only non-virtual postings
+.TP
+\f[B]\f[CB]-NUM --depth=NUM\f[B]\f[R]
+hide/aggregate accounts or postings more than NUM levels deep
+.TP
+\f[B]\f[CB]-E --empty\f[B]\f[R]
+show items with zero amount, normally hidden (and vice-versa in
+hledger-ui/hledger-web)
+.TP
+\f[B]\f[CB]-B --cost\f[B]\f[R]
+convert amounts to their cost at transaction time (using the transaction
+price, if any)
+.TP
+\f[B]\f[CB]-V --value\f[B]\f[R]
+convert amounts to their market value on the report end date (using the
+most recent applicable market price, if any)
+.TP
+\f[B]\f[CB]--auto\f[B]\f[R]
+apply automated posting rules to modify transactions.
+.TP
+\f[B]\f[CB]--forecast\f[B]\f[R]
+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.
+.PP
+When a reporting option appears more than once in the command line, the
+last one takes precedence.
+.PP
+Some reporting options can also be written as query arguments.
+.SS Command options
+.PP
+To see options for a particular command, including command-specific
+options, run: \f[C]hledger COMMAND -h\f[R].
+.PP
+Command-specific options must be written after the command name, eg:
+\f[C]hledger print -x\f[R].
+.PP
+Additionally, if the command is an addon, you may need to put its
+options after a double-hyphen, eg: \f[C]hledger ui -- --watch\f[R].
+Or, you can run the addon executable directly:
+\f[C]hledger-ui --watch\f[R].
+.SS Command arguments
+.PP
+Most hledger commands accept arguments after the command name, which are
+often a query, filtering the data in some way.
+.PP
+You can save a set of command line options/arguments in a file, and then
+reuse them by writing \f[C]\[at]FILENAME\f[R] as a command line
+argument.
+Eg: \f[C]hledger bal \[at]foo.args\f[R].
+(To prevent this, eg if you have an argument that begins with a literal
+\f[C]\[at]\f[R], precede it with \f[C]--\f[R], eg:
+\f[C]hledger bal -- \[at]ARG\f[R]).
+.PP
+Inside the argument file, each line should contain just one option or
+argument.
+Avoid the use of spaces, except inside quotes (or you\[aq]ll see a
+confusing error).
+Between a flag and its argument, use = (or nothing).
+Bad:
+.IP
+.nf
+\f[C]
+assets depth:2
+-X USD
+\f[R]
+.fi
+.PP
+Good:
+.IP
+.nf
+\f[C]
+assets
+depth:2
+-X=USD
+\f[R]
+.fi
+.PP
+For special characters (see below), use one less level of quoting than
+you would at the command prompt.
+Bad:
+.IP
+.nf
+\f[C]
+-X\[dq]$\[dq]
+\f[R]
+.fi
+.PP
+Good:
+.IP
+.nf
+\f[C]
+-X$
+\f[R]
+.fi
+.PP
+See also: Save frequently used options.
+.SS Queries
+.PP
+One of hledger\[aq]s strengths is being able to quickly report on
+precise subsets of your data.
+Most commands accept an optional query expression, written as arguments
+after the command name, to filter the data by date, account name or
+other criteria.
+The syntax is similar to a web search: one or more space-separated
+search terms, quotes to enclose whitespace, prefixes to match specific
+fields, a not: prefix to negate the match.
+.PP
+We do not yet support arbitrary boolean combinations of search terms;
+instead most commands show transactions/postings/accounts which match
+(or negatively match):
+.IP \[bu] 2
+any of the description terms AND
+.IP \[bu] 2
+any of the account terms AND
+.IP \[bu] 2
+any of the status terms AND
+.IP \[bu] 2
+all the other terms.
+.PP
+The print command instead shows transactions which:
+.IP \[bu] 2
+match any of the description terms AND
+.IP \[bu] 2
+have any postings matching any of the positive account terms AND
+.IP \[bu] 2
+have no postings matching any of the negative account terms AND
+.IP \[bu] 2
+match all the other terms.
+.PP
+The following kinds of search terms can be used.
+Remember these can also be prefixed with \f[B]\f[CB]not:\f[B]\f[R], eg
+to exclude a particular subaccount.
+.TP
+\f[B]\f[R]\f[C]REGEX\f[R]\f[B], \f[R]\f[C]acct:REGEX\f[R]\f[B]\f[R]
+match account names by this regular expression.
+(With no prefix, \f[C]acct:\f[R] is assumed.)
+same as above
+.TP
+\f[B]\f[R]\f[C]amt:N, amt:<N, amt:<=N, amt:>N, amt:>=N\f[R]\f[B]\f[R]
+match postings with a single-commodity amount that is equal to, less
+than, or greater than N.
+(Multi-commodity amounts are not tested, and will always match.) The
+comparison has two modes: if N is preceded by a + or - sign (or is 0),
+the two signed numbers are compared.
+Otherwise, the absolute magnitudes are compared, ignoring sign.
+.TP
+\f[B]\f[R]\f[C]code:REGEX\f[R]\f[B]\f[R]
+match by transaction code (eg check number)
+.TP
+\f[B]\f[R]\f[C]cur:REGEX\f[R]\f[B]\f[R]
+match postings or transactions including any amounts whose
+currency/commodity symbol is fully matched by REGEX.
+(For a partial match, use \f[C].*REGEX.*\f[R]).
+Note, to match characters which are regex-significant, like the dollar
+sign (\f[C]$\f[R]), you need to prepend \f[C]\[rs]\f[R].
+And when using the command line you need to add one more level of
+quoting to hide it from the shell, so eg do:
+\f[C]hledger print cur:\[aq]\[rs]$\[aq]\f[R] or
+\f[C]hledger print cur:\[rs]\[rs]$\f[R].
+.TP
+\f[B]\f[R]\f[C]desc:REGEX\f[R]\f[B]\f[R]
+match transaction descriptions.
+.TP
+\f[B]\f[R]\f[C]date:PERIODEXPR\f[R]\f[B]\f[R]
+match dates within the specified period.
+PERIODEXPR is a period expression (with no report interval).
+Examples: \f[C]date:2016\f[R], \f[C]date:thismonth\f[R],
+\f[C]date:2000/2/1-2/15\f[R], \f[C]date:lastweek-\f[R].
+If the \f[C]--date2\f[R] command line flag is present, this matches
+secondary dates instead.
+.TP
+\f[B]\f[R]\f[C]date2:PERIODEXPR\f[R]\f[B]\f[R]
+match secondary dates within the specified period.
+.TP
+\f[B]\f[R]\f[C]depth:N\f[R]\f[B]\f[R]
+match (or display, depending on command) accounts at or above this depth
+.TP
+\f[B]\f[R]\f[C]note:REGEX\f[R]\f[B]\f[R]
+match transaction notes (part of description right of \f[C]|\f[R], or
+whole description when there\[aq]s no \f[C]|\f[R])
+.TP
+\f[B]\f[R]\f[C]payee:REGEX\f[R]\f[B]\f[R]
+match transaction payee/payer names (part of description left of
+\f[C]|\f[R], or whole description when there\[aq]s no \f[C]|\f[R])
+.TP
+\f[B]\f[R]\f[C]real:, real:0\f[R]\f[B]\f[R]
+match real or virtual postings respectively
+.TP
+\f[B]\f[R]\f[C]status:, status:!, status:*\f[R]\f[B]\f[R]
+match unmarked, pending, or cleared transactions respectively
+.TP
+\f[B]\f[R]\f[C]tag:REGEX[=REGEX]\f[R]\f[B]\f[R]
+match by tag name, and optionally also by tag value.
+Note a tag: query is considered to match a transaction if it matches any
+of the postings.
+Also remember that postings inherit the tags of their parent
+transaction.
+.PP
+The following special search term is used automatically in hledger-web,
+only:
+.TP
+\f[B]\f[R]\f[C]inacct:ACCTNAME\f[R]\f[B]\f[R]
+tells hledger-web to show the transaction register for this account.
+Can be filtered further with \f[C]acct\f[R] etc.
+.PP
+Some of these can also be expressed as command-line options (eg
+\f[C]depth:2\f[R] is equivalent to \f[C]--depth 2\f[R]).
+Generally you can mix options and query arguments, and the resulting
+query will be their intersection (perhaps excluding the
+\f[C]-p/--period\f[R] option).
+.SS Special characters in arguments and queries
+.PP
+In shell command lines, option and argument values which contain
+\[dq]problematic\[dq] characters, ie spaces, and also characters
+significant to your shell such as \f[C]<\f[R], \f[C]>\f[R], \f[C](\f[R],
+\f[C])\f[R], \f[C]|\f[R] and \f[C]$\f[R], should be escaped by enclosing
+them in quotes or by writing backslashes before the characters.
+Eg:
+.PP
+\f[C]hledger register -p \[aq]last year\[aq] \[dq]accounts receivable (receivable|payable)\[dq] amt:\[rs]>100\f[R].
+.SS More escaping
+.PP
+Characters significant both to the shell and in regular expressions may
+need one extra level of escaping.
+These include parentheses, the pipe symbol and the dollar sign.
+Eg, to match the dollar symbol, bash users should do:
+.PP
+\f[C]hledger balance cur:\[aq]\[rs]$\[aq]\f[R]
+.PP
+or:
+.PP
+\f[C]hledger balance cur:\[rs]\[rs]$\f[R]
+.SS Even more escaping
+.PP
+When hledger runs an addon executable (eg you type \f[C]hledger ui\f[R],
+hledger runs \f[C]hledger-ui\f[R]), it de-escapes command-line options
+and arguments once, so you might need to \f[I]triple\f[R]-escape.
+Eg in bash, running the ui command and matching the dollar sign,
+it\[aq]s:
+.PP
+\f[C]hledger ui cur:\[aq]\[rs]\[rs]$\[aq]\f[R]
+.PP
+or:
+.PP
+\f[C]hledger ui cur:\[rs]\[rs]\[rs]\[rs]$\f[R]
+.PP
+If you asked why \f[I]four\f[R] slashes above, this may help:
+.PP
+.TS
+tab(@);
+l l.
+T{
+unescaped:
+T}@T{
+\f[C]$\f[R]
+T}
+T{
+escaped:
+T}@T{
+\f[C]\[rs]$\f[R]
+T}
+T{
+double-escaped:
+T}@T{
+\f[C]\[rs]\[rs]$\f[R]
+T}
+T{
+triple-escaped:
+T}@T{
+\f[C]\[rs]\[rs]\[rs]\[rs]$\f[R]
+T}
+.TE
+.PP
+(The number of backslashes in fish shell is left as an exercise for the
+reader.)
+.PP
+You can always avoid the extra escaping for addons by running the addon
+directly:
+.PP
+\f[C]hledger-ui cur:\[rs]\[rs]$\f[R]
+.SS Less escaping
+.PP
+Inside an argument file, or in the search field of hledger-ui or
+hledger-web, or at a GHCI prompt, you need one less level of escaping
+than at the command line.
+And backslashes may work better than quotes.
+Eg:
+.PP
+\f[C]ghci> :main balance cur:\[rs]$\f[R]
+.SS Unicode characters
+.PP
+hledger is expected to handle non-ascii characters correctly:
+.IP \[bu] 2
+they should be parsed correctly in input files and on the command line,
+by all hledger tools (add, iadd, hledger-web\[aq]s search/add/edit
+forms, etc.)
+.IP \[bu] 2
+they should be displayed correctly by all hledger tools, and on-screen
+alignment should be preserved.
+.PP
+This requires a well-configured environment.
+Here are some tips:
+.IP \[bu] 2
+A system locale must be configured, and it must be one that can decode
+the characters being used.
+In bash, you can set a locale like this:
+\f[C]export LANG=en_US.UTF-8\f[R].
+There are some more details in Troubleshooting.
+This step is essential - without it, hledger will quit on encountering a
+non-ascii character (as with all GHC-compiled programs).
+.IP \[bu] 2
+your terminal software (eg Terminal.app, iTerm, CMD.exe, xterm..) must
+support unicode
+.IP \[bu] 2
+the terminal must be using a font which includes the required unicode
+glyphs
+.IP \[bu] 2
+the terminal should be configured to display wide characters as double
+width (for report alignment)
+.IP \[bu] 2
+on Windows, for best results you should run hledger in the same kind of
+environment in which it was built.
+Eg hledger built in the standard CMD.EXE environment (like the binaries
+on our download page) might show display problems when run in a cygwin
+or msys terminal, and vice versa.
+(See eg #961).
+.SS Input files
+.PP
+hledger reads transactions from a data file (and the add command writes
+to it).
+By default this file is \f[C]$HOME/.hledger.journal\f[R] (or on Windows,
+something like \f[C]C:/Users/USER/.hledger.journal\f[R]).
+You can override this with the \f[C]$LEDGER_FILE\f[R] environment
+variable:
+.IP
+.nf
+\f[C]
+$ setenv LEDGER_FILE \[ti]/finance/2016.journal
+$ hledger stats
+\f[R]
+.fi
+.PP
+or with the \f[C]-f/--file\f[R] option:
+.IP
+.nf
+\f[C]
+$ hledger -f /some/file stats
+\f[R]
+.fi
+.PP
+The file name \f[C]-\f[R] (hyphen) means standard input:
+.IP
+.nf
+\f[C]
+$ cat some.journal | hledger -f-
+\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:
+.PP
+.TS
+tab(@);
+lw(7.6n) lw(31.2n) lw(31.2n).
+T{
+Reader:
+T}@T{
+Reads:
+T}@T{
+Used for file extensions:
+T}
+_
+T{
+\f[C]journal\f[R]
+T}@T{
+hledger\[aq]s journal format, also some Ledger journals
+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)
+T}@T{
+\f[C].timeclock\f[R]
+T}
+T{
+\f[C]timedot\f[R]
+T}@T{
+timedot files (approximate time logging)
+T}@T{
+\f[C].timedot\f[R]
+T}
+T{
+\f[C]csv\f[R]
+T}@T{
+comma-separated values (data interchange)
+T}@T{
+\f[C].csv\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:
+.IP
+.nf
+\f[C]
+$ hledger -f csv:/some/csv-file.dat stats
+$ echo \[aq]i 2009/13/1 08:00:00\[aq] | hledger print -ftimeclock:-
+\f[R]
+.fi
+.PP
+You can also 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].
+.SS Output destination
+.PP
+hledger commands send their output to the terminal by default.
+You can of course redirect this, eg into a file, using standard shell
+syntax:
+.IP
+.nf
+\f[C]
+$ hledger print > foo.txt
+\f[R]
+.fi
+.PP
+Some commands (print, register, stats, the balance commands) also
+provide the \f[C]-o/--output-file\f[R] option, which does the same thing
+without needing the shell.
+Eg:
+.IP
+.nf
+\f[C]
+$ hledger print -o foo.txt
+$ hledger print -o -        # write to stdout (the default)
+\f[R]
+.fi
+.SS Output format
+.PP
+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]).
+This is controlled by the \f[C]-O/--output-format\f[R] option:
+.IP
+.nf
+\f[C]
+$ hledger print -O csv
+\f[R]
+.fi
+.PP
+or, by a file extension specified with \f[C]-o/--output-file\f[R]:
+.IP
+.nf
+\f[C]
+$ hledger balancesheet -o foo.html   # write HTML to foo.html
+\f[R]
+.fi
+.PP
+The \f[C]-O\f[R] option can be used to override the file extension if
+needed:
+.IP
+.nf
+\f[C]
+$ hledger balancesheet -o foo.txt -O html   # write HTML to foo.txt
+\f[R]
+.fi
+.PP
+Some notes about JSON output:
+.IP \[bu] 2
+This feature is marked experimental, and not yet much used; you should
+expect our JSON to evolve.
+Real-world feedback is welcome.
+.IP \[bu] 2
+Our JSON is rather large and verbose, as it is quite a faithful
+representation of hledger\[aq]s internal data types.
+To understand the JSON, read the Haskell type definitions, which are
+mostly in
+https://github.com/simonmichael/hledger/blob/master/hledger-lib/Hledger/Data/Types.hs.
+.IP \[bu] 2
+The JSON output from hledger commands is essentially the same as the
+JSON served by hledger-web\[aq]s JSON API, but pretty printed, using
+line breaks and indentation.
+Our pretty printer has the ability to elide data in certain cases -
+rendering non-strings as if they were strings, or displaying
+\[dq]FOO..\[dq] instead of FOO\[aq]s full details.
+This should never happen in hledger\[aq]s JSON output; if you see
+otherwise, please report as a bug.
+.IP \[bu] 2
+hledger represents quantities as Decimal values storing up to 255
+significant digits, eg for repeating decimals.
+Such numbers can arise in practice (from automatically-calculated
+transaction prices), and would break most JSON consumers.
+So in JSON, we show quantities as simple Numbers with at most 10 decimal
+places.
+We don\[aq]t limit the number of integer digits, but that part is under
+your control.
+We hope this approach will not cause problems in practice; if you find
+otherwise, please let us know.
+(Cf #1195)
+.SS Regular expressions
+.PP
+hledger uses regular expressions in a number of places:
+.IP \[bu] 2
+query terms, on the command line and in the hledger-web search form:
+\f[C]REGEX\f[R], \f[C]desc:REGEX\f[R], \f[C]cur:REGEX\f[R],
+\f[C]tag:...=REGEX\f[R]
+.IP \[bu] 2
+CSV rules conditional blocks: \f[C]if REGEX ...\f[R]
+.IP \[bu] 2
+account alias directives and options:
+\f[C]alias /REGEX/ = REPLACEMENT\f[R],
+\f[C]--alias /REGEX/=REPLACEMENT\f[R]
+.PP
+hledger\[aq]s regular expressions come from the regex-tdfa library.
+In general they:
+.IP \[bu] 2
+are case insensitive
+.IP \[bu] 2
+are infix matching (do not need to match the entire thing being matched)
+.IP \[bu] 2
+are POSIX extended regular expressions
+.IP \[bu] 2
+also support GNU word boundaries (\[rs]<, \[rs]>, \[rs]b, \[rs]B)
+.IP \[bu] 2
+and parenthesised capturing groups and numeric backreferences in
+replacement strings
+.IP \[bu] 2
+do not support mode modifiers like (?s)
+.PP
+Some things to note:
+.IP \[bu] 2
+In the \f[C]alias\f[R] directive and \f[C]--alias\f[R] option, regular
+expressions must be enclosed in forward slashes (\f[C]/REGEX/\f[R]).
+Elsewhere in hledger, these are not required.
+.IP \[bu] 2
+In queries, to match a regular expression metacharacter like \f[C]$\f[R]
+as a literal character, prepend a backslash.
+Eg to search for amounts with the dollar sign in hledger-web, write
+\f[C]cur:\[rs]$\f[R].
+.IP \[bu] 2
+On the command line, some metacharacters like \f[C]$\f[R] have a special
+meaning to the shell and so must be escaped at least once more.
+See Special characters.
+.SS Smart dates
+.PP
+hledger\[aq]s user interfaces accept a flexible \[dq]smart date\[dq]
+syntax (unlike dates in the journal file).
+Smart dates allow some english words, can be relative to today\[aq]s
+date, and can have less-significant date parts omitted (defaulting to
+1).
+.PP
+Examples:
+.PP
+.TS
+tab(@);
+lw(24.2n) lw(45.8n).
+T{
+\f[C]2004/10/1\f[R], \f[C]2004-01-01\f[R], \f[C]2004.9.1\f[R]
+T}@T{
+exact date, several separators allowed.
+Year is 4+ digits, month is 1-12, day is 1-31
+T}
+T{
+\f[C]2004\f[R]
+T}@T{
+start of year
+T}
+T{
+\f[C]2004/10\f[R]
+T}@T{
+start of month
+T}
+T{
+\f[C]10/1\f[R]
+T}@T{
+month and day in current year
+T}
+T{
+\f[C]21\f[R]
+T}@T{
+day in current month
+T}
+T{
+\f[C]october, oct\f[R]
+T}@T{
+start of month in current year
+T}
+T{
+\f[C]yesterday, today, tomorrow\f[R]
+T}@T{
+-1, 0, 1 days from today
+T}
+T{
+\f[C]last/this/next day/week/month/quarter/year\f[R]
+T}@T{
+-1, 0, 1 periods from the current period
+T}
+T{
+\f[C]20181201\f[R]
+T}@T{
+8 digit YYYYMMDD with valid year month and day
+T}
+T{
+\f[C]201812\f[R]
+T}@T{
+6 digit YYYYMM with valid year and month
+T}
+.TE
+.PP
+Counterexamples - malformed digit sequences might give surprising
+results:
+.PP
+.TS
+tab(@);
+lw(11.4n) lw(58.6n).
+T{
+\f[C]201813\f[R]
+T}@T{
+6 digits with an invalid month is parsed as start of 6-digit year
+T}
+T{
+\f[C]20181301\f[R]
+T}@T{
+8 digits with an invalid month is parsed as start of 8-digit year
+T}
+T{
+\f[C]20181232\f[R]
+T}@T{
+8 digits with an invalid day gives an error
+T}
+T{
+\f[C]201801012\f[R]
+T}@T{
+9+ digits beginning with a valid YYYYMMDD gives an error
+T}
+.TE
+.SS Report start & end date
+.PP
+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 the journal.
+.PP
+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 \f[C]-b/--begin\f[R],
+\f[C]-e/--end\f[R], \f[C]-p/--period\f[R] or a \f[C]date:\f[R] query
+(described below).
+All of these accept the smart date syntax.
+.PP
+Some notes:
+.IP \[bu] 2
+As in Ledger, end dates are exclusive, so you need to write the date
+\f[I]after\f[R] the last day you want to include.
+.IP \[bu] 2
+As noted in reporting options: among start/end dates specified with
+\f[I]options\f[R], the last (i.e.
+right-most) option takes precedence.
+.IP \[bu] 2
+The effective report start and end dates are the intersection of the
+start/end dates from options and that from \f[C]date:\f[R] queries.
+That is, \f[C]date:2019-01 date:2019 -p\[aq]2000 to 2030\[aq]\f[R]
+yields January 2019, the smallest common time span.
+.PP
+Examples:
+.PP
+.TS
+tab(@);
+lw(11.9n) lw(58.1n).
+T{
+\f[C]-b 2016/3/17\f[R]
+T}@T{
+begin on St.\ Patrick\[cq]s day 2016
+T}
+T{
+\f[C]-e 12/1\f[R]
+T}@T{
+end at the start of december 1st of the current year (11/30 will be the
+last date included)
+T}
+T{
+\f[C]-b thismonth\f[R]
+T}@T{
+all transactions on or after the 1st of the current month
+T}
+T{
+\f[C]-p thismonth\f[R]
+T}@T{
+all transactions in the current month
+T}
+T{
+\f[C]date:2016/3/17-\f[R]
+T}@T{
+the above written as queries instead
+T}
+T{
+\f[C]date:-12/1\f[R]
+T}@T{
+T}
+T{
+\f[C]date:thismonth-\f[R]
+T}@T{
+T}
+T{
+\f[C]date:thismonth\f[R]
+T}@T{
+T}
+.TE
+.SS Report intervals
+.PP
+A report interval can be specified so that commands like register,
+balance and activity will divide their reports into multiple subperiods.
+The basic intervals can be selected with one of \f[C]-D/--daily\f[R],
+\f[C]-W/--weekly\f[R], \f[C]-M/--monthly\f[R], \f[C]-Q/--quarterly\f[R],
+or \f[C]-Y/--yearly\f[R].
+More complex intervals may be specified with a period expression.
+Report intervals can not be specified with a query.
+.SS Period expressions
+.PP
+The \f[C]-p/--period\f[R] option accepts period expressions, a shorthand
+way of expressing a start date, end date, and/or report interval all at
+once.
+.PP
+Here\[aq]s a basic period expression specifying the first quarter of
+2009.
+Note, hledger always treats start dates as inclusive and end dates as
+exclusive:
+.PP
+\f[C]-p \[dq]from 2009/1/1 to 2009/4/1\[dq]\f[R]
+.PP
+Keywords like \[dq]from\[dq] and \[dq]to\[dq] are optional, and so are
+the spaces, as long as you don\[aq]t run two dates together.
+\[dq]to\[dq] can also be written as \[dq]-\[dq].
+These are equivalent to the above:
+.PP
+.TS
+tab(@);
+l.
+T{
+\f[C]-p \[dq]2009/1/1 2009/4/1\[dq]\f[R]
+T}
+T{
+\f[C]-p2009/1/1to2009/4/1\f[R]
+T}
+T{
+\f[C]-p2009/1/1-2009/4/1\f[R]
+T}
+.TE
+.PP
+Dates are smart dates, so if the current year is 2009, the above can
+also be written as:
+.PP
+.TS
+tab(@);
+l.
+T{
+\f[C]-p \[dq]1/1 4/1\[dq]\f[R]
+T}
+T{
+\f[C]-p \[dq]january-apr\[dq]\f[R]
+T}
+T{
+\f[C]-p \[dq]this year to 4/1\[dq]\f[R]
+T}
+.TE
+.PP
+If you specify only one date, the missing start or end date will be the
+earliest or latest transaction in your journal:
+.PP
+.TS
+tab(@);
+l l.
+T{
+\f[C]-p \[dq]from 2009/1/1\[dq]\f[R]
+T}@T{
+everything after january 1, 2009
+T}
+T{
+\f[C]-p \[dq]from 2009/1\[dq]\f[R]
+T}@T{
+the same
+T}
+T{
+\f[C]-p \[dq]from 2009\[dq]\f[R]
+T}@T{
+the same
+T}
+T{
+\f[C]-p \[dq]to 2009\[dq]\f[R]
+T}@T{
+everything before january 1, 2009
+T}
+.TE
+.PP
+A single date with no \[dq]from\[dq] or \[dq]to\[dq] defines both the
+start and end date like so:
+.PP
+.TS
+tab(@);
+l l.
+T{
+\f[C]-p \[dq]2009\[dq]\f[R]
+T}@T{
+the year 2009; equivalent to \[lq]2009/1/1 to 2010/1/1\[rq]
+T}
+T{
+\f[C]-p \[dq]2009/1\[dq]\f[R]
+T}@T{
+the month of jan; equivalent to \[lq]2009/1/1 to 2009/2/1\[rq]
+T}
+T{
+\f[C]-p \[dq]2009/1/1\[dq]\f[R]
+T}@T{
+just that day; equivalent to \[lq]2009/1/1 to 2009/1/2\[rq]
+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],
+\f[C]monthly\f[R], \f[C]quarterly\f[R], or \f[C]yearly\f[R], which have
+the same effect as the
+\f[C]-D\f[R],\f[C]-W\f[R],\f[C]-M\f[R],\f[C]-Q\f[R], or \f[C]-Y\f[R]
+flags.
+Between report interval and start/end dates (if any), the word
+\f[C]in\f[R] is optional.
+Examples:
+.PP
+.TS
+tab(@);
+l.
+T{
+\f[C]-p \[dq]weekly from 2009/1/1 to 2009/4/1\[dq]\f[R]
+T}
+T{
+\f[C]-p \[dq]monthly in 2008\[dq]\f[R]
+T}
+T{
+\f[C]-p \[dq]quarterly\[dq]\f[R]
+T}
+.TE
+.PP
+Note that \f[C]weekly\f[R], \f[C]monthly\f[R], \f[C]quarterly\f[R] and
+\f[C]yearly\f[R] intervals will always start on the first day on week,
+month, quarter or year accordingly, and will end on the last day of same
+period, even if associated period expression specifies different
+explicit start and end date.
+.PP
+For example:
+.PP
+.TS
+tab(@);
+lw(25.5n) lw(44.5n).
+T{
+\f[C]-p \[dq]weekly from 2009/1/1 to 2009/4/1\[dq]\f[R]
+T}@T{
+starts on 2008/12/29, closest preceding Monday
+T}
+T{
+\f[C]-p \[dq]monthly in 2008/11/25\[dq]\f[R]
+T}@T{
+starts on 2018/11/01
+T}
+T{
+\f[C]-p \[dq]quarterly from 2009-05-05 to 2009-06-01\[dq]\f[R]
+T}@T{
+starts on 2009/04/01, ends on 2009/06/30, which are first and last days
+of Q2 2009
+T}
+T{
+\f[C]-p \[dq]yearly from 2009-12-29\[dq]\f[R]
+T}@T{
+starts on 2009/01/01, first day of 2009
+T}
+.TE
+.PP
+The following more complex report intervals are also supported:
+\f[C]biweekly\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
+All of these will start on the first day of the requested period and end
+on the last one, as described above.
+.PP
+Examples:
+.PP
+.TS
+tab(@);
+lw(25.5n) lw(44.5n).
+T{
+\f[C]-p \[dq]bimonthly from 2008\[dq]\f[R]
+T}@T{
+periods will have boundaries on 2008/01/01, 2008/03/01, ...
+T}
+T{
+\f[C]-p \[dq]every 2 weeks\[dq]\f[R]
+T}@T{
+starts on closest preceding Monday
+T}
+T{
+\f[C]-p \[dq]every 5 month from 2009/03\[dq]\f[R]
+T}@T{
+periods will have boundaries on 2009/03/01, 2009/08/01, ...
+T}
+.TE
+.PP
+If you want intervals that start on arbitrary day of your choosing and
+span a week, month or year, you need to use any of the following:
+.PP
+\f[C]every Nth day of week\f[R], \f[C]every <weekday>\f[R],
+\f[C]every Nth day [of month]\f[R],
+\f[C]every Nth weekday [of month]\f[R], \f[C]every MM/DD [of year]\f[R],
+\f[C]every Nth MMM [of year]\f[R], \f[C]every MMM Nth [of year]\f[R].
+.PP
+Examples:
+.PP
+.TS
+tab(@);
+lw(23.9n) lw(46.1n).
+T{
+\f[C]-p \[dq]every 2nd day of week\[dq]\f[R]
+T}@T{
+periods will go from Tue to Tue
+T}
+T{
+\f[C]-p \[dq]every Tue\[dq]\f[R]
+T}@T{
+same
+T}
+T{
+\f[C]-p \[dq]every 15th day\[dq]\f[R]
+T}@T{
+period boundaries will be on 15th of each month
+T}
+T{
+\f[C]-p \[dq]every 2nd Monday\[dq]\f[R]
+T}@T{
+period boundaries will be on second Monday of each month
+T}
+T{
+\f[C]-p \[dq]every 11/05\[dq]\f[R]
+T}@T{
+yearly periods with boundaries on 5th of Nov
+T}
+T{
+\f[C]-p \[dq]every 5th Nov\[dq]\f[R]
+T}@T{
+same
+T}
+T{
+\f[C]-p \[dq]every Nov 5th\[dq]\f[R]
+T}@T{
+same
+T}
+.TE
+.PP
+Show historical balances at end of 15th each month (N is exclusive end
+date):
+.PP
+\f[C]hledger balance -H -p \[dq]every 16th day\[dq]\f[R]
+.PP
+Group postings from start of wednesday to end of next tuesday (N is
+start date and exclusive end date):
+.PP
+\f[C]hledger register checking -p \[dq]every 3rd day of week\[dq]\f[R]
+.SS Depth limiting
+.PP
+With the \f[C]--depth N\f[R] option (short form: \f[C]-N\f[R]), commands
+like account, balance and register will show only the uppermost accounts
+in the account tree, down to level N.
+Use this when you want a summary with less detail.
+This flag has the same effect as a \f[C]depth:\f[R] query argument (so
+\f[C]-2\f[R], \f[C]--depth=2\f[R] or \f[C]depth:2\f[R] are basically
+equivalent).
+.SS Pivoting
+.PP
+Normally hledger sums amounts, and organizes them in a hierarchy, based
+on account name.
+The \f[C]--pivot FIELD\f[R] option causes it to sum and organize
+hierarchy based on the value of some other field instead.
+FIELD can be: \f[C]code\f[R], \f[C]description\f[R], \f[C]payee\f[R],
+\f[C]note\f[R], or the full name (case insensitive) of any tag.
+As with account names, values containing \f[C]colon:separated:parts\f[R]
+will be displayed hierarchically in reports.
+.PP
+\f[C]--pivot\f[R] is a general option affecting all reports; you can
+think of hledger transforming the journal before any other processing,
+replacing every posting\[aq]s account name with the value of the
+specified field on that posting, inheriting it from the transaction or
+using a blank value if it\[aq]s not present.
+.PP
+An example:
+.IP
+.nf
+\f[C]
+2016/02/16 Member Fee Payment
+    assets:bank account                    2 EUR
+    income:member fees                    -2 EUR  ; member: John Doe
+\f[R]
+.fi
+.PP
+Normal balance report showing account names:
+.IP
+.nf
+\f[C]
+$ hledger balance
+               2 EUR  assets:bank account
+              -2 EUR  income:member fees
+--------------------
+                   0
+\f[R]
+.fi
+.PP
+Pivoted balance report, using member: tag values instead:
+.IP
+.nf
+\f[C]
+$ hledger balance --pivot member
+               2 EUR
+              -2 EUR  John Doe
+--------------------
+                   0
+\f[R]
+.fi
+.PP
+One way to show only amounts with a member: value (using a query,
+described below):
+.IP
+.nf
+\f[C]
+$ hledger balance --pivot member tag:member=.
+              -2 EUR  John Doe
+--------------------
+              -2 EUR
+\f[R]
+.fi
+.PP
+Another way (the acct: query matches against the pivoted \[dq]account
+name\[dq]):
+.IP
+.nf
+\f[C]
+$ hledger balance --pivot member acct:.
+              -2 EUR  John Doe
+--------------------
+              -2 EUR
+\f[R]
+.fi
+.SS Valuation
+.SS -B: Cost
+.PP
+The \f[C]-B/--cost\f[R] flag converts amounts to their cost (or selling
+price) at transaction time, if they have a transaction price specified.
+This flag is equivalent to \f[C]--value=cost\f[R], described below.
+.SS -V: Market value
+.PP
+The \f[C]-V/--market\f[R] flag converts reported amounts to their market
+value in a default valuation commodity, using the market prices in
+effect on a default valuation date.
+For single period reports, the valuation date is today (equivalent to
+\f[C]--value=now\f[R]); for multiperiod reports, it is the last day of
+each subperiod (equivalent to \f[C]--value=end\f[R]).
+.PP
+The default valuation commodity is the one referenced in the latest
+applicable market price dated on or before the valuation date.
+If most of your P declarations lead to a single home currency, this will
+usually be what you want.
+(To specify the commodity, see -X below.)
+.PP
+Note that in hledger, market prices are always declared explicitly with
+P directives; we do not infer them from transaction prices as Ledger
+does.
+.PP
+Here\[aq]s a quick example of -V:
+.IP
+.nf
+\f[C]
+; one euro is worth this many dollars from nov 1
+P 2016/11/01 \[Eu] $1.10
+
+; purchase some euros on nov 3
+2016/11/3
+    assets:euros        \[Eu]100
+    assets:checking
+
+; the euro is worth fewer dollars by dec 21
+P 2016/12/21 \[Eu] $1.03
+\f[R]
+.fi
+.PP
+How many euros do I have ?
+.IP
+.nf
+\f[C]
+$ hledger -f t.j bal -N euros
+                \[Eu]100  assets:euros
+\f[R]
+.fi
+.PP
+What are they worth at end of nov 3 ?
+.IP
+.nf
+\f[C]
+$ hledger -f t.j bal -N euros -V -e 2016/11/4
+             $110.00  assets:euros
+\f[R]
+.fi
+.PP
+What are they worth after 2016/12/21 ?
+(no report end date specified, defaults to today)
+.IP
+.nf
+\f[C]
+$ hledger -f t.j bal -N euros -V
+             $103.00  assets:euros
+\f[R]
+.fi
+.SS -X: Market value in specified commodity
+.PP
+The \f[C]-X/--exchange\f[R] option is like \f[C]-V\f[R], except it
+specifies the target commodity you would like to convert to.
+It is equivalent to \f[C]--value=now,COMM\f[R] or
+\f[C]--value=end,COMM\f[R].
+.SS --value: Flexible valuation
+.PP
+\f[I](experimental, added 201905)\f[R]
+.PP
+\f[C]-B\f[R], \f[C]-V\f[R] and \f[C]-X\f[R] are special cases of the
+more general \f[C]--value\f[R] option:
+.IP
+.nf
+\f[C]
+ --value=TYPE[,COMM]  TYPE is cost, then, end, now or YYYY-MM-DD.
+                      COMM is an optional commodity symbol.
+                      Shows amounts converted to:
+                      - cost commodity using transaction prices (then optionally to COMM using market prices at period end(s))
+                      - default valuation commodity (or COMM) using market prices at posting dates
+                      - default valuation commodity (or COMM) using market prices at period end(s)
+                      - default valuation commodity (or COMM) using current market prices
+                      - default valuation commodity (or COMM) using market prices at some date
+\f[R]
+.fi
+.PP
+The TYPE part basically selects either \[dq]cost\[dq], or \[dq]market
+value\[dq] plus a valuation date:
+.TP
+\f[B]\f[CB]--value=cost\f[B]\f[R]
+Convert amounts to cost, using the prices recorded in transactions.
+.TP
+\f[B]\f[CB]--value=then\f[B]\f[R]
+Convert amounts to their value in a default valuation commodity, using
+market prices on each posting\[aq]s date.
+This is currently supported only by the print and register commands.
+.TP
+\f[B]\f[CB]--value=end\f[B]\f[R]
+Convert amounts to their value in a default valuation commodity, using
+market prices on the last day of the report period (or if unspecified,
+the journal\[aq]s end date); or in multiperiod reports, market prices on
+the last day of each subperiod.
+.TP
+\f[B]\f[CB]--value=now\f[B]\f[R]
+Convert amounts to their value in default valuation commodity using
+current market prices (as of when report is generated).
+.TP
+\f[B]\f[CB]--value=YYYY-MM-DD\f[B]\f[R]
+Convert amounts to their value in default valuation commodity using
+market prices on this date.
+.PP
+The default valuation commodity is the commodity mentioned in the most
+recent applicable market price declaration.
+When all your price declarations lead to a single home currency, this
+will usually do what you want.
+.PP
+To select a different valuation commodity, add the optional
+\f[C],COMM\f[R] part: a comma, then the target commodity\[aq]s symbol.
+Eg: \f[B]\f[CB]--value=now,EUR\f[B]\f[R].
+hledger will do its best to convert amounts to this commodity, using:
+.IP \[bu] 2
+declared prices (from source commodity to valuation commodity)
+.IP \[bu] 2
+reverse prices (declared prices from valuation to source commodity,
+inverted)
+.IP \[bu] 2
+indirect prices (prices calculated from the shortest chain of declared
+or reverse prices from source to valuation commodity)
+.PP
+in that order.
+.PP
+Here are some examples showing the effect of \f[C]--value\f[R] as seen
+with \f[C]print\f[R]:
+.IP
+.nf
+\f[C]
+P 2000-01-01 A  1 B
+P 2000-02-01 A  2 B
+P 2000-03-01 A  3 B
+P 2000-04-01 A  4 B
+
+2000-01-01
+  (a)      1 A \[at] 5 B
+
+2000-02-01
+  (a)      1 A \[at] 6 B
+
+2000-03-01
+  (a)      1 A \[at] 7 B
+\f[R]
+.fi
+.PP
+Show the cost of each posting:
+.IP
+.nf
+\f[C]
+$ hledger -f- print --value=cost
+2000-01-01
+    (a)             5 B
+
+2000-02-01
+    (a)             6 B
+
+2000-03-01
+    (a)             7 B
+\f[R]
+.fi
+.PP
+Show the value as of the last day of the report period (2000-02-29):
+.IP
+.nf
+\f[C]
+$ hledger -f- print --value=end date:2000/01-2000/03
+2000-01-01
+    (a)             2 B
+
+2000-02-01
+    (a)             2 B
+\f[R]
+.fi
+.PP
+With no report period specified, that shows the value as of the last day
+of the journal (2000-03-01):
+.IP
+.nf
+\f[C]
+$ hledger -f- print --value=end
+2000-01-01
+    (a)             3 B
+
+2000-02-01
+    (a)             3 B
+
+2000-03-01
+    (a)             3 B
+\f[R]
+.fi
+.PP
+Show the current value (the 2000-04-01 price is still in effect today):
+.IP
+.nf
+\f[C]
+$ hledger -f- print --value=now
+2000-01-01
+    (a)             4 B
+
+2000-02-01
+    (a)             4 B
+
+2000-03-01
+    (a)             4 B
+\f[R]
+.fi
+.PP
+Show the value on 2000/01/15:
+.IP
+.nf
+\f[C]
+$ hledger -f- print --value=2000-01-15
+2000-01-01
+    (a)             1 B
+
+2000-02-01
+    (a)             1 B
+
+2000-03-01
+    (a)             1 B
+\f[R]
+.fi
+.PP
+You may need to explicitly set a commodity\[aq]s display style, when
+reverse prices are used.
+Eg this output might be surprising:
+.IP
+.nf
+\f[C]
+P 2000-01-01 A 2B
+
+2000-01-01
+  a  1B
+  b
+\f[R]
+.fi
+.IP
+.nf
+\f[C]
+$ hledger print -x -X A
+2000-01-01
+    a               0
+    b               0
+\f[R]
+.fi
+.PP
+Explanation: because there\[aq]s no amount or commodity directive
+specifying a display style for A, 0.5A gets the default style, which
+shows no decimal digits.
+Because the displayed amount looks like zero, the commodity symbol and
+minus sign are not displayed either.
+Adding a commodity directive sets a more useful display style for A:
+.IP
+.nf
+\f[C]
+P 2000-01-01 A 2B
+commodity 0.00A
+
+2000-01-01
+  a  1B
+  b
+\f[R]
+.fi
+.IP
+.nf
+\f[C]
+$ hledger print -X A
+2000-01-01
+    a           0.50A
+    b          -0.50A
+\f[R]
+.fi
+.SS Effect of --value on reports
+.PP
+Here is a reference for how \f[C]--value\f[R] currently affects each
+part of hledger\[aq]s reports.
+It\[aq]s work in progress, but may be useful for troubleshooting or
+reporting bugs.
+See also the definitions and notes below.
+If you find problems, please report them, ideally with a reproducible
+example.
+Related: #329, #1083.
+.PP
+.TS
+tab(@);
+lw(11.7n) lw(11.2n) lw(11.9n) lw(13.1n) lw(12.4n) lw(9.8n).
+T{
+Report type
+T}@T{
+\f[C]-B\f[R], \f[C]--value=cost\f[R]
+T}@T{
+\f[C]-V\f[R], \f[C]-X\f[R]
+T}@T{
+\f[C]--value=then\f[R]
+T}@T{
+\f[C]--value=end\f[R]
+T}@T{
+\f[C]--value=DATE\f[R], \f[C]--value=now\f[R]
+T}
+_
+T{
+\f[B]print\f[R]
+T}@T{
+T}@T{
+T}@T{
+T}@T{
+T}@T{
+T}
+T{
+posting amounts
+T}@T{
+cost
+T}@T{
+value at report end or today
+T}@T{
+value at posting date
+T}@T{
+value at report or journal end
+T}@T{
+value at DATE/today
+T}
+T{
+balance assertions / assignments
+T}@T{
+unchanged
+T}@T{
+unchanged
+T}@T{
+unchanged
+T}@T{
+unchanged
+T}@T{
+unchanged
+T}
+T{
+T}@T{
+T}@T{
+T}@T{
+T}@T{
+T}@T{
+T}
+T{
+\f[B]register\f[R]
+T}@T{
+T}@T{
+T}@T{
+T}@T{
+T}@T{
+T}
+T{
+starting balance (with -H)
+T}@T{
+cost
+T}@T{
+value at day before report or journal start
+T}@T{
+not supported
+T}@T{
+value at day before report or journal start
+T}@T{
+value at DATE/today
+T}
+T{
+posting amounts (no report interval)
+T}@T{
+cost
+T}@T{
+value at report end or today
+T}@T{
+value at posting date
+T}@T{
+value at report or journal end
+T}@T{
+value at DATE/today
+T}
+T{
+summary posting amounts (with report interval)
+T}@T{
+summarised cost
+T}@T{
+value at period ends
+T}@T{
+sum of postings in interval, valued at interval start
+T}@T{
+value at period ends
+T}@T{
+value at DATE/today
+T}
+T{
+running total/average
+T}@T{
+sum/average of displayed values
+T}@T{
+sum/average of displayed values
+T}@T{
+sum/average of displayed values
+T}@T{
+sum/average of displayed values
+T}@T{
+sum/average of displayed values
+T}
+T{
+T}@T{
+T}@T{
+T}@T{
+T}@T{
+T}@T{
+T}
+T{
+\f[B]balance (bs, bse, cf, is..)\f[R]
+T}@T{
+T}@T{
+T}@T{
+T}@T{
+T}@T{
+T}
+T{
+balances (no report interval)
+T}@T{
+sums of costs
+T}@T{
+value at report end or today of sums of postings
+T}@T{
+not supported
+T}@T{
+value at report or journal end of sums of postings
+T}@T{
+value at DATE/today of sums of postings
+T}
+T{
+balances (with report interval)
+T}@T{
+sums of costs
+T}@T{
+value at period ends of sums of postings
+T}@T{
+not supported
+T}@T{
+value at period ends of sums of postings
+T}@T{
+value at DATE/today of sums of postings
+T}
+T{
+starting balances (with report interval and -H)
+T}@T{
+sums of costs of postings before report start
+T}@T{
+sums of postings before report start
+T}@T{
+not supported
+T}@T{
+sums of postings before report start
+T}@T{
+sums of postings before report start
+T}
+T{
+budget amounts with --budget
+T}@T{
+like balances
+T}@T{
+like balances
+T}@T{
+not supported
+T}@T{
+like balances
+T}@T{
+like balances
+T}
+T{
+grand total (no report interval)
+T}@T{
+sum of displayed values
+T}@T{
+sum of displayed values
+T}@T{
+not supported
+T}@T{
+sum of displayed values
+T}@T{
+sum of displayed values
+T}
+T{
+row totals/averages (with report interval)
+T}@T{
+sums/averages of displayed values
+T}@T{
+sums/averages of displayed values
+T}@T{
+not supported
+T}@T{
+sums/averages of displayed values
+T}@T{
+sums/averages of displayed values
+T}
+T{
+column totals
+T}@T{
+sums of displayed values
+T}@T{
+sums of displayed values
+T}@T{
+not supported
+T}@T{
+sums of displayed values
+T}@T{
+sums of displayed values
+T}
+T{
+grand total/average
+T}@T{
+sum/average of column totals
+T}@T{
+sum/average of column totals
+T}@T{
+not supported
+T}@T{
+sum/average of column totals
+T}@T{
+sum/average of column totals
+T}
+T{
+T}@T{
+T}@T{
+T}@T{
+T}@T{
+T}@T{
+T}
+.TE
+.PP
+\f[B]Additional notes\f[R]
+.TP
+\f[I]cost\f[R]
+calculated using price(s) recorded in the transaction(s).
+.TP
+\f[I]value\f[R]
+market value using available market price declarations, or the unchanged
+amount if no conversion rate can be found.
+.TP
+\f[I]report start\f[R]
+the first day of the report period specified with -b or -p or date:,
+otherwise today.
+.TP
+\f[I]report or journal start\f[R]
+the first day of the report period specified with -b or -p or date:,
+otherwise the earliest transaction date in the journal, otherwise today.
+.TP
+\f[I]report end\f[R]
+the last day of the report period specified with -e or -p or date:,
+otherwise today.
+.TP
+\f[I]report or journal end\f[R]
+the last day of the report period specified with -e or -p or date:,
+otherwise the latest transaction date in the journal, otherwise today.
+.TP
+\f[I]report interval\f[R]
+a flag (-D/-W/-M/-Q/-Y) or period expression that activates the
+report\[aq]s multi-period mode (whether showing one or many subperiods).
+.SS Combining -B, -V, -X, --value
+.PP
+The rightmost of these flags wins.
+.SH COMMANDS
+.PP
+hledger provides a number of subcommands; \f[C]hledger\f[R] with no
+arguments shows a list.
+.PP
+If you install additional \f[C]hledger-*\f[R] packages, or if you put
+programs or scripts named \f[C]hledger-NAME\f[R] in your PATH, these
+will also be listed as subcommands.
+.PP
+Run a subcommand by writing its name as first argument (eg
+\f[C]hledger incomestatement\f[R]).
+You can also write one of the standard short aliases displayed in
+parentheses in the command list (\f[C]hledger b\f[R]), or any any
+unambiguous prefix of a command name (\f[C]hledger inc\f[R]).
+.PP
+Here are all the builtin commands in alphabetical order.
+See also \f[C]hledger\f[R] for a more organised command list, and
+\f[C]hledger CMD -h\f[R] for detailed command help.
+.SS accounts
+.PP
+accounts, a
+.PD 0
+.P
+.PD
+Show account names.
+.PP
+This command lists account names, either declared with account
+directives (--declared), posted to (--used), or both (the default).
+With query arguments, only matched account names and account names
+referenced by matched postings are shown.
+It shows a flat list by default.
+With \f[C]--tree\f[R], it uses indentation to show the account
+hierarchy.
+In flat mode you can add \f[C]--drop N\f[R] to omit the first few
+account name components.
+Account names can be depth-clipped with \f[C]depth:N\f[R] or
+\f[C]--depth N\f[R] or \f[C]-N\f[R].
+.PP
+Examples:
+.IP
+.nf
+\f[C]
+$ hledger accounts
+assets:bank:checking
+assets:bank:saving
+assets:cash
+expenses:food
+expenses:supplies
+income:gifts
+income:salary
+liabilities:debts
+\f[R]
+.fi
+.SS activity
+.PP
+activity
+.PD 0
+.P
+.PD
+Show an ascii barchart of posting counts per interval.
+.PP
+The activity command displays an ascii histogram showing transaction
+counts by day, week, month or other reporting interval (by day is the
+default).
+With query arguments, it counts only matched transactions.
+.PP
+Examples:
+.IP
+.nf
+\f[C]
+$ hledger activity --quarterly
+2008-01-01 **
+2008-04-01 *******
+2008-07-01 
+2008-10-01 **
+\f[R]
+.fi
+.SS add
+.PP
+add
+.PD 0
+.P
+.PD
+Prompt for transactions and add them to the journal.
+.PP
+Many hledger users edit their journals directly with a text editor, or
+generate them from CSV.
+For more interactive data entry, there is the \f[C]add\f[R] command,
+which prompts interactively on the console for new transactions, and
+appends them to the journal file (if there are multiple
+\f[C]-f FILE\f[R] options, the first file is used.) Existing
+transactions are not changed.
+This is the only hledger command that writes to the journal file.
+.PP
+To use it, just run \f[C]hledger add\f[R] and follow the prompts.
+You can add as many transactions as you like; when you are finished,
+enter \f[C].\f[R] or press control-d or control-c to exit.
+.PP
+Features:
+.IP \[bu] 2
+add tries to provide useful defaults, using the most similar (by
+description) recent transaction (filtered by the query, if any) as a
+template.
+.IP \[bu] 2
+You can also set the initial defaults with command line arguments.
+.IP \[bu] 2
+Readline-style edit keys can be used during data entry.
+.IP \[bu] 2
+The tab key will auto-complete whenever possible - accounts,
+descriptions, dates (\f[C]yesterday\f[R], \f[C]today\f[R],
+\f[C]tomorrow\f[R]).
+If the input area is empty, it will insert the default value.
+.IP \[bu] 2
+If the journal defines a default commodity, it will be added to any bare
+numbers entered.
+.IP \[bu] 2
+A parenthesised transaction code may be entered following a date.
+.IP \[bu] 2
+Comments and tags may be entered following a description or amount.
+.IP \[bu] 2
+If you make a mistake, enter \f[C]<\f[R] at any prompt to go one step
+backward.
+.IP \[bu] 2
+Input prompts are displayed in a different colour when the terminal
+supports it.
+.PP
+Example (see the tutorial for a detailed explanation):
+.IP
+.nf
+\f[C]
+$ hledger add
+Adding transactions to journal file /src/hledger/examples/sample.journal
+Any command line arguments will be used as defaults.
+Use tab key to complete, readline keys to edit, enter to accept defaults.
+An optional (CODE) may follow transaction dates.
+An optional ; COMMENT may follow descriptions or amounts.
+If you make a mistake, enter < at any prompt to go one step backward.
+To end a transaction, enter . when prompted.
+To quit, enter . at a date prompt or press control-d or control-c.
+Date [2015/05/22]: 
+Description: supermarket
+Account 1: expenses:food
+Amount  1: $10
+Account 2: assets:checking
+Amount  2 [$-10.0]: 
+Account 3 (or . or enter to finish this transaction): .
+2015/05/22 supermarket
+    expenses:food             $10
+    assets:checking        $-10.0
+
+Save this transaction to the journal ? [y]: 
+Saved.
+Starting the next transaction (. or ctrl-D/ctrl-C to quit)
+Date [2015/05/22]: <CTRL-D> $
+\f[R]
+.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).
+.SS balance
+.PP
+balance, bal, b
+.PD 0
+.P
+.PD
+Show accounts and their balances.
+.PP
+The balance command is hledger\[aq]s most versatile command.
+Note, despite the name, it is not always used for showing real-world
+account balances; the more accounting-aware balancesheet and
+incomestatement may be more convenient for that.
+.PP
+By default, it displays all accounts, and each account\[aq]s change in
+balance during the entire period of the journal.
+Balance changes are calculated by adding up the postings in each
+account.
+You can limit the postings matched, by a query, to see fewer accounts,
+changes over a different time period, changes from only cleared
+transactions, etc.
+.PP
+If you include an account\[aq]s complete history of postings in the
+report, the balance change is equivalent to the account\[aq]s current
+ending balance.
+For a real-world account, typically you won\[aq]t have all transactions
+in the journal; instead you\[aq]ll have all transactions after a certain
+date, and an \[dq]opening balances\[dq] transaction setting the correct
+starting balance on that date.
+Then the balance command will show real-world account balances.
+In some cases the -H/--historical flag is used to ensure this (more
+below).
+.PP
+The balance command can produce several styles of report:
+.SS Classic balance report
+.PP
+This is the original balance report, as found in Ledger.
+It usually looks like this:
+.IP
+.nf
+\f[C]
+$ hledger balance
+                 $-1  assets
+                  $1    bank:saving
+                 $-2    cash
+                  $2  expenses
+                  $1    food
+                  $1    supplies
+                 $-2  income
+                 $-1    gifts
+                 $-1    salary
+                  $1  liabilities:debts
+--------------------
+                   0
+\f[R]
+.fi
+.PP
+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 \f[C]-S/--sort-amount\f[R], by their balance amount.
+.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
+compact output.
+(Eg above, the \[dq]liabilities\[dq] account.) Use \f[C]--no-elide\f[R]
+to prevent this.
+.PP
+Account balances are \[dq]inclusive\[dq] - they include the balances of
+any subaccounts.
+.PP
+Accounts which have zero balance (and no non-zero subaccounts) are
+omitted.
+Use \f[C]-E/--empty\f[R] to show them.
+.PP
+A final total is displayed by default; use \f[C]-N/--no-total\f[R] to
+suppress it, eg:
+.IP
+.nf
+\f[C]
+$ hledger balance -p 2008/6 expenses --no-total
+                  $2  expenses
+                  $1    food
+                  $1    supplies
+\f[R]
+.fi
+.SS Customising the classic balance report
+.PP
+You can customise the layout of classic balance reports with
+\f[C]--format FMT\f[R]:
+.IP
+.nf
+\f[C]
+$ hledger balance --format \[dq]%20(account) %12(total)\[dq]
+              assets          $-1
+         bank:saving           $1
+                cash          $-2
+            expenses           $2
+                food           $1
+            supplies           $1
+              income          $-2
+               gifts          $-1
+              salary          $-1
+   liabilities:debts           $1
+---------------------------------
+                                0
+\f[R]
+.fi
+.PP
+The FMT format string (plus a newline) specifies the formatting applied
+to each account/balance pair.
+It may contain any suitable text, with data fields interpolated like so:
+.PP
+\f[C]%[MIN][.MAX](FIELDNAME)\f[R]
+.IP \[bu] 2
+MIN pads with spaces to at least this width (optional)
+.IP \[bu] 2
+MAX truncates at this width (optional)
+.IP \[bu] 2
+FIELDNAME must be enclosed in parentheses, and can be one of:
+.RS 2
+.IP \[bu] 2
+\f[C]depth_spacer\f[R] - a number of spaces equal to the account\[aq]s
+depth, or if MIN is specified, MIN * depth spaces.
+.IP \[bu] 2
+\f[C]account\f[R] - the account\[aq]s name
+.IP \[bu] 2
+\f[C]total\f[R] - the account\[aq]s balance/posted total, right
+justified
+.RE
+.PP
+Also, FMT can begin with an optional prefix to control how
+multi-commodity amounts are rendered:
+.IP \[bu] 2
+\f[C]%_\f[R] - render on multiple lines, bottom-aligned (the default)
+.IP \[bu] 2
+\f[C]%\[ha]\f[R] - render on multiple lines, top-aligned
+.IP \[bu] 2
+\f[C]%,\f[R] - render on one line, comma-separated
+.PP
+There are some quirks.
+Eg in one-line mode, \f[C]%(depth_spacer)\f[R] has no effect, instead
+\f[C]%(account)\f[R] has indentation built in.
+Experimentation may be needed to get pleasing results.
+.PP
+Some example formats:
+.IP \[bu] 2
+\f[C]%(total)\f[R] - the account\[aq]s total
+.IP \[bu] 2
+\f[C]%-20.20(account)\f[R] - the account\[aq]s name, left justified,
+padded to 20 characters and clipped at 20 characters
+.IP \[bu] 2
+\f[C]%,%-50(account)  %25(total)\f[R] - account name padded to 50
+characters, total padded to 20 characters, with multiple commodities
+rendered on one line
+.IP \[bu] 2
+\f[C]%20(total)  %2(depth_spacer)%-(account)\f[R] - the default format
+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
+.SS Flat mode
+.PP
+To see a flat list instead of the default hierarchical display, use
+\f[C]--flat\f[R].
+In this mode, accounts (unless depth-clipped) show their full names and
+\[dq]exclusive\[dq] balance, excluding any subaccount balances.
+In this mode, you can also use \f[C]--drop N\f[R] to omit the first few
+account name components.
+.IP
+.nf
+\f[C]
+$ hledger balance -p 2008/6 expenses -N --flat --drop 1
+                  $1  food
+                  $1  supplies
+\f[R]
+.fi
+.SS Depth limited balance reports
+.PP
+With \f[C]--depth N\f[R] or \f[C]depth:N\f[R] or just \f[C]-N\f[R],
+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.
+.IP
+.nf
+\f[C]
+$ hledger balance -N -1
+                 $-1  assets
+                  $2  expenses
+                 $-2  income
+                  $1  liabilities
+\f[R]
+.fi
+.PP
+Flat-mode balance reports, which normally show exclusive balances, show
+inclusive balances at the depth limit.
+.SS Percentages
+.PP
+With \f[C]-%\f[R] or \f[C]--percent\f[R], balance reports show each
+account\[aq]s value expressed as a percentage of the column\[aq]s total.
+This is useful to get an overview of the relative sizes of account
+balances.
+For example to obtain an overview of expenses:
+.IP
+.nf
+\f[C]
+$ hledger balance expenses -%
+             100.0 %  expenses
+              50.0 %    food
+              50.0 %    supplies
+--------------------
+             100.0 %
+\f[R]
+.fi
+.PP
+Note that \f[C]--tree\f[R] does not have an effect on \f[C]-%\f[R].
+The percentages are always relative to the total sum of each column,
+they are never relative to the parent account.
+.PP
+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
+\f[C]hledger balance -B\f[R]) all percentage values will be zero.
+.PP
+This flag does not work if the report contains any mixed commodity
+accounts.
+If there are mixed commodity accounts in the report be sure to use
+\f[C]-V\f[R] or \f[C]-B\f[R] to coerce the report into using a single
+commodity.
+.SS Multicolumn balance report
+.PP
+Multicolumn or tabular balance reports are a very useful hledger
+feature, and usually the preferred style.
+They share many of the above features, but they show the report as a
+table, with columns representing time periods.
+This mode is activated by providing a reporting interval.
+.PP
+There are three types of multicolumn balance report, showing different
+information:
+.IP "1." 3
+By default: each column shows the sum of postings in that period, ie the
+account\[aq]s change of balance in that period.
+This is useful eg for a monthly income statement:
+.RS 4
+.IP
+.nf
+\f[C]
+$ hledger balance --quarterly income expenses -E
+Balance changes in 2008:
+
+                   ||  2008q1  2008q2  2008q3  2008q4 
+===================++=================================
+ expenses:food     ||       0      $1       0       0 
+ expenses:supplies ||       0      $1       0       0 
+ income:gifts      ||       0     $-1       0       0 
+ income:salary     ||     $-1       0       0       0 
+-------------------++---------------------------------
+                   ||     $-1      $1       0       0 
+\f[R]
+.fi
+.RE
+.IP "2." 3
+With \f[C]--cumulative\f[R]: each column shows the ending balance for
+that period, accumulating the changes across periods, starting from 0 at
+the report start date:
+.RS 4
+.IP
+.nf
+\f[C]
+$ hledger balance --quarterly income expenses -E --cumulative
+Ending balances (cumulative) in 2008:
+
+                   ||  2008/03/31  2008/06/30  2008/09/30  2008/12/31 
+===================++=================================================
+ expenses:food     ||           0          $1          $1          $1 
+ expenses:supplies ||           0          $1          $1          $1 
+ income:gifts      ||           0         $-1         $-1         $-1 
+ income:salary     ||         $-1         $-1         $-1         $-1 
+-------------------++-------------------------------------------------
+                   ||         $-1           0           0           0 
+\f[R]
+.fi
+.RE
+.IP "3." 3
+With \f[C]--historical/-H\f[R]: 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 useful eg for a multi-period balance sheet, and when you are
+showing only the data after a certain start date:
+.RS 4
+.IP
+.nf
+\f[C]
+$ hledger balance \[ha]assets \[ha]liabilities --quarterly --historical --begin 2008/4/1
+Ending balances (historical) in 2008/04/01-2008/12/31:
+
+                      ||  2008/06/30  2008/09/30  2008/12/31 
+======================++=====================================
+ assets:bank:checking ||          $1          $1           0 
+ assets:bank:saving   ||          $1          $1          $1 
+ assets:cash          ||         $-2         $-2         $-2 
+ liabilities:debts    ||           0           0          $1 
+----------------------++-------------------------------------
+                      ||           0           0           0 
+\f[R]
+.fi
+.RE
+.PP
+Note that \f[C]--cumulative\f[R] or \f[C]--historical/-H\f[R] disable
+\f[C]--row-total/-T\f[R], since summing end balances generally does not
+make sense.
+.PP
+Multicolumn balance reports display accounts in flat mode by default; to
+see the hierarchy, use \f[C]--tree\f[R].
+.PP
+With a reporting interval (like \f[C]--quarterly\f[R] 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 periods will be \[dq]full\[dq] and
+comparable to the others.
+.PP
+The \f[C]-E/--empty\f[R] flag does two things in multicolumn balance
+reports: first, the report will show all columns within the specified
+report period (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).
+.PP
+The \f[C]-T/--row-total\f[R] flag adds an additional column showing the
+total for each row.
+.PP
+The \f[C]-A/--average\f[R] flag adds a column showing the average value
+in each row.
+.PP
+Here\[aq]s an example of all three:
+.IP
+.nf
+\f[C]
+$ hledger balance -Q income expenses --tree -ETA
+Balance changes in 2008:
+
+            ||  2008q1  2008q2  2008q3  2008q4    Total  Average 
+============++===================================================
+ expenses   ||       0      $2       0       0       $2       $1 
+   food     ||       0      $1       0       0       $1        0 
+   supplies ||       0      $1       0       0       $1        0 
+ income     ||     $-1     $-1       0       0      $-2      $-1 
+   gifts    ||       0     $-1       0       0      $-1        0 
+   salary   ||     $-1       0       0       0      $-1        0 
+------------++---------------------------------------------------
+            ||     $-1      $1       0       0        0        0 
+
+(Average is rounded to the dollar here since all journal amounts are)
+\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.
+.SS Budget report
+.PP
+With \f[C]--budget\f[R], 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 income, expenses,
+time usage, etc.
+--budget is most often combined with a report interval.
+.PP
+For example, you can take average monthly expenses in the common expense
+categories to construct a minimal monthly budget:
+.IP
+.nf
+\f[C]
+;; Budget
+\[ti] monthly
+  income  $2000
+  expenses:food    $400
+  expenses:bus     $50
+  expenses:movies  $30
+  assets:bank:checking
+
+;; Two months worth of expenses
+2017-11-01
+  income  $1950
+  expenses:food    $396
+  expenses:bus     $49
+  expenses:movies  $30
+  expenses:supplies  $20
+  assets:bank:checking
+
+2017-12-01
+  income  $2100
+  expenses:food    $412
+  expenses:bus     $53
+  expenses:gifts   $100
+  assets:bank:checking
+\f[R]
+.fi
+.PP
+You can now see a monthly budget report:
+.IP
+.nf
+\f[C]
+$ hledger balance -M --budget
+Budget performance in 2017/11/01-2017/12/31:
+
+                      ||                      Nov                       Dec 
+======================++====================================================
+ assets               || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
+ assets:bank          || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
+ assets:bank:checking || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
+ expenses             ||   $495 [ 103% of   $480]    $565 [ 118% of   $480] 
+ expenses:bus         ||    $49 [  98% of    $50]     $53 [ 106% of    $50] 
+ expenses:food        ||   $396 [  99% of   $400]    $412 [ 103% of   $400] 
+ expenses:movies      ||    $30 [ 100% of    $30]       0 [   0% of    $30] 
+ income               ||  $1950 [  98% of  $2000]   $2100 [ 105% of  $2000] 
+----------------------++----------------------------------------------------
+                      ||      0 [              0]       0 [              0] 
+\f[R]
+.fi
+.PP
+Note this is different from a normal balance report in several ways:
+.IP \[bu] 2
+Only accounts with budget goals during the report period are shown, by
+default.
+.IP \[bu] 2
+In each column, in square brackets after the actual amount, budgeted
+amounts are shown, along with the percentage of budget used.
+.IP \[bu] 2
+All parent accounts are always shown, even in flat mode.
+Eg assets, assets:bank, and expenses above.
+.IP \[bu] 2
+Amounts always include all subaccounts, budgeted or unbudgeted, even in
+flat mode.
+.PP
+This means that the numbers displayed will not always add up! Eg above,
+the \f[C]expenses\f[R] actual amount includes the gifts and supplies
+transactions, but the \f[C]expenses:gifts\f[R] and
+\f[C]expenses:supplies\f[R] accounts are not shown, as they have no
+budget amounts declared.
+.PP
+This can be confusing.
+When you need to make things clearer, use the \f[C]-E/--empty\f[R] flag,
+which will reveal all accounts including unbudgeted ones, giving the
+full picture.
+Eg:
+.IP
+.nf
+\f[C]
+$ hledger balance -M --budget --empty
+Budget performance in 2017/11/01-2017/12/31:
+
+                      ||                      Nov                       Dec 
+======================++====================================================
+ assets               || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
+ assets:bank          || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
+ assets:bank:checking || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
+ expenses             ||   $495 [ 103% of   $480]    $565 [ 118% of   $480] 
+ expenses:bus         ||    $49 [  98% of    $50]     $53 [ 106% of    $50] 
+ expenses:food        ||   $396 [  99% of   $400]    $412 [ 103% of   $400] 
+ expenses:gifts       ||      0                      $100                   
+ expenses:movies      ||    $30 [ 100% of    $30]       0 [   0% of    $30] 
+ expenses:supplies    ||    $20                         0                   
+ income               ||  $1950 [  98% of  $2000]   $2100 [ 105% of  $2000] 
+----------------------++----------------------------------------------------
+                      ||      0 [              0]       0 [              0] 
+\f[R]
+.fi
+.PP
+You can roll over unspent budgets to next period with
+\f[C]--cumulative\f[R]:
+.IP
+.nf
+\f[C]
+$ hledger balance -M --budget --cumulative
+Budget performance in 2017/11/01-2017/12/31:
+
+                      ||                      Nov                       Dec 
+======================++====================================================
+ assets               || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960] 
+ assets:bank          || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960] 
+ assets:bank:checking || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960] 
+ expenses             ||   $495 [ 103% of   $480]   $1060 [ 110% of   $960] 
+ expenses:bus         ||    $49 [  98% of    $50]    $102 [ 102% of   $100] 
+ expenses:food        ||   $396 [  99% of   $400]    $808 [ 101% of   $800] 
+ expenses:movies      ||    $30 [ 100% of    $30]     $30 [  50% of    $60] 
+ income               ||  $1950 [  98% of  $2000]   $4050 [ 101% of  $4000] 
+----------------------++----------------------------------------------------
+                      ||      0 [              0]       0 [              0] 
+\f[R]
+.fi
+.PP
+For more examples, see Budgeting and Forecasting.
+.SS Nested budgets
+.PP
+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 budget(s) of the child account(s) would be added to the budget of
+their parent, much like account balances behave.
+.PP
+In the most simple case this means that once you add a budget to any
+account, all its parents would have budget as well.
+.PP
+To illustrate this, consider the following budget:
+.IP
+.nf
+\f[C]
+\[ti] monthly from 2019/01
+    expenses:personal             $1,000.00
+    expenses:personal:electronics    $100.00
+    liabilities
+\f[R]
+.fi
+.PP
+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 \f[C]expenses:personal\f[R] and
+\f[C]expenses\f[R] is $1100.
+.PP
+Transactions in \f[C]expenses:personal:electronics\f[R] will be counted
+both towards its $100 budget and $1100 of \f[C]expenses:personal\f[R] ,
+and transactions in any other subaccount of \f[C]expenses:personal\f[R]
+would be counted towards only towards the budget of
+\f[C]expenses:personal\f[R].
+.PP
+For example, let\[aq]s consider these transactions:
+.IP
+.nf
+\f[C]
+\[ti] monthly from 2019/01
+    expenses:personal             $1,000.00
+    expenses:personal:electronics    $100.00
+    liabilities
+
+2019/01/01 Google home hub
+    expenses:personal:electronics          $90.00
+    liabilities                           $-90.00
+
+2019/01/02 Phone screen protector
+    expenses:personal:electronics:upgrades          $10.00
+    liabilities
+
+2019/01/02 Weekly train ticket
+    expenses:personal:train tickets       $153.00
+    liabilities
+
+2019/01/03 Flowers
+    expenses:personal          $30.00
+    liabilities
+\f[R]
+.fi
+.PP
+As you can see, we have transactions in
+\f[C]expenses:personal:electronics:upgrades\f[R] and
+\f[C]expenses:personal:train tickets\f[R], and since both of these
+accounts are without explicitly defined budget, these transactions would
+be counted towards budgets of \f[C]expenses:personal:electronics\f[R]
+and \f[C]expenses:personal\f[R] accordingly:
+.IP
+.nf
+\f[C]
+$ hledger balance --budget -M
+Budget performance in 2019/01:
+
+                               ||                           Jan 
+===============================++===============================
+ expenses                      ||  $283.00 [  26% of  $1100.00] 
+ expenses:personal             ||  $283.00 [  26% of  $1100.00] 
+ expenses:personal:electronics ||  $100.00 [ 100% of   $100.00] 
+ liabilities                   || $-283.00 [  26% of $-1100.00] 
+-------------------------------++-------------------------------
+                               ||        0 [                 0] 
+\f[R]
+.fi
+.PP
+And with \f[C]--empty\f[R], we can get a better picture of budget
+allocation and consumption:
+.IP
+.nf
+\f[C]
+$ hledger balance --budget -M --empty
+Budget performance in 2019/01:
+
+                                        ||                           Jan 
+========================================++===============================
+ expenses                               ||  $283.00 [  26% of  $1100.00] 
+ expenses:personal                      ||  $283.00 [  26% of  $1100.00] 
+ expenses:personal:electronics          ||  $100.00 [ 100% of   $100.00] 
+ expenses:personal:electronics:upgrades ||   $10.00                      
+ expenses:personal:train tickets        ||  $153.00                      
+ liabilities                            || $-283.00 [  26% of $-1100.00] 
+----------------------------------------++-------------------------------
+                                        ||        0 [                 0] 
+\f[R]
+.fi
+.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],
+(multicolumn non-budget reports only) \f[C]html\f[R], and (experimental)
+\f[C]json\f[R].
+.SS balancesheet
+.PP
+balancesheet, bs
+.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).
+.PP
+Note this report shows all account balances with normal positive sign
+(like conventional financial statements, unlike balance/print/register)
+(experimental).
+.PP
+Example:
+.IP
+.nf
+\f[C]
+$ hledger balancesheet
+Balance Sheet
+
+Assets:
+                 $-1  assets
+                  $1    bank:saving
+                 $-2    cash
+--------------------
+                 $-1
+
+Liabilities:
+                  $1  liabilities:debts
+--------------------
+                  $1
+
+Total:
+--------------------
+                   0
+\f[R]
+.fi
+.PP
+With a reporting interval, multiple columns will be shown, one for each
+report period.
+As with multicolumn balance reports, you can alter the report mode with
+\f[C]--change\f[R]/\f[C]--cumulative\f[R]/\f[C]--historical\f[R].
+Normally balancesheet shows historical ending balances, which is what
+you need for a balance sheet; note this means it ignores report begin
+dates (and \f[C]-T/--row-total\f[R], since summing end balances
+generally does not make sense).
+Instead of absolute values percentages can be displayed with
+\f[C]-%\f[R].
+.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],
+\f[C]html\f[R], and (experimental) \f[C]json\f[R].
+.SS balancesheetequity
+.PP
+balancesheetequity, bse
+.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).
+.PP
+Example:
+.IP
+.nf
+\f[C]
+$ hledger balancesheetequity
+Balance Sheet With Equity
+
+Assets:
+                 $-2  assets
+                  $1    bank:saving
+                 $-3    cash
+--------------------
+                 $-2
+
+Liabilities:
+                  $1  liabilities:debts
+--------------------
+                  $1
+
+Equity:
+          $1  equity:owner
+--------------------
+          $1
+
+Total:
+--------------------
+                   0
+\f[R]
+.fi
+.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],
+\f[C]html\f[R], and (experimental) \f[C]json\f[R].
+.SS cashflow
+.PP
+cashflow, cf
+.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).
+.PP
+Example:
+.IP
+.nf
+\f[C]
+$ hledger cashflow
+Cashflow Statement
+
+Cash flows:
+                 $-1  assets
+                  $1    bank:saving
+                 $-2    cash
+--------------------
+                 $-1
+
+Total:
+--------------------
+                 $-1
+\f[R]
+.fi
+.PP
+With a reporting interval, multiple columns will be shown, one for each
+report period.
+Normally cashflow shows changes in assets per period, though as with
+multicolumn balance reports you can alter the report mode with
+\f[C]--change\f[R]/\f[C]--cumulative\f[R]/\f[C]--historical\f[R].
+Instead of absolute values percentages can be displayed with
+\f[C]-%\f[R].
+.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],
+\f[C]html\f[R], and (experimental) \f[C]json\f[R].
+.SS check-dates
+.PP
+check-dates
+.PD 0
+.P
+.PD
+Check that transactions are sorted by increasing date.
+With --date2, checks secondary dates instead.
+With --strict, dates must also be unique.
+With a query, only matched transactions\[aq] dates are checked.
+Reads the default journal file, or another specified with -f.
+.SS check-dupes
+.PP
+check-dupes
+.PD 0
+.P
+.PD
+Reports account names having the same leaf but different prefixes.
+In other words, two or more leaves that are categorized differently.
+Reads the default journal file, or another specified as an argument.
+.PP
+An example: http://stefanorodighiero.net/software/hledger-dupes.html
+.SS close
+.PP
+close, equity
+.PD 0
+.P
+.PD
+Prints a \[dq]closing balances\[dq] transaction and an \[dq]opening
+balances\[dq] transaction that bring account balances to and from zero,
+respectively.
+These can be added to your journal file(s), eg to bring asset/liability
+balances forward into a new journal file, or to close out
+revenues/expenses to retained earnings at the end of a period.
+.PP
+You can print just one of these transactions by using the
+\f[C]--close\f[R] or \f[C]--open\f[R] flag.
+You can customise their descriptions with the \f[C]--close-desc\f[R] and
+\f[C]--open-desc\f[R] options.
+.PP
+One amountless posting to \[dq]equity:opening/closing balances\[dq] is
+added to balance the transactions, by default.
+You can customise this account name with \f[C]--close-acct\f[R] and
+\f[C]--open-acct\f[R]; if you specify only one of these, it will be used
+for both.
+.PP
+With \f[C]--x/--explicit\f[R], the equity posting\[aq]s amount will be
+shown.
+And if it involves multiple commodities, a posting for each commodity
+will be shown, as with the print command.
+.PP
+With \f[C]--interleaved\f[R], the equity postings are shown next to the
+postings they balance, which makes troubleshooting easier.
+.PP
+By default, transaction prices in the journal are ignored when
+generating the closing/opening transactions.
+With \f[C]--show-costs\f[R], this cost information is preserved
+(\f[C]balance -B\f[R] reports will be unchanged after the transition).
+Separate postings are generated for each cost in each commodity.
+Note this can generate very large journal entries, if you have many
+foreign currency or investment transactions.
+.SS close usage
+.PP
+If you split your journal files by time (eg yearly), you will typically
+run this command at the end of the year, and save the closing
+transaction as last entry of the old file, and the opening transaction
+as the first entry of the new file.
+This makes the files self contained, so that correct balances are
+reported no matter which of them are loaded.
+Ie, if you load just one file, the balances are initialised correctly;
+or if you load several files, the redundant closing/opening transactions
+cancel each other out.
+(They will show up in print or register reports; you can exclude them
+with a query like
+\f[C]not:desc:\[aq](opening|closing) balances\[aq]\f[R].)
+.PP
+If you\[aq]re running a business, you might also use this command to
+\[dq]close the books\[dq] at the end of an accounting period,
+transferring income statement account balances to retained earnings.
+(You may want to change the equity account name to something like
+\[dq]equity:retained earnings\[dq].)
+.PP
+By default, the closing transaction is dated yesterday, the balances are
+calculated as of end of yesterday, and the opening transaction is dated
+today.
+To close on some other date, use:
+\f[C]hledger close -e OPENINGDATE\f[R].
+Eg, to close/open on the 2018/2019 boundary, use \f[C]-e 2019\f[R].
+You can also use -p or \f[C]date:PERIOD\f[R] (any starting date is
+ignored).
+.PP
+Both transactions will include balance assertions for the
+closed/reopened accounts.
+You probably shouldn\[aq]t use status or realness filters (like -C or -R
+or \f[C]status:\f[R]) with this command, or the generated balance
+assertions will depend on these flags.
+Likewise, if you run this command with --auto, the balance assertions
+will probably always require --auto.
+.PP
+Examples:
+.PP
+Carrying asset/liability balances into a new file for 2019:
+.IP
+.nf
+\f[C]
+$ hledger close -f 2018.journal -e 2019 assets liabilities --open
+    # (copy/paste the output to the start of your 2019 journal file)
+$ hledger close -f 2018.journal -e 2019 assets liabilities --close
+    # (copy/paste the output to the end of your 2018 journal file)
+\f[R]
+.fi
+.PP
+Now:
+.IP
+.nf
+\f[C]
+$ hledger bs -f 2019.journal                   # one file - balances are correct
+$ hledger bs -f 2018.journal -f 2019.journal   # two files - balances still correct
+$ hledger bs -f 2018.journal not:desc:closing  # to see year-end balances, must exclude closing txn
+\f[R]
+.fi
+.PP
+Transactions spanning the closing date can complicate matters, breaking
+balance assertions:
+.IP
+.nf
+\f[C]
+2018/12/30 a purchase made in 2018, clearing the following year
+    expenses:food          5
+    assets:bank:checking  -5  ; [2019/1/2]
+\f[R]
+.fi
+.PP
+Here\[aq]s one way to resolve that:
+.IP
+.nf
+\f[C]
+; in 2018.journal:
+2018/12/30 a purchase made in 2018, clearing the following year
+    expenses:food          5
+    liabilities:pending
+
+; in 2019.journal:
+2019/1/2 clearance of last year\[aq]s pending transactions
+    liabilities:pending    5 = 0
+    assets:checking
+\f[R]
+.fi
+.SS commodities
+.PP
+commodities
+.PD 0
+.P
+.PD
+List all commodity/currency symbols used or declared in the journal.
+.SS descriptions
+.PP
+descriptions Show descriptions.
+.PP
+This command lists all descriptions that appear in transactions.
+.PP
+Examples:
+.IP
+.nf
+\f[C]
+$ hledger descriptions
+Store Name
+Gas Station | Petrol
+Person A
+\f[R]
+.fi
+.SS diff
+.PP
+diff
+.PD 0
+.P
+.PD
+Compares a particular account\[aq]s transactions in two input files.
+It shows any transactions to this account which are in one file but not
+in the other.
+.PP
+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.) Since
+postings not transactions are compared, this also works when multiple
+bank transactions have been combined into a single journal entry.
+.PP
+This is useful eg if you have downloaded an account\[aq]s transactions
+from 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.
+.PP
+Examples:
+.IP
+.nf
+\f[C]
+$ hledger diff -f $LEDGER_FILE -f bank.csv assets:bank:giro 
+These transactions are in the first file only:
+
+2014/01/01 Opening Balances
+    assets:bank:giro              EUR ...
+    ...
+    equity:opening balances       EUR -...
+
+These transactions are in the second file only:
+\f[R]
+.fi
+.SS files
+.PP
+files
+.PD 0
+.P
+.PD
+List all files included in the journal.
+With a REGEX argument, only file names matching the regular expression
+(case sensitive) are shown.
+.SS help
+.PP
+help
+.PD 0
+.P
+.PD
+Show any of the hledger manuals.
+.PP
+The \f[C]help\f[R] 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.
+.PP
+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 \f[C]--info\f[R],
+\f[C]--man\f[R], \f[C]--pager\f[R], \f[C]--cat\f[R] flags.
+.PP
+Examples:
+.IP
+.nf
+\f[C]
+$ hledger help
+Please choose a manual by typing \[dq]hledger help MANUAL\[dq] (a substring is ok).
+Manuals: hledger hledger-ui hledger-web journal csv timeclock timedot
+\f[R]
+.fi
+.IP
+.nf
+\f[C]
+$ hledger help h --man
+
+hledger(1)                    hledger User Manuals                    hledger(1)
+
+NAME
+       hledger - a command-line accounting tool
+
+SYNOPSIS
+       hledger [-f FILE] COMMAND [OPTIONS] [ARGS]
+       hledger [-f FILE] ADDONCMD -- [OPTIONS] [ARGS]
+       hledger
+
+DESCRIPTION
+       hledger  is  a  cross-platform  program  for tracking money, time, or any
+\&...
+\f[R]
+.fi
+.SS import
+.PP
+import
+.PD 0
+.P
+.PD
+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 transactions that would be added.
+Or with --catchup, just mark all of the FILEs\[aq] transactions as
+imported, without actually importing any.
+.PP
+The input files are specified as arguments - no need to write -f before
+each one.
+So eg to add new transactions from all CSV files to the main journal,
+it\[aq]s just: \f[C]hledger import *.csv\f[R]
+.PP
+New transactions are detected in the same way as print --new: by
+assuming transactions are always added to the input files in increasing
+date order, and by saving \f[C].latest.FILE\f[R] state files.
+.PP
+The --dry-run output is in journal format, so you can filter it, eg to
+see only uncategorised transactions:
+.IP
+.nf
+\f[C]
+$ hledger import --dry ... | hledger -f- print unknown --ignore-assertions
+\f[R]
+.fi
+.SS Importing balance assignments
+.PP
+Entries added by import will have their posting amounts made explicit
+(like \f[C]hledger print -x\f[R]).
+This means that any balance assignments in imported files must be
+evaluated; but, imported files don\[aq]t get to see the main file\[aq]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 amounts.
+To avoid this problem, use print instead of import:
+.IP
+.nf
+\f[C]
+$ hledger print IMPORTFILE [--new] >> $LEDGER_FILE
+\f[R]
+.fi
+.PP
+(If you think import should leave amounts implicit like print does,
+please test it and send a pull request.)
+.SS incomestatement
+.PP
+incomestatement, is
+.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.)
+.IP
+.nf
+\f[C]
+$ hledger incomestatement
+Income Statement
+
+Revenues:
+                 $-2  income
+                 $-1    gifts
+                 $-1    salary
+--------------------
+                 $-2
+
+Expenses:
+                  $2  expenses
+                  $1    food
+                  $1    supplies
+--------------------
+                  $2
+
+Total:
+--------------------
+                   0
+\f[R]
+.fi
+.PP
+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
+\f[C]--change\f[R]/\f[C]--cumulative\f[R]/\f[C]--historical\f[R].
+Instead of absolute values percentages can be displayed with
+\f[C]-%\f[R].
+.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],
+\f[C]html\f[R], and (experimental) \f[C]json\f[R].
+.SS notes
+.PP
+notes Show notes.
+.PP
+This command lists all notes that appear in transactions.
+.PP
+Examples:
+.IP
+.nf
+\f[C]
+$ hledger notes
+Petrol
+Snacks
+\f[R]
+.fi
+.SS payees
+.PP
+payees Show payee names.
+.PP
+This command lists all payee names that appear in transactions.
+.PP
+Examples:
+.IP
+.nf
+\f[C]
+$ hledger payees
+Store Name
+Gas Station
+Person A
+\f[R]
+.fi
+.SS prices
+.PP
+prices
+.PD 0
+.P
+.PD
+Print market price directives from the journal.
+With --costs, also print synthetic market prices based on transaction
+prices.
+With --inverted-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.
+.SS print
+.PP
+print, txns, p
+.PD 0
+.P
+.PD
+Show transaction journal entries, sorted by date.
+.PP
+The print command displays full journal entries (transactions) from the
+journal file in date order, tidily formatted.
+With --date2, transactions are sorted by secondary date instead.
+.PP
+print\[aq]s output is always a valid hledger journal.
+.PD 0
+.P
+.PD
+It preserves all transaction information, but it does not preserve
+directives or inter-transaction comments
+.IP
+.nf
+\f[C]
+$ hledger print
+2008/01/01 income
+    assets:bank:checking            $1
+    income:salary                  $-1
+
+2008/06/01 gift
+    assets:bank:checking            $1
+    income:gifts                   $-1
+
+2008/06/02 save
+    assets:bank:saving              $1
+    assets:bank:checking           $-1
+
+2008/06/03 * eat & shop
+    expenses:food                $1
+    expenses:supplies            $1
+    assets:cash                 $-2
+
+2008/12/31 * pay off
+    liabilities:debts               $1
+    assets:bank:checking           $-1
+\f[R]
+.fi
+.PP
+Normally, the journal entry\[aq]s explicit or implicit amount style is
+preserved.
+For example, when an amount is omitted in the journal, it will not
+appear in the output.
+Similarly, when a transaction price is implied but not written, it will
+not appear in the output.
+You can use the \f[C]-x\f[R]/\f[C]--explicit\f[R] flag to make all
+amounts and transaction prices explicit, which can be useful for
+troubleshooting or for making your journal more readable and robust
+against data entry errors.
+\f[C]-x\f[R] is also implied by using any of
+\f[C]-B\f[R],\f[C]-V\f[R],\f[C]-X\f[R],\f[C]--value\f[R].
+.PP
+Note, \f[C]-x\f[R]/\f[C]--explicit\f[R] 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.
+.PP
+With \f[C]-B\f[R]/\f[C]--cost\f[R], amounts with transaction prices are
+converted to cost using that price.
+This can be used for troubleshooting.
+.PP
+With \f[C]-m\f[R]/\f[C]--match\f[R] and a STR argument, print will show
+at most one transaction: 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.
+.PP
+With \f[C]--new\f[R], for each FILE being read, hledger reads (and
+writes) a special state file (\f[C].latest.FILE\f[R] 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 ignoring already-seen entries in import data, such as
+downloaded CSV files.
+Eg:
+.IP
+.nf
+\f[C]
+$ hledger -f bank1.csv print --new
+(shows transactions added since last print --new on this file)
+\f[R]
+.fi
+.PP
+This assumes that transactions added to FILE always have same or
+increasing dates, and that transactions on the same day do not get
+reordered.
+See also the import command.
+.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].
+.PP
+Here\[aq]s an example of print\[aq]s CSV output:
+.IP
+.nf
+\f[C]
+$ hledger print -Ocsv
+\[dq]txnidx\[dq],\[dq]date\[dq],\[dq]date2\[dq],\[dq]status\[dq],\[dq]code\[dq],\[dq]description\[dq],\[dq]comment\[dq],\[dq]account\[dq],\[dq]amount\[dq],\[dq]commodity\[dq],\[dq]credit\[dq],\[dq]debit\[dq],\[dq]posting-status\[dq],\[dq]posting-comment\[dq]
+\[dq]1\[dq],\[dq]2008/01/01\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]income\[dq],\[dq]\[dq],\[dq]assets:bank:checking\[dq],\[dq]1\[dq],\[dq]$\[dq],\[dq]\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq]
+\[dq]1\[dq],\[dq]2008/01/01\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]income\[dq],\[dq]\[dq],\[dq]income:salary\[dq],\[dq]-1\[dq],\[dq]$\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq]
+\[dq]2\[dq],\[dq]2008/06/01\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]gift\[dq],\[dq]\[dq],\[dq]assets:bank:checking\[dq],\[dq]1\[dq],\[dq]$\[dq],\[dq]\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq]
+\[dq]2\[dq],\[dq]2008/06/01\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]gift\[dq],\[dq]\[dq],\[dq]income:gifts\[dq],\[dq]-1\[dq],\[dq]$\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq]
+\[dq]3\[dq],\[dq]2008/06/02\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]save\[dq],\[dq]\[dq],\[dq]assets:bank:saving\[dq],\[dq]1\[dq],\[dq]$\[dq],\[dq]\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq]
+\[dq]3\[dq],\[dq]2008/06/02\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]save\[dq],\[dq]\[dq],\[dq]assets:bank:checking\[dq],\[dq]-1\[dq],\[dq]$\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq]
+\[dq]4\[dq],\[dq]2008/06/03\[dq],\[dq]\[dq],\[dq]*\[dq],\[dq]\[dq],\[dq]eat & shop\[dq],\[dq]\[dq],\[dq]expenses:food\[dq],\[dq]1\[dq],\[dq]$\[dq],\[dq]\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq]
+\[dq]4\[dq],\[dq]2008/06/03\[dq],\[dq]\[dq],\[dq]*\[dq],\[dq]\[dq],\[dq]eat & shop\[dq],\[dq]\[dq],\[dq]expenses:supplies\[dq],\[dq]1\[dq],\[dq]$\[dq],\[dq]\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq]
+\[dq]4\[dq],\[dq]2008/06/03\[dq],\[dq]\[dq],\[dq]*\[dq],\[dq]\[dq],\[dq]eat & shop\[dq],\[dq]\[dq],\[dq]assets:cash\[dq],\[dq]-2\[dq],\[dq]$\[dq],\[dq]2\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq]
+\[dq]5\[dq],\[dq]2008/12/31\[dq],\[dq]\[dq],\[dq]*\[dq],\[dq]\[dq],\[dq]pay off\[dq],\[dq]\[dq],\[dq]liabilities:debts\[dq],\[dq]1\[dq],\[dq]$\[dq],\[dq]\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq]
+\[dq]5\[dq],\[dq]2008/12/31\[dq],\[dq]\[dq],\[dq]*\[dq],\[dq]\[dq],\[dq]pay off\[dq],\[dq]\[dq],\[dq]assets:bank:checking\[dq],\[dq]-1\[dq],\[dq]$\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq]
+\f[R]
+.fi
+.IP \[bu] 2
+There is one CSV record per posting, with the parent transaction\[aq]s
+fields repeated.
+.IP \[bu] 2
+The \[dq]txnidx\[dq] (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 order, etc.)
+.IP \[bu] 2
+The amount is separated into \[dq]commodity\[dq] (the symbol) and
+\[dq]amount\[dq] (numeric quantity) fields.
+.IP \[bu] 2
+The numeric amount is repeated in either the \[dq]credit\[dq] or
+\[dq]debit\[dq] column, for convenience.
+(Those names are not accurate in the accounting sense; it just puts
+negative amounts under credit and zero or greater amounts under debit.)
+.SS print-unique
+.PP
+print-unique
+.PD 0
+.P
+.PD
+Print transactions which do not reuse an already-seen description.
+.PP
+Example:
+.IP
+.nf
+\f[C]
+$ cat unique.journal
+1/1 test
+ (acct:one)  1
+2/2 test
+ (acct:two)  2
+$ LEDGER_FILE=unique.journal hledger print-unique
+(-f option not supported)
+2015/01/01 test
+    (acct:one)             1
+\f[R]
+.fi
+.SS register
+.PP
+register, reg, r
+.PD 0
+.P
+.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:
+.IP
+.nf
+\f[C]
+$ hledger register checking
+2008/01/01 income               assets:bank:checking            $1           $1
+2008/06/01 gift                 assets:bank:checking            $1           $2
+2008/06/02 save                 assets:bank:checking           $-1           $1
+2008/12/31 pay off              assets:bank:checking           $-1            0
+\f[R]
+.fi
+.PP
+With --date2, it shows and sorts by secondary date instead.
+.PP
+The \f[C]--historical\f[R]/\f[C]-H\f[R] flag adds the balance from any
+undisplayed prior postings to the running total.
+This is useful when you want to see only recent activity, with a
+historically accurate running balance:
+.IP
+.nf
+\f[C]
+$ hledger register checking -b 2008/6 --historical
+2008/06/01 gift                 assets:bank:checking            $1           $2
+2008/06/02 save                 assets:bank:checking           $-1           $1
+2008/12/31 pay off              assets:bank:checking           $-1            0
+\f[R]
+.fi
+.PP
+The \f[C]--depth\f[R] option limits the amount of sub-account detail
+displayed.
+.PP
+The \f[C]--average\f[R]/\f[C]-A\f[R] flag shows the running average
+posting amount instead of the running total (so, the final number
+displayed is the average for the whole report period).
+This flag implies \f[C]--empty\f[R] (see below).
+It is affected by \f[C]--historical\f[R].
+It works best when showing just one account and one commodity.
+.PP
+The \f[C]--related\f[R]/\f[C]-r\f[R] flag shows the \f[I]other\f[R]
+postings in the transactions of the postings which would normally be
+shown.
+.PP
+The \f[C]--invert\f[R] flag negates all amounts.
+For example, it can be used on an income account where amounts are
+normally displayed as negative numbers.
+It\[aq]s also useful to show postings on the checking account together
+with the related account:
+.IP
+.nf
+\f[C]
+$ hledger register --related --invert assets:checking
+\f[R]
+.fi
+.PP
+With a reporting interval, register shows summary postings, one per
+interval, aggregating the postings to each account:
+.IP
+.nf
+\f[C]
+$ hledger register --monthly income
+2008/01                 income:salary                          $-1          $-1
+2008/06                 income:gifts                           $-1          $-2
+\f[R]
+.fi
+.PP
+Periods with no activity, and summary postings with a zero amount, are
+not shown by default; use the \f[C]--empty\f[R]/\f[C]-E\f[R] flag to see
+them:
+.IP
+.nf
+\f[C]
+$ hledger register --monthly income -E
+2008/01                 income:salary                          $-1          $-1
+2008/02                                                          0          $-1
+2008/03                                                          0          $-1
+2008/04                                                          0          $-1
+2008/05                                                          0          $-1
+2008/06                 income:gifts                           $-1          $-2
+2008/07                                                          0          $-2
+2008/08                                                          0          $-2
+2008/09                                                          0          $-2
+2008/10                                                          0          $-2
+2008/11                                                          0          $-2
+2008/12                                                          0          $-2
+\f[R]
+.fi
+.PP
+Often, you\[aq]ll want to see just one line per interval.
+The \f[C]--depth\f[R] option helps with this, causing subaccounts to be
+aggregated:
+.IP
+.nf
+\f[C]
+$ hledger register --monthly assets --depth 1h
+2008/01                 assets                                  $1           $1
+2008/06                 assets                                 $-1            0
+2008/12                 assets                                 $-1          $-1
+\f[R]
+.fi
+.PP
+Note when using report intervals, if you specify start/end dates these
+will be adjusted outward if necessary to contain a whole number of
+intervals.
+This ensures that the first and last intervals are full length and
+comparable to the others in the report.
+.SS Custom register output
+.PP
+register uses the full terminal width by default, except on windows.
+You can override this by setting the \f[C]COLUMNS\f[R] environment
+variable (not a bash shell variable) or by using the
+\f[C]--width\f[R]/\f[C]-w\f[R] option.
+.PP
+The description and account columns normally share the space equally
+(about half of (width - 40) each).
+You can adjust this by adding a description width as part of
+--width\[aq]s argument, comma-separated: \f[C]--width W,D\f[R] .
+Here\[aq]s a diagram (won\[aq]t display correctly in --help):
+.IP
+.nf
+\f[C]
+<--------------------------------- width (W) ---------------------------------->
+date (10)  description (D)       account (W-41-D)     amount (12)   balance (12)
+DDDDDDDDDD dddddddddddddddddddd  aaaaaaaaaaaaaaaaaaa  AAAAAAAAAAAA  AAAAAAAAAAAA
+\f[R]
+.fi
+.PP
+and some examples:
+.IP
+.nf
+\f[C]
+$ hledger reg                     # use terminal width (or 80 on windows)
+$ hledger reg -w 100              # use width 100
+$ COLUMNS=100 hledger reg         # set with one-time environment variable
+$ export COLUMNS=100; hledger reg # set till session end (or window resize)
+$ hledger reg -w 100,40           # set overall width 100, description width 40
+$ hledger reg -w $COLUMNS,40      # use terminal width, & description width 40
+\f[R]
+.fi
+.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].
+.SS register-match
+.PP
+register-match
+.PD 0
+.P
+.PD
+Print the one posting whose transaction description is closest to DESC,
+in the style of the register command.
+If there are multiple equally good matches, it shows the most recent.
+Query options (options, not arguments) can be used to restrict the
+search space.
+Helps ledger-autosync detect already-seen transactions when importing.
+.SS rewrite
+.PP
+rewrite
+.PD 0
+.P
+.PD
+Print all transactions, rewriting the postings of matched transactions.
+For now the only rewrite available is adding new postings, like print
+--auto.
+.PP
+This is a start at a generic rewriter of transaction entries.
+It reads the default journal and prints the transactions, like print,
+but adds one or more specified postings to any transactions matching
+QUERY.
+The posting amounts can be fixed, or a multiplier of the existing
+transaction\[aq]s first posting amount.
+.PP
+Examples:
+.IP
+.nf
+\f[C]
+$ hledger-rewrite.hs \[ha]income --add-posting \[aq](liabilities:tax)  *.33  ; income tax\[aq] --add-posting \[aq](reserve:gifts)  $100\[aq]
+$ hledger-rewrite.hs expenses:gifts --add-posting \[aq](reserve:gifts)  *-1\[dq]\[aq]
+$ hledger-rewrite.hs -f rewrites.hledger
+\f[R]
+.fi
+.PP
+rewrites.hledger may consist of entries like:
+.IP
+.nf
+\f[C]
+= \[ha]income amt:<0 date:2017
+  (liabilities:tax)  *0.33  ; tax on income
+  (reserve:grocery)  *0.25  ; reserve 25% for grocery
+  (reserve:)  *0.25  ; reserve 25% for grocery
+\f[R]
+.fi
+.PP
+Note the single quotes to protect the dollar sign from bash, and the two
+spaces between account and amount.
+.PP
+More:
+.IP
+.nf
+\f[C]
+$ hledger rewrite -- [QUERY]        --add-posting \[dq]ACCT  AMTEXPR\[dq] ...
+$ hledger rewrite -- \[ha]income        --add-posting \[aq](liabilities:tax)  *.33\[aq]
+$ hledger rewrite -- expenses:gifts --add-posting \[aq](budget:gifts)  *-1\[dq]\[aq]
+$ hledger rewrite -- \[ha]income        --add-posting \[aq](budget:foreign currency)  *0.25 JPY; diversify\[aq]
+\f[R]
+.fi
+.PP
+Argument for \f[C]--add-posting\f[R] option is a usual posting of
+transaction with an exception for amount specification.
+More precisely, you can use \f[C]\[aq]*\[aq]\f[R] (star symbol) before
+the amount to indicate that that this is a factor for an amount of
+original matched posting.
+If the amount includes a commodity name, the new posting amount will be
+in the new commodity; otherwise, it will be in the matched posting
+amount\[aq]s commodity.
+.SS Re-write rules in a file
+.PP
+During the run this tool will execute so called \[dq]Automated
+Transactions\[dq] found in any journal it process.
+I.e instead of specifying this operations in command line you can put
+them in a journal file.
+.IP
+.nf
+\f[C]
+$ rewrite-rules.journal
+\f[R]
+.fi
+.PP
+Make contents look like this:
+.IP
+.nf
+\f[C]
+= \[ha]income
+    (liabilities:tax)  *.33
+
+= expenses:gifts
+    budget:gifts  *-1
+    assets:budget  *1
+\f[R]
+.fi
+.PP
+Note that \f[C]\[aq]=\[aq]\f[R] (equality symbol) that is used instead
+of date in transactions you usually write.
+It indicates the query by which you want to match the posting to add new
+ones.
+.IP
+.nf
+\f[C]
+$ hledger rewrite -- -f input.journal -f rewrite-rules.journal > rewritten-tidy-output.journal
+\f[R]
+.fi
+.PP
+This is something similar to the commands pipeline:
+.IP
+.nf
+\f[C]
+$ hledger rewrite -- -f input.journal \[aq]\[ha]income\[aq] --add-posting \[aq](liabilities:tax)  *.33\[aq] \[rs]
+  | hledger rewrite -- -f - expenses:gifts      --add-posting \[aq]budget:gifts  *-1\[aq]       \[rs]
+                                                --add-posting \[aq]assets:budget  *1\[aq]       \[rs]
+  > rewritten-tidy-output.journal
+\f[R]
+.fi
+.PP
+It is important to understand that relative order of such entries in
+journal is important.
+You can re-use result of previously added postings.
+.SS Diff output format
+.PP
+To use this tool for batch modification of your journal files you may
+find useful output in form of unified diff.
+.IP
+.nf
+\f[C]
+$ hledger rewrite -- --diff -f examples/sample.journal \[aq]\[ha]income\[aq] --add-posting \[aq](liabilities:tax)  *.33\[aq]
+\f[R]
+.fi
+.PP
+Output might look like:
+.IP
+.nf
+\f[C]
+--- /tmp/examples/sample.journal
++++ /tmp/examples/sample.journal
+\[at]\[at] -18,3 +18,4 \[at]\[at]
+ 2008/01/01 income
+-    assets:bank:checking  $1
++    assets:bank:checking            $1
+     income:salary
++    (liabilities:tax)                0
+\[at]\[at] -22,3 +23,4 \[at]\[at]
+ 2008/06/01 gift
+-    assets:bank:checking  $1
++    assets:bank:checking            $1
+     income:gifts
++    (liabilities:tax)                0
+\f[R]
+.fi
+.PP
+If you\[aq]ll pass this through \f[C]patch\f[R] tool you\[aq]ll get
+transactions containing the posting that matches your query be updated.
+Note that multiple files might be update according to list of input
+files specified via \f[C]--file\f[R] options and \f[C]include\f[R]
+directives inside of these files.
+.PP
+Be careful.
+Whole transaction being re-formatted in a style of output from
+\f[C]hledger print\f[R].
+.PP
+See also:
+.PP
+https://github.com/simonmichael/hledger/issues/99
+.SS rewrite vs. print --auto
+.PP
+This command predates print --auto, and currently does much the same
+thing, but with these differences:
+.IP \[bu] 2
+with multiple files, rewrite lets rules in any file affect all other
+files.
+print --auto uses standard directive scoping; rules affect only child
+files.
+.IP \[bu] 2
+rewrite\[aq]s query limits which transactions can be rewritten; all are
+printed.
+print --auto\[aq]s query limits which transactions are printed.
+.IP \[bu] 2
+rewrite applies rules specified on command line or in the journal.
+print --auto applies rules specified in the journal.
+.SS roi
+.PP
+roi
+.PD 0
+.P
+.PD
+Shows the time-weighted (TWR) and money-weighted (IRR) rate of return on
+your investments.
+.PP
+This command assumes that you have account(s) that hold nothing but your
+investments and whenever you record current appraisal/valuation of these
+investments you offset unrealized profit and loss into account(s) that,
+again, hold nothing but unrealized profit and loss.
+.PP
+Any transactions affecting balance of investment account(s) and not
+originating from unrealized profit and loss account(s) are assumed to be
+your investments or withdrawals.
+.PP
+At a minimum, you need to supply a query (which could be just an account
+name) to select your investments with \f[C]--inv\f[R], and another query
+to identify your profit and loss transactions with \f[C]--pnl\f[R].
+.PP
+It will compute and display the internalized rate of return (IRR) and
+time-weighted rate of return (TWR) for your investments for the time
+period requested.
+Both rates of return are annualized before display, regardless of the
+length of reporting interval.
+.SS stats
+.PP
+stats
+.PD 0
+.P
+.PD
+Show some journal statistics.
+.PP
+The stats command displays summary information for the whole journal, or
+a matched part of it.
+With a reporting interval, it shows a report for each report period.
+.PP
+Example:
+.IP
+.nf
+\f[C]
+$ hledger stats
+Main journal file        : /src/hledger/examples/sample.journal
+Included journal files   : 
+Transactions span        : 2008-01-01 to 2009-01-01 (366 days)
+Last transaction         : 2008-12-31 (2333 days ago)
+Transactions             : 5 (0.0 per day)
+Transactions last 30 days: 0 (0.0 per day)
+Transactions last 7 days : 0 (0.0 per day)
+Payees/descriptions      : 5
+Accounts                 : 8 (depth 3)
+Commodities              : 1 ($)
+Market prices            : 12 ($)
+\f[R]
+.fi
+.PP
+This command also supports output destination and output format
+selection.
+.SS tags
+.PP
+tags
+.PD 0
+.P
+.PD
+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\[aq] unique values are listed instead.
+.SS test
+.PP
+test
+.PD 0
+.P
+.PD
+Run built-in unit tests.
+.PP
+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.
+.PP
+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!
+.PP
+This command also accepts tasty test runner options, written after a --
+(double hyphen).
+Eg to run only the tests in Hledger.Data.Amount, with ANSI colour codes
+disabled:
+.IP
+.nf
+\f[C]
+$ hledger test -- -pData.Amount --color=never
+\f[R]
+.fi
+.PP
+For help on these, see https://github.com/feuerbach/tasty#options
+(\f[C]-- --help\f[R] currently doesn\[aq]t show them).
+.SS Add-on Commands
+.PP
+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
+\f[C]hledger-\f[R] and ends with a recognised file extension (currently:
+no extension, \f[C]bat\f[R],\f[C]com\f[R],\f[C]exe\f[R],
+\f[C]hs\f[R],\f[C]lhs\f[R],\f[C]pl\f[R],\f[C]py\f[R],\f[C]rb\f[R],\f[C]rkt\f[R],\f[C]sh\f[R]).
+.PP
+Add-ons can be invoked like any hledger command, but there are a few
+things to be aware of.
+Eg if the \f[C]hledger-web\f[R] add-on is installed,
+.IP \[bu] 2
+\f[C]hledger -h web\f[R] shows hledger\[aq]s help, while
+\f[C]hledger web -h\f[R] shows hledger-web\[aq]s help.
+.IP \[bu] 2
+Flags specific to the add-on must have a preceding \f[C]--\f[R] to hide
+them from hledger.
+So \f[C]hledger web --serve --port 9000\f[R] will be rejected; you must
+use \f[C]hledger web -- --serve --port 9000\f[R].
+.IP \[bu] 2
+You can always run add-ons directly if preferred:
+\f[C]hledger-web --serve --port 9000\f[R].
+.PP
+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.
+.PP
+Two important add-ons are the hledger-ui and hledger-web user
+interfaces.
+These are maintained and released along with hledger:
+.SS ui
+.PP
+hledger-ui provides an efficient terminal interface.
+.SS web
+.PP
+hledger-web provides a simple web interface.
+.PP
+Third party add-ons, maintained separately from hledger, include:
+.SS iadd
+.PP
+hledger-iadd is a more interactive, terminal UI replacement for the add
+command.
+.SS interest
+.PP
+hledger-interest generates interest transactions for an account
+according to various schemes.
+.PP
+A few more experimental or old add-ons can be found in hledger\[aq]s
+bin/ directory.
+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
+\f[C]C:/Users/USER/.hledger.journal\f[R]).
+.PP
+A typical value is \f[C]\[ti]/DIR/YYYY.journal\f[R], where DIR is a
+version-controlled finance directory and YYYY is the current year.
+Or \f[C]\[ti]/DIR/current.journal\f[R], where current.journal is a
+symbolic link to YYYY.journal.
+.PP
+On Mac computers, you can set this and other environment variables in a
+more thorough way that also affects applications started from the GUI
+(say, an Emacs dock icon).
+Eg on MacOS Catalina I have a \f[C]\[ti]/.MacOSX/environment.plist\f[R]
+file containing
+.IP
+.nf
+\f[C]
+{
+  \[dq]LEDGER_FILE\[dq] : \[dq]\[ti]/finance/current.journal\[dq]
+}
+\f[R]
+.fi
+.PP
+To see the effect you may need to \f[C]killall Dock\f[R], or reboot.
 .SH FILES
 .PP
 Reads data from one or more files in hledger journal, timeclock,
diff --git a/hledger.cabal b/hledger.cabal
--- a/hledger.cabal
+++ b/hledger.cabal
@@ -4,10 +4,10 @@
 --
 -- see: https://github.com/sol/hpack
 --
--- hash: cc539eef932d55b9d6b5b80a453b650d5287c5b11de661043c97a855fd93a7ed
+-- hash: dd27e441eb3a9ba5f967dd8bd16e1806c793f7debe1277f7d8f08a88bba45971
 
 name:           hledger
-version:        1.16.2
+version:        1.17
 synopsis:       Command-line interface for the hledger accounting tool
 description:    This is hledger's command-line interface.
                 Its basic function is to read a plain text file describing
@@ -27,7 +27,7 @@
 maintainer:     Simon Michael <simon@joyful.com>
 license:        GPL-3
 license-file:   LICENSE
-tested-with:    GHC==8.0.2, GHC==8.2.2, GHC==8.4.3, GHC==8.6.5, GHC==8.8.1
+tested-with:    GHC==8.0.2, GHC==8.2.2, GHC==8.4.3, GHC==8.6.5, GHC==8.8.2, GHC==8.10
 build-type:     Simple
 extra-source-files:
     CHANGES.md
@@ -144,12 +144,13 @@
   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.16.2"
+  cpp-options: -DVERSION="1.17"
   build-depends:
       Decimal
     , Diff
+    , aeson
     , ansi-terminal >=0.6.2.3
-    , base >=4.9 && <4.14
+    , base >=4.9 && <4.15
     , base-compat-batteries >=0.10.1 && <0.12
     , bytestring
     , cmdargs >=0.10
@@ -160,7 +161,7 @@
     , filepath
     , hashable >=1.2.4
     , haskeline >=0.6
-    , hledger-lib >=1.16.2 && <1.17
+    , hledger-lib >=1.17 && <1.18
     , lucid
     , math-functions >=0.2.0.0
     , megaparsec >=7.0.0 && <8.1
@@ -196,11 +197,12 @@
   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.16.2"
+  cpp-options: -DVERSION="1.17"
   build-depends:
       Decimal
+    , aeson
     , ansi-terminal >=0.6.2.3
-    , base >=4.9 && <4.14
+    , base >=4.9 && <4.15
     , base-compat-batteries >=0.10.1 && <0.12
     , bytestring
     , cmdargs >=0.10
@@ -211,7 +213,7 @@
     , filepath
     , haskeline >=0.6
     , hledger
-    , hledger-lib >=1.16.2 && <1.17
+    , hledger-lib >=1.17 && <1.18
     , math-functions >=0.2.0.0
     , megaparsec >=7.0.0 && <8.1
     , mtl >=2.2.1
@@ -247,11 +249,12 @@
   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.16.2"
+  cpp-options: -DVERSION="1.17"
   build-depends:
       Decimal
+    , aeson
     , ansi-terminal >=0.6.2.3
-    , base >=4.9 && <4.14
+    , base >=4.9 && <4.15
     , base-compat-batteries >=0.10.1 && <0.12
     , bytestring
     , cmdargs >=0.10
@@ -262,7 +265,7 @@
     , filepath
     , haskeline >=0.6
     , hledger
-    , hledger-lib >=1.16.2 && <1.17
+    , hledger-lib >=1.17 && <1.18
     , math-functions >=0.2.0.0
     , megaparsec >=7.0.0 && <8.1
     , mtl >=2.2.1
@@ -298,8 +301,9 @@
   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
+    , aeson
     , ansi-terminal >=0.6.2.3
-    , base >=4.9 && <4.14
+    , base >=4.9 && <4.15
     , base-compat-batteries >=0.10.1 && <0.12
     , bytestring
     , cmdargs >=0.10
@@ -311,7 +315,7 @@
     , filepath
     , haskeline >=0.6
     , hledger
-    , hledger-lib >=1.16.2 && <1.17
+    , hledger-lib >=1.17 && <1.18
     , html
     , math-functions >=0.2.0.0
     , megaparsec >=7.0.0 && <8.1
diff --git a/hledger.info b/hledger.info
--- a/hledger.info
+++ b/hledger.info
@@ -1,3369 +1,3920 @@
 This is hledger.info, produced by makeinfo version 6.7 from stdin.
 
 
-File: hledger.info,  Node: Top,  Next: EXAMPLES,  Up: (dir)
-
-hledger(1) hledger 1.16.2
-*************************
-
-This is hledger's command-line interface (there are also terminal and
-web interfaces).  Its basic function is to read a plain text file
-describing financial transactions (in accounting terms, a general
-journal) and print useful reports on standard output, or export them as
-CSV. hledger can also read some other file formats such as CSV files,
-translating them to journal format.  Additionally, hledger lists other
-hledger-* executables found in the user's $PATH and can invoke them as
-subcommands.
-
-   hledger reads data from one or more files in hledger journal,
-timeclock, timedot, or CSV format specified with '-f', or
-'$LEDGER_FILE', or '$HOME/.hledger.journal' (on windows, perhaps
-'C:/Users/USER/.hledger.journal').  If using '$LEDGER_FILE', note this
-must be a real environment variable, not a shell variable.  You can
-specify standard input with '-f-'.
-
-   Transactions are dated movements of money between two (or more) named
-accounts, and are recorded with journal entries like this:
-
-2015/10/16 bought food
- expenses:food          $10
- assets:cash
-
-   For more about this format, see hledger_journal(5).
-
-   Most users use a text editor to edit the journal, usually with an
-editor mode such as ledger-mode for added convenience.  hledger's
-interactive add command is another way to record new transactions.
-hledger never changes existing transactions.
-
-   To get started, you can either save some entries like the above in
-'~/.hledger.journal', or run 'hledger add' and follow the prompts.  Then
-try some commands like 'hledger print' or 'hledger balance'.  Run
-'hledger' with no arguments for a list of commands.
-
-* Menu:
-
-* EXAMPLES::
-* OPTIONS::
-* QUERIES::
-* COMMANDS::
-* ADD-ON COMMANDS::
-
-
-File: hledger.info,  Node: EXAMPLES,  Next: OPTIONS,  Prev: Top,  Up: Top
-
-1 EXAMPLES
-**********
-
-Two simple transactions in hledger journal format:
-
-2015/9/30 gift received
-  assets:cash   $20
-  income:gifts
-
-2015/10/16 farmers market
-  expenses:food    $10
-  assets:cash
-
-   Some basic reports:
-
-$ hledger print
-2015/09/30 gift received
-    assets:cash            $20
-    income:gifts          $-20
-
-2015/10/16 farmers market
-    expenses:food           $10
-    assets:cash            $-10
-
-$ hledger accounts --tree
-assets
-  cash
-expenses
-  food
-income
-  gifts
-
-$ hledger balance
-                 $10  assets:cash
-                 $10  expenses:food
-                $-20  income:gifts
---------------------
-                   0
-
-$ hledger register cash
-2015/09/30 gift received   assets:cash               $20           $20
-2015/10/16 farmers market  assets:cash              $-10           $10
-
-   More commands:
-
-$ hledger                                 # show available commands
-$ hledger add                             # add more transactions to the journal file
-$ hledger balance                         # all accounts with aggregated balances
-$ hledger balance --help                  # show detailed help for balance command
-$ hledger balance --depth 1               # only top-level accounts
-$ hledger register                        # show account postings, with running total
-$ hledger reg income                      # show postings to/from income accounts
-$ hledger reg 'assets:some bank:checking' # show postings to/from this checking account
-$ hledger print desc:shop                 # show transactions with shop in the description
-$ hledger activity -W                     # show transaction counts per week as a bar chart
-
-
-File: hledger.info,  Node: OPTIONS,  Next: QUERIES,  Prev: EXAMPLES,  Up: Top
-
-2 OPTIONS
-*********
-
-* Menu:
-
-* General options::
-* Command options::
-* Command arguments::
-* Argument files::
-* Special characters in arguments and queries::
-* Command line tips::
-* Unicode characters::
-* Input files::
-* Smart dates::
-* Report start & end date::
-* Report intervals::
-* Period expressions::
-* Depth limiting::
-* Pivoting::
-* Valuation::
-* Output destination::
-* Output format::
-* Regular expressions::
-
-
-File: hledger.info,  Node: General options,  Next: Command options,  Up: OPTIONS
-
-2.1 General options
-===================
-
-To see general usage help, including general options which are supported
-by most hledger commands, run 'hledger -h'.
-
-   General help options:
-
-'-h --help'
-
-     show general usage (or after COMMAND, command usage)
-'--version'
-
-     show version
-'--debug[=N]'
-
-     show debug output (levels 1-9, default: 1)
-
-   General input options:
-
-'-f FILE --file=FILE'
-
-     use a different input file.  For stdin, use - (default:
-     '$LEDGER_FILE' or '$HOME/.hledger.journal')
-'--rules-file=RULESFILE'
-
-     Conversion rules file to use when reading CSV (default: FILE.rules)
-'--separator=CHAR'
-
-     Field separator to expect when reading CSV (default: ',')
-'--alias=OLD=NEW'
-
-     rename accounts named OLD to NEW
-'--anon'
-
-     anonymize accounts and payees
-'--pivot FIELDNAME'
-
-     use some other field or tag for the account name
-'-I --ignore-assertions'
-
-     ignore any failing balance assertions
-
-   General reporting options:
-
-'-b --begin=DATE'
-
-     include postings/txns on or after this date
-'-e --end=DATE'
-
-     include postings/txns before this date
-'-D --daily'
-
-     multiperiod/multicolumn report by day
-'-W --weekly'
-
-     multiperiod/multicolumn report by week
-'-M --monthly'
-
-     multiperiod/multicolumn report by month
-'-Q --quarterly'
-
-     multiperiod/multicolumn report by quarter
-'-Y --yearly'
-
-     multiperiod/multicolumn report by year
-'-p --period=PERIODEXP'
-
-     set start date, end date, and/or reporting interval all at once
-     using period expressions syntax
-'--date2'
-
-     match the secondary date instead (see command help for other
-     effects)
-'-U --unmarked'
-
-     include only unmarked postings/txns (can combine with -P or -C)
-'-P --pending'
-
-     include only pending postings/txns
-'-C --cleared'
-
-     include only cleared postings/txns
-'-R --real'
-
-     include only non-virtual postings
-'-NUM --depth=NUM'
-
-     hide/aggregate accounts or postings more than NUM levels deep
-'-E --empty'
-
-     show items with zero amount, normally hidden (and vice-versa in
-     hledger-ui/hledger-web)
-'-B --cost'
-
-     convert amounts to their cost at transaction time (using the
-     transaction price, if any)
-'-V --value'
-
-     convert amounts to their market value on the report end date (using
-     the most recent applicable market price, if any)
-'--auto'
-
-     apply automated posting rules to modify transactions.
-'--forecast'
-
-     apply periodic transaction rules to generate future transactions,
-     to 6 months from now or report end date.
-
-   When a reporting option appears more than once in the command line,
-the last one takes precedence.
-
-   Some reporting options can also be written as query arguments.
-
-
-File: hledger.info,  Node: Command options,  Next: Command arguments,  Prev: General options,  Up: OPTIONS
-
-2.2 Command options
-===================
-
-To see options for a particular command, including command-specific
-options, run: 'hledger COMMAND -h'.
-
-   Command-specific options must be written after the command name, eg:
-'hledger print -x'.
-
-   Additionally, if the command is an addon, you may need to put its
-options after a double-hyphen, eg: 'hledger ui -- --watch'.  Or, you can
-run the addon executable directly: 'hledger-ui --watch'.
-
-
-File: hledger.info,  Node: Command arguments,  Next: Argument files,  Prev: Command options,  Up: OPTIONS
-
-2.3 Command arguments
-=====================
-
-Most hledger commands accept arguments after the command name, which are
-often a query, filtering the data in some way.
-
-
-File: hledger.info,  Node: Argument files,  Next: Special characters in arguments and queries,  Prev: Command arguments,  Up: OPTIONS
-
-2.4 Argument files
-==================
-
-You can save a set of command line options/arguments in a file, one per
-line, and then reuse them by writing '@FILENAME' in a command line.  To
-prevent this expansion of '@'-arguments, precede them with a '--'
-argument.  For more, see Save frequently used options.
-
-
-File: hledger.info,  Node: Special characters in arguments and queries,  Next: Command line tips,  Prev: Argument files,  Up: OPTIONS
-
-2.5 Special characters in arguments and queries
-===============================================
-
-In shell command lines, option and argument values which contain
-"problematic" characters, ie spaces, and also characters significant to
-your shell such as '<', '>', '(', ')', '|' and '$', should be escaped by
-enclosing them in quotes or by writing backslashes before the
-characters.  Eg:
-
-   'hledger register -p 'last year' "accounts receivable
-(receivable|payable)" amt:\>100'.
-
-* Menu:
-
-* More escaping::
-* Even more escaping::
-* Less escaping::
-
-
-File: hledger.info,  Node: More escaping,  Next: Even more escaping,  Up: Special characters in arguments and queries
-
-2.5.1 More escaping
--------------------
-
-Characters significant both to the shell and in regular expressions may
-need one extra level of escaping.  These include parentheses, the pipe
-symbol and the dollar sign.  Eg, to match the dollar symbol, bash users
-should do:
-
-   'hledger balance cur:'\$''
-
-   or:
-
-   'hledger balance cur:\\$'
-
-
-File: hledger.info,  Node: Even more escaping,  Next: Less escaping,  Prev: More escaping,  Up: Special characters in arguments and queries
-
-2.5.2 Even more escaping
-------------------------
-
-When hledger runs an addon executable (eg you type 'hledger ui', hledger
-runs 'hledger-ui'), it de-escapes command-line options and arguments
-once, so you might need to _triple_-escape.  Eg in bash, running the ui
-command and matching the dollar sign, it's:
-
-   'hledger ui cur:'\\$''
-
-   or:
-
-   'hledger ui cur:\\\\$'
-
-   If you asked why _four_ slashes above, this may help:
-
-unescaped:        '$'
-escaped:          '\$'
-double-escaped:   '\\$'
-triple-escaped:   '\\\\$'
-
-   (The number of backslashes in fish shell is left as an exercise for
-the reader.)
-
-   You can always avoid the extra escaping for addons by running the
-addon directly:
-
-   'hledger-ui cur:\\$'
-
-
-File: hledger.info,  Node: Less escaping,  Prev: Even more escaping,  Up: Special characters in arguments and queries
-
-2.5.3 Less escaping
--------------------
-
-Inside an argument file, or in the search field of hledger-ui or
-hledger-web, or at a GHCI prompt, you need one less level of escaping
-than at the command line.  And backslashes may work better than quotes.
-Eg:
-
-   'ghci> :main balance cur:\$'
-
-
-File: hledger.info,  Node: Command line tips,  Next: Unicode characters,  Prev: Special characters in arguments and queries,  Up: OPTIONS
-
-2.6 Command line tips
-=====================
-
-If in doubt, keep things simple:
-
-   * write options after the command ('hledger CMD -OPTIONS ARGS')
-   * run add-on executables directly ('hledger-ui -OPTIONS ARGS')
-   * enclose problematic args in single quotes
-   * if needed, also add a backslash to escape regexp metacharacters
-
-   To find out exactly how a command line is being parsed, add
-'--debug=2' to troubleshoot.
-
-
-File: hledger.info,  Node: Unicode characters,  Next: Input files,  Prev: Command line tips,  Up: OPTIONS
-
-2.7 Unicode characters
-======================
-
-hledger is expected to handle non-ascii characters correctly:
-
-   * they should be parsed correctly in input files and on the command
-     line, by all hledger tools (add, iadd, hledger-web's
-     search/add/edit forms, etc.)
-
-   * they should be displayed correctly by all hledger tools, and
-     on-screen alignment should be preserved.
-
-   This requires a well-configured environment.  Here are some tips:
-
-   * A system locale must be configured, and it must be one that can
-     decode the characters being used.  In bash, you can set a locale
-     like this: 'export LANG=en_US.UTF-8'.  There are some more details
-     in Troubleshooting.  This step is essential - without it, hledger
-     will quit on encountering a non-ascii character (as with all
-     GHC-compiled programs).
-
-   * your terminal software (eg Terminal.app, iTerm, CMD.exe, xterm..)
-     must support unicode
-
-   * the terminal must be using a font which includes the required
-     unicode glyphs
-
-   * the terminal should be configured to display wide characters as
-     double width (for report alignment)
-
-   * on Windows, for best results you should run hledger in the same
-     kind of environment in which it was built.  Eg hledger built in the
-     standard CMD.EXE environment (like the binaries on our download
-     page) might show display problems when run in a cygwin or msys
-     terminal, and vice versa.  (See eg #961).
-
-
-File: hledger.info,  Node: Input files,  Next: Smart dates,  Prev: Unicode characters,  Up: OPTIONS
-
-2.8 Input files
-===============
-
-hledger reads transactions from a data file (and the add command writes
-to it).  By default this file is '$HOME/.hledger.journal' (or on
-Windows, something like 'C:/Users/USER/.hledger.journal').  You can
-override this with the '$LEDGER_FILE' environment variable:
-
-$ setenv LEDGER_FILE ~/finance/2016.journal
-$ hledger stats
-
-   or with the '-f/--file' option:
-
-$ hledger -f /some/file stats
-
-   The file name '-' (hyphen) means standard input:
-
-$ 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:
-
-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)
-
-   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 -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:
-
-   * 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'.
-
-
-File: hledger.info,  Node: Smart dates,  Next: Report start & end date,  Prev: Input files,  Up: OPTIONS
-
-2.9 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
-omitted (defaulting to 1).
-
-   Examples:
-
-'2004/10/1', '2004-01-01', '2004.9.1'   exact date, several separators allowed.  Year is 4+ digits, month is 1-12, day is 1-31
-'2004'                                  start of year
-'2004/10'                               start of month
-'10/1'                                  month and day in current year
-'21'                                    day in current month
-'october, oct'                          start of month in current year
-'yesterday, today, tomorrow'            -1, 0, 1 days from today
-'last/this/next                         -1, 0, 1 periods from the current period
-day/week/month/quarter/year'
-'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
-results:
-
-'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 8-digit year
-'20181232'    8 digits with an invalid day gives an error
-'201801012'   9+ digits beginning with a valid YYYYMMDD gives an error
-
-
-File: hledger.info,  Node: Report start & end date,  Next: Report intervals,  Prev: Smart dates,  Up: OPTIONS
-
-2.10 Report start & end date
-============================
-
-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
-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',
-'-e/--end', '-p/--period' or a 'date:' query (described below).  All of
-these accept the smart date syntax.
-
-   Some notes:
-
-   * As in Ledger, end dates are exclusive, so you need to write the
-     date _after_ the last day you want to include.
-   * As noted in reporting options: among start/end dates specified with
-     _options_, the last (i.e.  right-most) option takes precedence.
-   * 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 (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
-'date:-12/1'
-'date:thismonth-'
-'date:thismonth'
-
-
-File: hledger.info,  Node: Report intervals,  Next: Period expressions,  Prev: Report start & end date,  Up: OPTIONS
-
-2.11 Report intervals
-=====================
-
-A report interval can be specified so that commands like register,
-balance 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
-complex intervals may be specified with a period expression.  Report
-intervals can not be specified with a query.
-
-
-File: hledger.info,  Node: Period expressions,  Next: Depth limiting,  Prev: Report intervals,  Up: OPTIONS
-
-2.12 Period expressions
-=======================
-
-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 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
-"-".  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
-also be written as:
-
-'-p "1/1 4/1"'
-'-p "january-apr"'
-'-p "this year to 4/1"'
-
-   If you specify only one date, the missing start or end date will be
-the earliest or latest transaction in your journal:
-
-'-p "from 2009/1/1"'   everything after january 1, 2009
-'-p "from 2009/1"'     the same
-'-p "from 2009"'       the same
-'-p "to 2009"'         everything before january 1, 2009
-
-   A single date with no "from" or "to" defines both the start and end
-date like so:
-
-'-p "2009"'       the year 2009; equivalent to "2009/1/1 to 2010/1/1"
-'-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"
-
-   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
-'-D','-W','-M','-Q', or '-Y' flags.  Between report interval and
-start/end dates (if any), the word 'in' is optional.  Examples:
-
-'-p "weekly from 2009/1/1 to 2009/4/1"'
-'-p "monthly in 2008"'
-'-p "quarterly"'
-
-   Note that 'weekly', 'monthly', 'quarterly' and 'yearly' intervals
-will always start on the first day on week, month, quarter or year
-accordingly, and will end on the last day of same period, even if
-associated period expression specifies different explicit start and end
-date.
-
-   For example:
-
-'-p "weekly from 2009/1/1 to 2009/4/1"' - starts on 2008/12/29, closest preceding Monday
-'-p "monthly in 2008/11/25"' - starts on 2018/11/01
-'-p "quarterly from 2009-05-05 to 2009-06-01"' - starts on 2009/04/01, ends on 2009/06/30, which are first and last days of Q2 2009
-'-p "yearly from 2009-12-29"' - starts on 2009/01/01, first day of 2009
-
-   The following more complex report intervals are also supported:
-'biweekly', '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
-end on the last one, as described above.
-
-   Examples:
-
-'-p "bimonthly from 2008"' - periods will have boundaries on 2008/01/01, 2008/03/01, ...
-'-p "every 2 weeks"' - starts on closest preceding Monday
-'-p "every 5 month from 2009/03"' - periods will have boundaries on 2009/03/01, 2009/08/01, ...
-
-   If you want intervals that start on arbitrary day of your choosing
-and span a week, month or year, you need to use any of the following:
-
-   'every Nth day of week', 'every <weekday>', 'every Nth day [of
-month]', 'every Nth weekday [of month]', 'every MM/DD [of year]', 'every
-Nth MMM [of year]', 'every MMM Nth [of year]'.
-
-   Examples:
-
-'-p "every 2nd day of week"' - periods will go from Tue to Tue
-'-p "every Tue"' - same
-'-p "every 15th day"' - period boundaries will be on 15th of each month
-'-p "every 2nd Monday"' - period boundaries will be on second Monday of each month
-'-p "every 11/05"' - yearly periods with boundaries on 5th of Nov
-'-p "every 5th Nov"' - same
-'-p "every Nov 5th"' - same
-
-   Show historical balances at end of 15th each month (N is exclusive
-end date):
-
-   'hledger balance -H -p "every 16th day"'
-
-   Group postings from start of wednesday to end of next tuesday (N is
-start date and exclusive end date):
-
-   'hledger register checking -p "every 3rd day of week"'
-
-
-File: hledger.info,  Node: Depth limiting,  Next: Pivoting,  Prev: Period expressions,  Up: OPTIONS
-
-2.13 Depth limiting
-===================
-
-With the '--depth N' option (short form: '-N'), commands like account,
-balance and register will show only the uppermost accounts in the
-account tree, down to level N. Use this when you want a summary with
-less detail.  This flag has the same effect as a 'depth:' query argument
-(so '-2', '--depth=2' or 'depth:2' are basically equivalent).
-
-
-File: hledger.info,  Node: Pivoting,  Next: Valuation,  Prev: Depth limiting,  Up: OPTIONS
-
-2.14 Pivoting
-=============
-
-Normally hledger sums amounts, and organizes them in a hierarchy, based
-on account name.  The '--pivot FIELD' option causes it to sum and
-organize hierarchy based on the value of some other field instead.
-FIELD can be: 'code', 'description', 'payee', 'note', or the full name
-(case insensitive) of any tag.  As with account names, values containing
-'colon:separated:parts' will be displayed hierarchically in reports.
-
-   '--pivot' is a general option affecting all reports; you can think of
-hledger transforming the journal before any other processing, replacing
-every posting's account name with the value of the specified field on
-that posting, inheriting it from the transaction or using a blank value
-if it's not present.
-
-   An example:
-
-2016/02/16 Member Fee Payment
-    assets:bank account                    2 EUR
-    income:member fees                    -2 EUR  ; member: John Doe
-
-   Normal balance report showing account names:
-
-$ hledger balance
-               2 EUR  assets:bank account
-              -2 EUR  income:member fees
---------------------
-                   0
-
-   Pivoted balance report, using member: tag values instead:
-
-$ hledger balance --pivot member
-               2 EUR
-              -2 EUR  John Doe
---------------------
-                   0
-
-   One way to show only amounts with a member: value (using a query,
-described below):
-
-$ hledger balance --pivot member tag:member=.
-              -2 EUR  John Doe
---------------------
-              -2 EUR
-
-   Another way (the acct: query matches against the pivoted "account
-name"):
-
-$ hledger balance --pivot member acct:.
-              -2 EUR  John Doe
---------------------
-              -2 EUR
-
-
-File: hledger.info,  Node: Valuation,  Next: Output destination,  Prev: Pivoting,  Up: OPTIONS
-
-2.15 Valuation
-==============
-
-* Menu:
-
-* -B Cost::
-* -V Market value::
-* -X Market value in specified commodity::
-* --value Flexible valuation::
-* Effect of --value on reports::
-* Combining -B -V -X --value::
-
-
-File: hledger.info,  Node: -B Cost,  Next: -V Market value,  Up: Valuation
-
-2.15.1 -B: Cost
----------------
-
-The '-B/--cost' flag converts amounts to their cost (or selling price)
-at transaction time, if they have a transaction price specified.  This
-flag is equivalent to '--value=cost', described below.
-
-
-File: hledger.info,  Node: -V Market value,  Next: -X Market value in specified commodity,  Prev: -B Cost,  Up: Valuation
-
-2.15.2 -V: Market value
------------------------
-
-The '-V/--market' flag converts reported amounts to their market value
-in a default valuation commodity, using the market prices in effect on a
-default valuation date.  For single period reports, the valuation date
-is today (equivalent to '--value=now'); for multiperiod reports, it is
-the last day of each subperiod (equivalent to '--value=end').
-
-   The default valuation commodity is the one referenced in the latest
-applicable market price dated on or before the valuation date.  If most
-of your P declarations lead to a single home currency, this will usually
-be what you want.  (To specify the commodity, see -X below.)
-
-   Note that in hledger, market prices are always declared explicitly
-with P directives; we do not infer them from transaction prices as
-Ledger does.
-
-   Here's a quick example of -V:
-
-; one euro is worth this many dollars from nov 1
-P 2016/11/01 € $1.10
-
-; purchase some euros on nov 3
-2016/11/3
-    assets:euros        €100
-    assets:checking
-
-; the euro is worth fewer dollars by dec 21
-P 2016/12/21 € $1.03
-
-   How many euros do I have ?
-
-$ hledger -f t.j bal -N euros
-                €100  assets:euros
-
-   What are they worth at end of nov 3 ?
-
-$ hledger -f t.j bal -N euros -V -e 2016/11/4
-             $110.00  assets:euros
-
-   What are they worth after 2016/12/21 ?  (no report end date
-specified, defaults to today)
-
-$ hledger -f t.j bal -N euros -V
-             $103.00  assets:euros
-
-
-File: hledger.info,  Node: -X Market value in specified commodity,  Next: --value Flexible valuation,  Prev: -V Market value,  Up: Valuation
-
-2.15.3 -X: Market value in specified commodity
-----------------------------------------------
-
-The '-X/--exchange' option is like '-V', except it specifies the target
-commodity you would like to convert to.  It is equivalent to
-'--value=now,COMM' or '--value=end,COMM'.
-
-
-File: hledger.info,  Node: --value Flexible valuation,  Next: Effect of --value on reports,  Prev: -X Market value in specified commodity,  Up: Valuation
-
-2.15.4 -value: Flexible valuation
----------------------------------
-
-_(experimental, added 201905)_
-
-   '-B', '-V' and '-X' are special cases of the more general '--value'
-option:
-
- --value=TYPE[,COMM]  TYPE is cost, end, now or YYYY-MM-DD.
-                      COMM is an optional commodity symbol.
-                      Shows amounts converted to:
-                      - cost commodity using transaction prices (then optionally to COMM using market prices at period end(s))
-                      - default valuation commodity (or COMM) using market prices at period end(s)
-                      - default valuation commodity (or COMM) using current market prices
-                      - default valuation commodity (or COMM) using market prices at some date
-
-   The TYPE part basically selects either "cost", or "market value" plus
-a valuation date:
-
-'--value=cost'
-
-     Convert amounts to cost, using the prices recorded in transactions.
-'--value=end'
-
-     Convert amounts to their value in a default valuation commodity,
-     using market prices on the last day of the report period (or if
-     unspecified, the journal's end date); or in multiperiod reports,
-     market prices on the last day of each subperiod.
-'--value=now'
-
-     Convert amounts to their value in default valuation commodity using
-     current market prices (as of when report is generated).
-'--value=YYYY-MM-DD'
-
-     Convert amounts to their value in default valuation commodity using
-     market prices on this date.
-
-   The default valuation commodity is the commodity mentioned in the
-most recent applicable market price declaration.  When all your price
-declarations lead to a single home currency, this will usually do what
-you want.
-
-   To select a different valuation commodity, add the optional ',COMM'
-part: a comma, then the target commodity's symbol.  Eg:
-*'--value=now,EUR'*.  hledger will do its best to convert amounts to
-this commodity, using:
-
-   * declared prices (from source commodity to valuation commodity)
-   * reverse prices (declared prices from valuation to source commodity,
-     inverted)
-   * indirect prices (prices calculated from the shortest chain of
-     declared or reverse prices from source to valuation commodity)
-
-   in that order.
-
-   Here are some examples showing the effect of '--value' as seen with
-'print':
-
-P 2000-01-01 A  1 B
-P 2000-02-01 A  2 B
-P 2000-03-01 A  3 B
-P 2000-04-01 A  4 B
-
-2000-01-01
-  (a)      1 A @ 5 B
-
-2000-02-01
-  (a)      1 A @ 6 B
-
-2000-03-01
-  (a)      1 A @ 7 B
-
-   Show the cost of each posting:
-
-$ hledger -f- print --value=cost
-2000/01/01
-    (a)             5 B
-
-2000/02/01
-    (a)             6 B
-
-2000/03/01
-    (a)             7 B
-
-   Show the value as of the last day of the report period (2000-02-29):
-
-$ hledger -f- print --value=end date:2000/01-2000/03
-2000-01-01
-    (a)             2 B
-
-2000-02-01
-    (a)             2 B
-
-   With no report period specified, that shows the value as of the last
-day of the journal (2000-03-01):
-
-$ hledger -f- print --value=end
-2000/01/01
-    (a)             3 B
-
-2000/02/01
-    (a)             3 B
-
-2000/03/01
-    (a)             3 B
-
-   Show the current value (the 2000-04-01 price is still in effect
-today):
-
-$ hledger -f- print --value=now
-2000-01-01
-    (a)             4 B
-
-2000-02-01
-    (a)             4 B
-
-2000-03-01
-    (a)             4 B
-
-   Show the value on 2000/01/15:
-
-$ hledger -f- print --value=2000-01-15
-2000/01/01
-    (a)             1 B
-
-2000/02/01
-    (a)             1 B
-
-2000/03/01
-    (a)             1 B
-
-   You may need to explicitly set a commodity's display style, when
-reverse prices are used.  Eg this output might be surprising:
-
-P 2000-01-01 A 2B
-
-2000-01-01
-  a  1B
-  b
-
-$ hledger print -x -X A
-2000/01/01
-    a               0
-    b               0
-
-   Explanation: because there's no amount or commodity directive
-specifying a display style for A, 0.5A gets the default style, which
-shows no decimal digits.  Because the displayed amount looks like zero,
-the commodity symbol and minus sign are not displayed either.  Adding a
-commodity directive sets a more useful display style for A:
-
-P 2000-01-01 A 2B
-commodity 0.00A
-
-2000-01-01
-  a  1B
-  b
-
-$ hledger print -X A
-2000/01/01
-    a           0.50A
-    b          -0.50A
-
-
-File: hledger.info,  Node: Effect of --value on reports,  Next: Combining -B -V -X --value,  Prev: --value Flexible valuation,  Up: Valuation
-
-2.15.5 Effect of -value on reports
-----------------------------------
-
-Here is a reference for how '--value' currently affects each part of
-hledger's reports.  It's work in progress, but may be useful for
-troubleshooting or reporting bugs.  See also the definitions and notes
-below.  If you find problems, please report them, ideally with a
-reproducible example.  Related: #329, #1083.
-
-Report type     '-B',          '-V', '-X'      '--value=end'    '--value=DATE',
-                '--value=cost'                                  '--value=now'
------------------------------------------------------------------------------
-*print*
-posting         cost           value at        value at         value at
-amounts                        report end or   report or        DATE/today
-                               today           journal end
-balance         unchanged      unchanged       unchanged        unchanged
-assertions /
-assignments
-*register*
-starting        cost           value at day    value at day     value at
-balance (with                  before report   before report    DATE/today
--H)                            or journal      or journal
-                               start           start
-posting         cost           value at        value at         value at
-amounts (no                    report end or   report or        DATE/today
-report                         today           journal end
-interval)
-summary         summarised     value at        value at         value at
-posting         cost           period ends     period ends      DATE/today
-amounts (with
-report
-interval)
-running         sum/average    sum/average     sum/average of   sum/average
-total/average   of displayed   of displayed    displayed        of
-                values         values          values           displayed
-                                                                values
-*balance (bs,
-bse, cf,
-is..)*
-balances (no    sums of        value at        value at         value at
-report          costs          report end or   report or        DATE/today
-interval)                      today of sums   journal end of   of sums of
-                               of postings     sums of          postings
-                                               postings
-balances        sums of        value at        value at         value at
-(with report    costs          period ends     period ends of   DATE/today
-interval)                      of sums of      sums of          of sums of
-                               postings        postings         postings
-starting        sums of        sums of         sums of          sums of
-balances        costs of       postings        postings         postings
-(with report    postings       before report   before report    before
-interval and    before         start           start            report
--H)             report start                                    start
-budget          like           like balances   like balances    like
-amounts with    balances                                        balances
--budget
-grand total     sum of         sum of          sum of           sum of
-(no report      displayed      displayed       displayed        displayed
-interval)       values         values          values           values
-row             sums/averages  sums/averages   sums/averages    sums/averages
-totals/averages of displayed   of displayed    of displayed     of
-(with report    values         values          values           displayed
-interval)                                                       values
-column totals   sums of        sums of         sums of          sums of
-                displayed      displayed       displayed        displayed
-                values         values          values           values
-grand           sum/average    sum/average     sum/average of   sum/average
-total/average   of column      of column       column totals    of column
-                totals         totals                           totals
-
-   *Additional notes*
-
-_cost_
-
-     calculated using price(s) recorded in the transaction(s).
-_value_
-
-     market value using available market price declarations, or the
-     unchanged amount if no conversion rate can be found.
-_report start_
-
-     the first day of the report period specified with -b or -p or
-     date:, otherwise today.
-_report or journal start_
-
-     the first day of the report period specified with -b or -p or
-     date:, otherwise the earliest transaction date in the journal,
-     otherwise today.
-_report end_
-
-     the last day of the report period specified with -e or -p or date:,
-     otherwise today.
-_report or journal end_
-
-     the last day of the report period specified with -e or -p or date:,
-     otherwise the latest transaction date in the journal, otherwise
-     today.
-_report interval_
-
-     a flag (-D/-W/-M/-Q/-Y) or period expression that activates the
-     report's multi-period mode (whether showing one or many
-     subperiods).
-
-
-File: hledger.info,  Node: Combining -B -V -X --value,  Prev: Effect of --value on reports,  Up: Valuation
-
-2.15.6 Combining -B, -V, -X, -value
------------------------------------
-
-The rightmost of these flags wins.
-
-
-File: hledger.info,  Node: Output destination,  Next: Output format,  Prev: Valuation,  Up: OPTIONS
-
-2.16 Output destination
-=======================
-
-Some commands (print, register, stats, the balance commands) can write
-their output to a destination other than the console.  This is
-controlled by the '-o/--output-file' option.
-
-$ hledger balance -o -     # write to stdout (the default)
-$ hledger balance -o FILE  # write to FILE
-
-
-File: hledger.info,  Node: Output format,  Next: Regular expressions,  Prev: Output destination,  Up: OPTIONS
-
-2.17 Output format
-==================
-
-Some commands can write their output in other formats.  Eg print and
-register can output CSV, and the balance commands can output CSV or
-HTML. This is controlled by the '-O/--output-format' option, or by
-specifying a '.csv' or '.html' file extension with '-o/--output-file'.
-
-$ hledger balance -O csv       # write CSV to stdout
-$ hledger balance -o FILE.csv  # write CSV to FILE.csv
-
-
-File: hledger.info,  Node: Regular expressions,  Prev: Output format,  Up: OPTIONS
-
-2.18 Regular expressions
-========================
-
-hledger uses regular expressions in a number of places:
-
-   * query terms, on the command line and in the hledger-web search
-     form: 'REGEX', 'desc:REGEX', 'cur:REGEX', 'tag:...=REGEX'
-   * CSV rules conditional blocks: 'if REGEX ...'
-   * account alias directives and options: 'alias /REGEX/ =
-     REPLACEMENT', '--alias /REGEX/=REPLACEMENT'
-
-   hledger's regular expressions come from the regex-tdfa library.  In
-general they:
-
-   * are case insensitive
-   * are infix matching (do not need to match the entire thing being
-     matched)
-   * are POSIX extended regular expressions
-   * also support GNU word boundaries (\<, \>, \b, \B)
-   * and parenthesised capturing groups and numeric backreferences in
-     replacement strings
-   * do not support mode modifiers like (?s)
-
-   Some things to note:
-
-   * In the 'alias' directive and '--alias' option, regular expressions
-     must be enclosed in forward slashes ('/REGEX/').  Elsewhere in
-     hledger, these are not required.
-
-   * 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:\$'.
-
-   * On the command line, some metacharacters like '$' have a special
-     meaning to the shell and so must be escaped at least once more.
-     See Special characters.
-
-
-File: hledger.info,  Node: QUERIES,  Next: COMMANDS,  Prev: OPTIONS,  Up: Top
-
-3 QUERIES
-*********
-
-One of hledger's strengths is being able to quickly report on precise
-subsets of your data.  Most commands accept an optional query
-expression, written as arguments after the command name, to filter the
-data by date, account name or other criteria.  The syntax is similar to
-a web search: one or more space-separated search terms, quotes to
-enclose whitespace, prefixes to match specific fields, a not: prefix to
-negate the match.
-
-   We do not yet support arbitrary boolean combinations of search terms;
-instead most commands show transactions/postings/accounts which match
-(or negatively match):
-
-   * any of the description terms AND
-   * any of the account terms AND
-   * any of the status terms AND
-   * all the other terms.
-
-   The print command instead shows transactions which:
-
-   * match any of the description terms AND
-   * have any postings matching any of the positive account terms AND
-   * have no postings matching any of the negative account terms AND
-   * match all the other terms.
-
-   The following kinds of search terms can be used.  Remember these can
-also be prefixed with *'not:'*, eg to exclude a particular subaccount.
-
-*'REGEX', 'acct:REGEX'*
-
-     match account names by this regular expression.  (With no prefix,
-     'acct:' is assumed.)  same as above
-
-*'amt:N, amt:<N, amt:<=N, amt:>N, amt:>=N'*
-
-     match postings with a single-commodity amount that is equal to,
-     less than, or greater than N. (Multi-commodity amounts are not
-     tested, and will always match.)  The comparison has two modes: if N
-     is preceded by a + or - sign (or is 0), the two signed numbers are
-     compared.  Otherwise, the absolute magnitudes are compared,
-     ignoring sign.
-*'code:REGEX'*
-
-     match by transaction code (eg check number)
-*'cur:REGEX'*
-
-     match postings or transactions including any amounts whose
-     currency/commodity symbol is fully matched by REGEX. (For a partial
-     match, use '.*REGEX.*').  Note, to match characters which are
-     regex-significant, like the dollar sign ('$'), you need to prepend
-     '\'.  And when using the command line you need to add one more
-     level of quoting to hide it from the shell, so eg do: 'hledger
-     print cur:'\$'' or 'hledger print cur:\\$'.
-*'desc:REGEX'*
-
-     match transaction descriptions.
-*'date:PERIODEXPR'*
-
-     match dates within the specified period.  PERIODEXPR is a period
-     expression (with no report interval).  Examples: 'date:2016',
-     'date:thismonth', 'date:2000/2/1-2/15', 'date:lastweek-'.  If the
-     '--date2' command line flag is present, this matches secondary
-     dates instead.
-*'date2:PERIODEXPR'*
-
-     match secondary dates within the specified period.
-*'depth:N'*
-
-     match (or display, depending on command) accounts at or above this
-     depth
-*'note:REGEX'*
-
-     match transaction notes (part of description right of '|', or whole
-     description when there's no '|')
-*'payee:REGEX'*
-
-     match transaction payee/payer names (part of description left of
-     '|', or whole description when there's no '|')
-*'real:, real:0'*
-
-     match real or virtual postings respectively
-*'status:, status:!, status:*'*
-
-     match unmarked, pending, or cleared transactions respectively
-*'tag:REGEX[=REGEX]'*
-
-     match by tag name, and optionally also by tag value.  Note a tag:
-     query is considered to match a transaction if it matches any of the
-     postings.  Also remember that postings inherit the tags of their
-     parent transaction.
-
-   The following special search term is used automatically in
-hledger-web, only:
-
-*'inacct:ACCTNAME'*
-
-     tells hledger-web to show the transaction register for this
-     account.  Can be filtered further with 'acct' etc.
-
-   Some of these can also be expressed as command-line options (eg
-'depth:2' is equivalent to '--depth 2').  Generally you can mix options
-and query arguments, and the resulting query will be their intersection
-(perhaps excluding the '-p/--period' option).
-
-
-File: hledger.info,  Node: COMMANDS,  Next: ADD-ON COMMANDS,  Prev: QUERIES,  Up: Top
-
-4 COMMANDS
-**********
-
-hledger provides a number of subcommands; 'hledger' with no arguments
-shows a list.
-
-   If you install additional 'hledger-*' packages, or if you put
-programs or scripts named 'hledger-NAME' in your PATH, these will also
-be listed as subcommands.
-
-   Run a subcommand by writing its name as first argument (eg 'hledger
-incomestatement').  You can also write one of the standard short aliases
-displayed in parentheses in the command list ('hledger b'), or any any
-unambiguous prefix of a command name ('hledger inc').
-
-   Here are all the builtin commands in alphabetical order.  See also
-'hledger' for a more organised command list, and 'hledger CMD -h' for
-detailed command help.
-
-* Menu:
-
-* accounts::
-* activity::
-* add::
-* balance::
-* balancesheet::
-* balancesheetequity::
-* cashflow::
-* check-dates::
-* check-dupes::
-* close::
-* commodities::
-* descriptions::
-* diff::
-* files::
-* help::
-* import::
-* incomestatement::
-* notes::
-* payees::
-* prices::
-* print::
-* print-unique::
-* register::
-* register-match::
-* rewrite::
-* roi::
-* stats::
-* tags::
-* test::
-
-
-File: hledger.info,  Node: accounts,  Next: activity,  Up: COMMANDS
-
-4.1 accounts
-============
-
-accounts, a
-Show account names.
-
-   This command lists account names, either declared with account
-directives (-declared), posted to (-used), or both (the default).  With
-query arguments, only matched account names and account names referenced
-by matched postings are shown.  It shows a flat list by default.  With
-'--tree', it uses indentation to show the account hierarchy.  In flat
-mode you can add '--drop N' to omit the first few account name
-components.  Account names can be depth-clipped with 'depth:N' or
-'--depth N' or '-N'.
-
-   Examples:
-
-$ hledger accounts
-assets:bank:checking
-assets:bank:saving
-assets:cash
-expenses:food
-expenses:supplies
-income:gifts
-income:salary
-liabilities:debts
-
-
-File: hledger.info,  Node: activity,  Next: add,  Prev: accounts,  Up: COMMANDS
-
-4.2 activity
-============
-
-activity
-Show an ascii barchart of posting counts per interval.
-
-   The activity command displays an ascii histogram showing transaction
-counts by day, week, month or other reporting interval (by day is the
-default).  With query arguments, it counts only matched transactions.
-
-   Examples:
-
-$ hledger activity --quarterly
-2008-01-01 **
-2008-04-01 *******
-2008-07-01 
-2008-10-01 **
-
-
-File: hledger.info,  Node: add,  Next: balance,  Prev: activity,  Up: COMMANDS
-
-4.3 add
-=======
-
-add
-Prompt for transactions and add them to the journal.
-
-   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
-transactions, 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.
-
-   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 control-d or control-c to exit.
-
-   Features:
-
-   * add tries to provide useful defaults, using the most similar (by
-     description) recent transaction (filtered by the query, if any) as
-     a template.
-   * You can also set the initial defaults with command line arguments.
-   * Readline-style edit keys can be used during data entry.
-   * The tab key will auto-complete whenever possible - accounts,
-     descriptions, dates ('yesterday', 'today', 'tomorrow').  If the
-     input area is empty, it will insert the default value.
-   * If the journal defines a default commodity, it will be added to any
-     bare numbers entered.
-   * A parenthesised transaction code may be entered following a date.
-   * Comments and tags may be entered following a description or amount.
-   * If you make a mistake, enter '<' at any prompt to restart the
-     transaction.
-   * Input prompts are displayed in a different colour when the terminal
-     supports it.
-
-   Example (see the tutorial for a detailed explanation):
-
-$ hledger add
-Adding transactions to journal file /src/hledger/examples/sample.journal
-Any command line arguments will be used as defaults.
-Use tab key to complete, readline keys to edit, enter to accept defaults.
-An optional (CODE) may follow transaction dates.
-An optional ; COMMENT may follow descriptions or amounts.
-If you make a mistake, enter < at any prompt to restart the transaction.
-To end a transaction, enter . when prompted.
-To quit, enter . at a date prompt or press control-d or control-c.
-Date [2015/05/22]: 
-Description: supermarket
-Account 1: expenses:food
-Amount  1: $10
-Account 2: assets:checking
-Amount  2 [$-10.0]: 
-Account 3 (or . or enter to finish this transaction): .
-2015/05/22 supermarket
-    expenses:food             $10
-    assets:checking        $-10.0
-
-Save this transaction to the journal ? [y]: 
-Saved.
-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 platform
-(cf #1056).
-
-
-File: hledger.info,  Node: balance,  Next: balancesheet,  Prev: add,  Up: COMMANDS
-
-4.4 balance
-===========
-
-balance, bal, b
-Show accounts and their balances.
-
-   The balance command is hledger's most versatile command.  Note,
-despite the name, it is not always used for showing real-world account
-balances; the more accounting-aware balancesheet and incomestatement may
-be more convenient for that.
-
-   By default, it displays all accounts, and each account's change in
-balance during the entire period of the journal.  Balance changes are
-calculated by adding up the postings in each account.  You can limit the
-postings matched, by a query, to see fewer accounts, changes over a
-different time period, changes from only cleared transactions, etc.
-
-   If you include an account's complete history of postings in the
-report, the balance change is equivalent to the account's current ending
-balance.  For a real-world account, typically you won't have all
-transactions in the journal; instead you'll have all transactions after
-a certain date, and an "opening balances" transaction setting the
-correct starting balance on that date.  Then the balance command will
-show real-world account balances.  In some cases the -H/-historical flag
-is used to ensure this (more below).
-
-   The balance command can produce several styles of report:
-
-* Menu:
-
-* Classic balance report::
-* Customising the classic balance report::
-* Colour support::
-* Flat mode::
-* Depth limited balance reports::
-* Percentages::
-* Multicolumn balance report::
-* Budget report::
-* Output format::
-
-
-File: hledger.info,  Node: Classic balance report,  Next: Customising the classic balance report,  Up: balance
-
-4.4.1 Classic balance report
-----------------------------
-
-This is the original balance report, as found in Ledger.  It usually
-looks like this:
-
-$ hledger balance
-                 $-1  assets
-                  $1    bank:saving
-                 $-2    cash
-                  $2  expenses
-                  $1    food
-                  $1    supplies
-                 $-2  income
-                 $-1    gifts
-                 $-1    salary
-                  $1  liabilities:debts
---------------------
-                   0
-
-   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.
-
-   "Boring" accounts, which contain a single interesting subaccount and
-no balance of their own, are elided into the following line for more
-compact output.  (Eg above, the "liabilities" account.)  Use
-'--no-elide' to prevent this.
-
-   Account balances are "inclusive" - they include the balances of any
-subaccounts.
-
-   Accounts which have zero balance (and no non-zero subaccounts) are
-omitted.  Use '-E/--empty' to show them.
-
-   A final total is displayed by default; use '-N/--no-total' to
-suppress it, eg:
-
-$ hledger balance -p 2008/6 expenses --no-total
-                  $2  expenses
-                  $1    food
-                  $1    supplies
-
-
-File: hledger.info,  Node: Customising the classic balance report,  Next: Colour support,  Prev: Classic balance report,  Up: balance
-
-4.4.2 Customising the classic balance report
---------------------------------------------
-
-You can customise the layout of classic balance reports with '--format
-FMT':
-
-$ hledger balance --format "%20(account) %12(total)"
-              assets          $-1
-         bank:saving           $1
-                cash          $-2
-            expenses           $2
-                food           $1
-            supplies           $1
-              income          $-2
-               gifts          $-1
-              salary          $-1
-   liabilities:debts           $1
----------------------------------
-                                0
-
-   The FMT format string (plus a newline) specifies the formatting
-applied to each account/balance pair.  It may contain any suitable text,
-with data fields interpolated like so:
-
-   '%[MIN][.MAX](FIELDNAME)'
-
-   * MIN pads with spaces to at least this width (optional)
-
-   * MAX truncates at this width (optional)
-
-   * FIELDNAME must be enclosed in parentheses, and can be one of:
-
-        * 'depth_spacer' - a number of spaces equal to the account's
-          depth, or if MIN is specified, MIN * depth spaces.
-        * 'account' - the account's name
-        * 'total' - the account's balance/posted total, right justified
-
-   Also, FMT can begin with an optional prefix to control how
-multi-commodity amounts are rendered:
-
-   * '%_' - render on multiple lines, bottom-aligned (the default)
-   * '%^' - render on multiple lines, top-aligned
-   * '%,' - render on one line, comma-separated
-
-   There are some quirks.  Eg in one-line mode, '%(depth_spacer)' has no
-effect, instead '%(account)' has indentation built in.  Experimentation
-may be needed to get pleasing results.
-
-   Some example formats:
-
-   * '%(total)' - the account's total
-   * '%-20.20(account)' - the account's name, left justified, padded to
-     20 characters and clipped at 20 characters
-   * '%,%-50(account) %25(total)' - account name padded to 50
-     characters, total padded to 20 characters, with multiple
-     commodities rendered on one line
-   * '%20(total) %2(depth_spacer)%-(account)' - the default format for
-     the single-column balance report
-
-
-File: hledger.info,  Node: Colour support,  Next: Flat mode,  Prev: Customising the classic balance report,  Up: balance
-
-4.4.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
-
-
-File: hledger.info,  Node: Flat mode,  Next: Depth limited balance reports,  Prev: Colour support,  Up: balance
-
-4.4.4 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
-this mode, you can also use '--drop N' to omit the first few account
-name components.
-
-$ hledger balance -p 2008/6 expenses -N --flat --drop 1
-                  $1  food
-                  $1  supplies
-
-
-File: hledger.info,  Node: Depth limited balance reports,  Next: Percentages,  Prev: Flat mode,  Up: balance
-
-4.4.5 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 a complex set of accounts and get an overview.
-
-$ hledger balance -N -1
-                 $-1  assets
-                  $2  expenses
-                 $-2  income
-                  $1  liabilities
-
-   Flat-mode balance reports, which normally show exclusive balances,
-show inclusive balances at the depth limit.
-
-
-File: hledger.info,  Node: Percentages,  Next: Multicolumn balance report,  Prev: Depth limited balance reports,  Up: balance
-
-4.4.6 Percentages
------------------
-
-With '-%' or '--percent', balance reports show each account's value
-expressed 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 -%
-             100.0 %  expenses
-              50.0 %    food
-              50.0 %    supplies
---------------------
-             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
-relative 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 (eg
-'hledger balance -B') all percentage values will be zero.
-
-   This flag does not work if the report contains any mixed commodity
-accounts.  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.
-
-
-File: hledger.info,  Node: Multicolumn balance report,  Next: Budget report,  Prev: Percentages,  Up: balance
-
-4.4.7 Multicolumn balance report
---------------------------------
-
-Multicolumn or tabular balance reports are a very useful hledger
-feature, and usually the preferred style.  They share many of the above
-features, but they show the report as a table, with columns representing
-time periods.  This mode is activated by providing a reporting interval.
-
-   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 for a monthly income statement:
-
-     $ hledger balance --quarterly income expenses -E
-     Balance changes in 2008:
-     
-                        ||  2008q1  2008q2  2008q3  2008q4 
-     ===================++=================================
-      expenses:food     ||       0      $1       0       0 
-      expenses:supplies ||       0      $1       0       0 
-      income:gifts      ||       0     $-1       0       0 
-      income:salary     ||     $-1       0       0       0 
-     -------------------++---------------------------------
-                        ||     $-1      $1       0       0 
-
-  2. With '--cumulative': each column shows the ending balance for that
-     period, accumulating the changes across periods, starting from 0 at
-     the report start date:
-
-     $ hledger balance --quarterly income expenses -E --cumulative
-     Ending balances (cumulative) in 2008:
-     
-                        ||  2008/03/31  2008/06/30  2008/09/30  2008/12/31 
-     ===================++=================================================
-      expenses:food     ||           0          $1          $1          $1 
-      expenses:supplies ||           0          $1          $1          $1 
-      income:gifts      ||           0         $-1         $-1         $-1 
-      income:salary     ||         $-1         $-1         $-1         $-1 
-     -------------------++-------------------------------------------------
-                        ||         $-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 useful eg for a multi-period balance sheet, and when you
-     are showing only the data after a certain start date:
-
-     $ hledger balance ^assets ^liabilities --quarterly --historical --begin 2008/4/1
-     Ending balances (historical) in 2008/04/01-2008/12/31:
-     
-                           ||  2008/06/30  2008/09/30  2008/12/31 
-     ======================++=====================================
-      assets:bank:checking ||          $1          $1           0 
-      assets:bank:saving   ||          $1          $1          $1 
-      assets:cash          ||         $-2         $-2         $-2 
-      liabilities:debts    ||           0           0          $1 
-     ----------------------++-------------------------------------
-                           ||           0           0           0 
-
-   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;
-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 the
-displayed report periods.  This is so that the first and last periods
-will be "full" and comparable to the others.
-
-   The '-E/--empty' flag does two things in multicolumn balance reports:
-first, the report will show all columns within the specified report
-period (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 row.
-
-   Here's an example of all three:
-
-$ hledger balance -Q income expenses --tree -ETA
-Balance changes in 2008:
-
-            ||  2008q1  2008q2  2008q3  2008q4    Total  Average 
-============++===================================================
- expenses   ||       0      $2       0       0       $2       $1 
-   food     ||       0      $1       0       0       $1        0 
-   supplies ||       0      $1       0       0       $1        0 
- income     ||     $-1     $-1       0       0      $-2      $-1 
-   gifts    ||       0     $-1       0       0      $-1        0 
-   salary   ||     $-1       0       0       0      $-1        0 
-------------++---------------------------------------------------
-            ||     $-1      $1       0       0        0        0 
-
-# Average is rounded to the dollar here since all journal amounts are
-
-   Limitations:
-
-   In multicolumn reports the '-V/--value' flag uses the market price on
-the report end date, for all columns (not the price on each column's end
-date).
-
-   Eliding of boring parent accounts in tree mode, as in the classic
-balance report, is not yet supported in multicolumn reports.
-
-
-File: hledger.info,  Node: Budget report,  Next: ,  Prev: Multicolumn balance report,  Up: balance
-
-4.4.8 Budget report
--------------------
-
-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
-income, expenses, time usage, etc.  -budget is most often combined with
-a report interval.
-
-   For example, you can take average monthly expenses in the common
-expense categories to construct a minimal monthly budget:
-
-;; Budget
-~ monthly
-  income  $2000
-  expenses:food    $400
-  expenses:bus     $50
-  expenses:movies  $30
-  assets:bank:checking
-
-;; Two months worth of expenses
-2017-11-01
-  income  $1950
-  expenses:food    $396
-  expenses:bus     $49
-  expenses:movies  $30
-  expenses:supplies  $20
-  assets:bank:checking
-
-2017-12-01
-  income  $2100
-  expenses:food    $412
-  expenses:bus     $53
-  expenses:gifts   $100
-  assets:bank:checking
-
-   You can now see a monthly budget report:
-
-$ hledger balance -M --budget
-Budget performance in 2017/11/01-2017/12/31:
-
-                      ||                      Nov                       Dec 
-======================++====================================================
- assets               || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
- assets:bank          || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
- assets:bank:checking || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
- expenses             ||   $495 [ 103% of   $480]    $565 [ 118% of   $480] 
- expenses:bus         ||    $49 [  98% of    $50]     $53 [ 106% of    $50] 
- expenses:food        ||   $396 [  99% of   $400]    $412 [ 103% of   $400] 
- expenses:movies      ||    $30 [ 100% of    $30]       0 [   0% of    $30] 
- income               ||  $1950 [  98% of  $2000]   $2100 [ 105% of  $2000] 
-----------------------++----------------------------------------------------
-                      ||      0 [              0]       0 [              0] 
-
-   Note this is different from a normal balance report in several ways:
-
-   * Only accounts with budget goals during the report period are shown,
-     by default.
-
-   * In each column, in square brackets after the actual amount,
-     budgeted amounts are shown, along with the percentage of budget
-     used.
-
-   * All parent accounts are always shown, even in flat mode.  Eg
-     assets, assets:bank, and expenses above.
-
-   * 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
-transactions, 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
-ones, giving the full picture.  Eg:
-
-$ hledger balance -M --budget --empty
-Budget performance in 2017/11/01-2017/12/31:
-
-                      ||                      Nov                       Dec 
-======================++====================================================
- assets               || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
- assets:bank          || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
- assets:bank:checking || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
- expenses             ||   $495 [ 103% of   $480]    $565 [ 118% of   $480] 
- expenses:bus         ||    $49 [  98% of    $50]     $53 [ 106% of    $50] 
- expenses:food        ||   $396 [  99% of   $400]    $412 [ 103% of   $400] 
- expenses:gifts       ||      0                      $100                   
- expenses:movies      ||    $30 [ 100% of    $30]       0 [   0% of    $30] 
- expenses:supplies    ||    $20                         0                   
- income               ||  $1950 [  98% of  $2000]   $2100 [ 105% of  $2000] 
-----------------------++----------------------------------------------------
-                      ||      0 [              0]       0 [              0] 
-
-   You can roll over unspent budgets to next period with '--cumulative':
-
-$ hledger balance -M --budget --cumulative
-Budget performance in 2017/11/01-2017/12/31:
-
-                      ||                      Nov                       Dec 
-======================++====================================================
- assets               || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960] 
- assets:bank          || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960] 
- assets:bank:checking || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960] 
- expenses             ||   $495 [ 103% of   $480]   $1060 [ 110% of   $960] 
- expenses:bus         ||    $49 [  98% of    $50]    $102 [ 102% of   $100] 
- expenses:food        ||   $396 [  99% of   $400]    $808 [ 101% of   $800] 
- expenses:movies      ||    $30 [ 100% of    $30]     $30 [  50% of    $60] 
- income               ||  $1950 [  98% of  $2000]   $4050 [ 101% of  $4000] 
-----------------------++----------------------------------------------------
-                      ||      0 [              0]       0 [              0] 
-
-   For more examples, see Budgeting and Forecasting.
-
-* Menu:
-
-* Nested budgets::
-
-
-File: hledger.info,  Node: Nested budgets,  Up: Budget report
-
-4.4.8.1 Nested budgets
-......................
-
-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
-budget(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
-account, all its parents would have budget as well.
-
-   To illustrate this, consider the following budget:
-
-~ monthly from 2019/01
-    expenses:personal             $1,000.00
-    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 implicity
-means that budget for both 'expenses:personal' and 'expenses' is $1100.
-
-   Transactions in 'expenses:personal:electronics' will be counted both
-towards its $100 budget and $1100 of 'expenses:personal' , and
-transactions 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:
-
-~ monthly from 2019/01
-    expenses:personal             $1,000.00
-    expenses:personal:electronics    $100.00
-    liabilities
-
-2019/01/01 Google home hub
-    expenses:personal:electronics          $90.00
-    liabilities                           $-90.00
-
-2019/01/02 Phone screen protector
-    expenses:personal:electronics:upgrades          $10.00
-    liabilities
-
-2019/01/02 Weekly train ticket
-    expenses:personal:train tickets       $153.00
-    liabilities
-
-2019/01/03 Flowers
-    expenses:personal          $30.00
-    liabilities
-
-   As you can see, we have transactions in
-'expenses:personal:electronics:upgrades' and 'expenses:personal:train
-tickets', and since both of these accounts are without explicitly
-defined budget, these transactions would be counted towards budgets of
-'expenses:personal:electronics' and 'expenses:personal' accordingly:
-
-$ hledger balance --budget -M
-Budget performance in 2019/01:
-
-                               ||                           Jan 
-===============================++===============================
- expenses                      ||  $283.00 [  26% of  $1100.00] 
- expenses:personal             ||  $283.00 [  26% of  $1100.00] 
- expenses:personal:electronics ||  $100.00 [ 100% of   $100.00] 
- liabilities                   || $-283.00 [  26% of $-1100.00] 
--------------------------------++-------------------------------
-                               ||        0 [                 0] 
-
-   And with '--empty', we can get a better picture of budget allocation
-and consumption:
-
-$ hledger balance --budget -M --empty
-Budget performance in 2019/01:
-
-                                        ||                           Jan 
-========================================++===============================
- expenses                               ||  $283.00 [  26% of  $1100.00] 
- expenses:personal                      ||  $283.00 [  26% of  $1100.00] 
- expenses:personal:electronics          ||  $100.00 [ 100% of   $100.00] 
- expenses:personal:electronics:upgrades ||   $10.00                      
- expenses:personal:train tickets        ||  $153.00                      
- liabilities                            || $-283.00 [  26% of $-1100.00] 
-----------------------------------------++-------------------------------
-                                        ||        0 [                 0] 
-
-4.4.9 Output format
--------------------
-
-The balance command supports output destination and output format
-selection.
-
-
-File: hledger.info,  Node: balancesheet,  Next: balancesheetequity,  Prev: balance,  Up: COMMANDS
-
-4.5 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).
-
-   Note this report shows all account balances with normal positive sign
-(like conventional financial statements, unlike balance/print/register)
-(experimental).
-
-   Example:
-
-$ hledger balancesheet
-Balance Sheet
-
-Assets:
-                 $-1  assets
-                  $1    bank:saving
-                 $-2    cash
---------------------
-                 $-1
-
-Liabilities:
-                  $1  liabilities:debts
---------------------
-                  $1
-
-Total:
---------------------
-                   0
-
-   With a reporting interval, multiple columns will be shown, one for
-each report period.  As with multicolumn balance reports, you can alter
-the report mode with '--change'/'--cumulative'/'--historical'.  Normally
-balancesheet shows historical ending balances, which is what you need
-for a balance sheet; note this means it ignores report begin dates (and
-'-T/--row-total', since summing end balances generally does not make
-sense).  Instead of absolute values percentages can be displayed with
-'-%'.
-
-   This command also supports output destination and output format
-selection.
-
-
-File: hledger.info,  Node: balancesheetequity,  Next: cashflow,  Prev: balancesheet,  Up: COMMANDS
-
-4.6 balancesheetequity
-======================
-
-balancesheetequity, bse
-Just like balancesheet, but also reports Equity (which it assumes is
-under a top-level 'equity' account).
-
-   Example:
-
-$ hledger balancesheetequity
-Balance Sheet With Equity
-
-Assets:
-                 $-2  assets
-                  $1    bank:saving
-                 $-3    cash
---------------------
-                 $-2
-
-Liabilities:
-                  $1  liabilities:debts
---------------------
-                  $1
-
-Equity:
-          $1  equity:owner
---------------------
-          $1
-
-Total:
---------------------
-                   0
-
-
-File: hledger.info,  Node: cashflow,  Next: check-dates,  Prev: balancesheetequity,  Up: COMMANDS
-
-4.7 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).
-
-   Example:
-
-$ hledger cashflow
-Cashflow Statement
-
-Cash flows:
-                 $-1  assets
-                  $1    bank:saving
-                 $-2    cash
---------------------
-                 $-1
-
-Total:
---------------------
-                 $-1
-
-   With a reporting interval, multiple columns will be shown, one for
-each report period.  Normally cashflow shows changes in assets per
-period, though as with multicolumn balance reports you can alter the
-report mode with '--change'/'--cumulative'/'--historical'.  Instead of
-absolute values percentages can be displayed with '-%'.
-
-   This command also supports output destination and output format
-selection.
-
-
-File: hledger.info,  Node: check-dates,  Next: check-dupes,  Prev: cashflow,  Up: COMMANDS
-
-4.8 check-dates
-===============
-
-check-dates
-Check that transactions are sorted by increasing date.  With -date2,
-checks secondary dates instead.  With -strict, dates must also be
-unique.  With a query, only matched transactions' dates are checked.
-Reads the default journal file, or another specified with -f.
-
-
-File: hledger.info,  Node: check-dupes,  Next: close,  Prev: check-dates,  Up: COMMANDS
-
-4.9 check-dupes
-===============
-
-check-dupes
-Reports account names having the same leaf but different prefixes.  In
-other words, two or more leaves that are categorized differently.  Reads
-the default journal file, or another specified as an argument.
-
-   An example: http://stefanorodighiero.net/software/hledger-dupes.html
-
-
-File: hledger.info,  Node: close,  Next: commodities,  Prev: check-dupes,  Up: COMMANDS
-
-4.10 close
-==========
-
-close, equity
-Prints a "closing balances" transaction and an "opening balances"
-transaction that bring account balances to and from zero, respectively.
-Useful for bringing asset/liability balances forward into a new journal
-file, or for closing out revenues/expenses to retained earnings at the
-end of a period.
-
-   The closing transaction transfers balances to "equity:closing
-balances", and the opening transaction transfers balances from
-"equity:opening balances", or you can customise these with the
-'--close-to' and '--open-from' options.  You can choose to print just
-one of the transactions by using the '--opening' or '--closing' flag.
-
-   If you split your journal files by time (eg yearly), you will
-typically run this command at the end of the year, and save the closing
-transaction as last entry of the old file, and the opening transaction
-as the first entry of the new file.  This makes the files self
-contained, so that correct balances are reported no matter which of them
-are loaded.  Ie, if you load just one file, the balances are initialised
-correctly; or if you load several files, the redundant closing/opening
-transactions cancel each other out.  (They will show up in print or
-register reports; you can exclude them with a query like
-'not:desc:'(opening|closing) balances''.)
-
-   If you're running a business, you might also use this command to
-"close the books" at the end of an accounting period, transferring
-income statement account balances to retained earnings.  (You may want
-to change the equity account name to something like "equity:retained
-earnings".)
-
-   By default, the closing transaction is dated yesterday, the balances
-are calculated as of end of yesterday, and the opening transaction is
-dated today.  To close on some other date, use: 'hledger close -e
-OPENINGDATE'.  Eg, to close/open on the 2018/2019 boundary, use '-e
-2019'.  You can also use -p or 'date:PERIOD' (any starting date is
-ignored).
-
-   Both transactions will include balance assertions for the
-closed/reopened accounts.  You probably shouldn't use status or realness
-filters (like -C or -R or 'status:') with this command, or the generated
-balance assertions will depend on these flags.  Likewise, if you run
-this command with -auto, the balance assertions will probably always
-require -auto.
-
-   When account balances have cost information (transaction prices), the
-closing/opening transactions will preserve it, so that eg balance -B
-reports will not be affected.
-
-   Examples:
-
-   Carrying asset/liability balances into a new file for 2019, all from
-command line:
-
-   _Warning: we use '>>' here to append; be careful not to type a single
-'>' which would wipe your journal!_
-
-$ hledger close -f 2018.journal -e 2019 assets liabilities --opening >>2019.journal
-$ hledger close -f 2018.journal -e 2019 assets liabilities --closing >>2018.journal
-
-   Now:
-
-$ hledger bs -f 2019.journal                   # one file - balances are correct
-$ hledger bs -f 2018.journal -f 2019.journal   # two files - balances still correct
-$ hledger bs -f 2018.journal not:desc:closing  # to see year-end balances, must exclude closing txn
-
-   Transactions spanning the closing date can complicate matters,
-breaking balance assertions:
-
-2018/12/30 a purchase made in 2018, clearing the following year
-    expenses:food          5
-    assets:bank:checking  -5  ; [2019/1/2]
-
-   Here's one way to resolve that:
-
-; in 2018.journal:
-2018/12/30 a purchase made in 2018, clearing the following year
-    expenses:food          5
-    liabilities:pending
-
-; in 2019.journal:
-2019/1/2 clearance of last year's pending transactions
-    liabilities:pending    5 = 0
-    assets:checking
-
-
-File: hledger.info,  Node: commodities,  Next: descriptions,  Prev: close,  Up: COMMANDS
-
-4.11 commodities
-================
-
-commodities
-List all commodity/currency symbols used or declared in the journal.
-
-
-File: hledger.info,  Node: descriptions,  Next: diff,  Prev: commodities,  Up: COMMANDS
-
-4.12 descriptions
-=================
-
-descriptions Show descriptions.
-
-   This command lists all descriptions that appear in transactions.
-
-   Examples:
-
-$ hledger descriptions
-Store Name
-Gas Station | Petrol
-Person A
-
-
-File: hledger.info,  Node: diff,  Next: files,  Prev: descriptions,  Up: COMMANDS
-
-4.13 diff
-=========
-
-diff
-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.)
-Since postings not transactions are compared, this also works when
-multiple 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 the account balance, you can compare the bank data with your
-journal to find out the cause.
-
-   Examples:
-
-$ hledger diff -f $LEDGER_FILE -f bank.csv assets:bank:giro 
-These transactions are in the first file only:
-
-2014/01/01 Opening Balances
-    assets:bank:giro              EUR ...
-    ...
-    equity:opening balances       EUR -...
-
-These transactions are in the second file only:
-
-
-File: hledger.info,  Node: files,  Next: help,  Prev: diff,  Up: COMMANDS
-
-4.14 files
-==========
-
-files
-List all files included in the journal.  With a REGEX argument, only
-file names matching the regular expression (case sensitive) are shown.
-
-
-File: hledger.info,  Node: help,  Next: import,  Prev: files,  Up: COMMANDS
-
-4.15 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 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 force a
-particular viewer with the '--info', '--man', '--pager', '--cat' flags.
-
-   Examples:
-
-$ hledger help
-Please choose a manual by typing "hledger help MANUAL" (a substring is ok).
-Manuals: hledger hledger-ui hledger-web journal csv timeclock timedot
-
-$ hledger help h --man
-
-hledger(1)                    hledger User Manuals                    hledger(1)
-
-NAME
-       hledger - a command-line accounting tool
-
-SYNOPSIS
-       hledger [-f FILE] COMMAND [OPTIONS] [ARGS]
-       hledger [-f FILE] ADDONCMD -- [OPTIONS] [ARGS]
-       hledger
-
-DESCRIPTION
-       hledger  is  a  cross-platform  program  for tracking money, time, or any
-...
-
-
-File: hledger.info,  Node: import,  Next: incomestatement,  Prev: help,  Up: COMMANDS
-
-4.16 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 transactions
-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 each one.  So eg to add new transactions from all CSV files to
-the main journal, it's just: 'hledger import *.csv'
-
-   New transactions are detected in the same way as print -new: by
-assuming 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
-see only uncategorised transactions:
-
-$ hledger import --dry ... | hledger -f- print unknown --ignore-assertions
-
-* Menu:
-
-* Importing balance assignments::
-
-
-File: hledger.info,  Node: Importing balance assignments,  Up: import
-
-4.16.1 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
-balance assignments (eg from an institution that provides only balances
-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,
-please test it and send a pull request.)
-
-
-File: hledger.info,  Node: incomestatement,  Next: notes,  Prev: import,  Up: COMMANDS
-
-4.17 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,
-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 simple income statement.  It currently
-assumes that you have top-level accounts named 'income' (or 'revenue')
-and 'expense' (plural forms also allowed.)
-
-$ hledger incomestatement
-Income Statement
-
-Revenues:
-                 $-2  income
-                 $-1    gifts
-                 $-1    salary
---------------------
-                 $-2
-
-Expenses:
-                  $2  expenses
-                  $1    food
-                  $1    supplies
---------------------
-                  $2
-
-Total:
---------------------
-                   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
-absolute values percentages can be displayed with '-%'.
-
-   This command also supports output destination and output format
-selection.
-
-
-File: hledger.info,  Node: notes,  Next: payees,  Prev: incomestatement,  Up: COMMANDS
-
-4.18 notes
-==========
-
-notes Show notes.
-
-   This command lists all notes that appear in transactions.
-
-   Examples:
-
-$ hledger notes
-Petrol
-Snacks
-
-
-File: hledger.info,  Node: payees,  Next: prices,  Prev: notes,  Up: COMMANDS
-
-4.19 payees
-===========
-
-payees Show payee names.
-
-   This command lists all payee names that appear in transactions.
-
-   Examples:
-
-$ hledger payees
-Store Name
-Gas Station
-Person A
-
-
-File: hledger.info,  Node: prices,  Next: print,  Prev: payees,  Up: COMMANDS
-
-4.20 prices
-===========
-
-prices
-Print market price directives from the journal.  With -costs, also print
-synthetic market prices based on transaction prices.  With
--inverted-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.
-
-
-File: hledger.info,  Node: print,  Next: print-unique,  Prev: prices,  Up: COMMANDS
-
-4.21 print
-==========
-
-print, txns, p
-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,
-transactions 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
-directives or inter-transaction comments
-
-$ hledger print
-2008/01/01 income
-    assets:bank:checking            $1
-    income:salary                  $-1
-
-2008/06/01 gift
-    assets:bank:checking            $1
-    income:gifts                   $-1
-
-2008/06/02 save
-    assets:bank:saving              $1
-    assets:bank:checking           $-1
-
-2008/06/03 * eat & shop
-    expenses:food                $1
-    expenses:supplies            $1
-    assets:cash                 $-2
-
-2008/12/31 * pay off
-    liabilities:debts               $1
-    assets:bank:checking           $-1
-
-   Normally, the journal entry's explicit or implicit amount style is
-preserved.  Ie when an amount is omitted in the journal, it will be
-omitted in the output.  You can use the '-x'/'--explicit' flag to make
-all amounts explicit, which can be useful for troubleshooting or for
-making your journal more readable and robust against data entry errors.
-Note, '-x' will cause postings with a multi-commodity amount (these can
-arise when a multi-commodity transaction has an implicit amount) will be
-split into multiple single-commodity postings, for valid journal output.
-
-   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
-transaction: 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
-special 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
-ignoring 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
-increasing dates, and that transactions on the same day do not get
-reordered.  See also the import command.
-
-   This command also supports output destination and output format
-selection.  Here's an example of print's CSV output:
-
-$ hledger print -Ocsv
-"txnidx","date","date2","status","code","description","comment","account","amount","commodity","credit","debit","posting-status","posting-comment"
-"1","2008/01/01","","","","income","","assets:bank:checking","1","$","","1","",""
-"1","2008/01/01","","","","income","","income:salary","-1","$","1","","",""
-"2","2008/06/01","","","","gift","","assets:bank:checking","1","$","","1","",""
-"2","2008/06/01","","","","gift","","income:gifts","-1","$","1","","",""
-"3","2008/06/02","","","","save","","assets:bank:saving","1","$","","1","",""
-"3","2008/06/02","","","","save","","assets:bank:checking","-1","$","1","","",""
-"4","2008/06/03","","*","","eat & shop","","expenses:food","1","$","","1","",""
-"4","2008/06/03","","*","","eat & shop","","expenses:supplies","1","$","","1","",""
-"4","2008/06/03","","*","","eat & shop","","assets:cash","-2","$","2","","",""
-"5","2008/12/31","","*","","pay off","","liabilities:debts","1","$","","1","",""
-"5","2008/12/31","","*","","pay off","","assets:bank:checking","-1","$","1","","",""
-
-   * There is one CSV record per posting, with the parent transaction's
-     fields repeated.
-   * 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 order, etc.)
-   * The amount is separated into "commodity" (the symbol) and "amount"
-     (numeric quantity) fields.
-   * The numeric amount is repeated in either the "credit" or "debit"
-     column, for convenience.  (Those names are not accurate in the
-     accounting sense; it just puts negative amounts under credit and
-     zero or greater amounts under debit.)
-
-
-File: hledger.info,  Node: print-unique,  Next: register,  Prev: print,  Up: COMMANDS
-
-4.22 print-unique
-=================
-
-print-unique
-Print transactions which do not reuse an already-seen description.
-
-   Example:
-
-$ cat unique.journal
-1/1 test
- (acct:one)  1
-2/2 test
- (acct:two)  2
-$ LEDGER_FILE=unique.journal hledger print-unique
-(-f option not supported)
-2015/01/01 test
-    (acct:one)             1
-
-
-File: hledger.info,  Node: register,  Next: register-match,  Prev: print-unique,  Up: COMMANDS
-
-4.23 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:
-
-$ hledger register checking
-2008/01/01 income               assets:bank:checking            $1           $1
-2008/06/01 gift                 assets:bank:checking            $1           $2
-2008/06/02 save                 assets:bank:checking           $-1           $1
-2008/12/31 pay off              assets:bank:checking           $-1            0
-
-   With -date2, it shows and sorts by secondary date instead.
-
-   The '--historical'/'-H' flag adds the balance from any undisplayed
-prior postings to the running total.  This is useful when you want to
-see only recent activity, with a historically accurate running balance:
-
-$ hledger register checking -b 2008/6 --historical
-2008/06/01 gift                 assets:bank:checking            $1           $2
-2008/06/02 save                 assets:bank:checking           $-1           $1
-2008/12/31 pay off              assets:bank:checking           $-1            0
-
-   The '--depth' option limits the amount of sub-account detail
-displayed.
-
-   The '--average'/'-A' flag shows the running average posting amount
-instead of the running total (so, the final number displayed is the
-average for the whole report period).  This flag implies '--empty' (see
-below).  It is affected by '--historical'.  It works best when showing
-just one account and one commodity.
-
-   The '--related'/'-r' flag shows the _other_ postings in the
-transactions of the postings which would normally be shown.
-
-   The '--invert' flag negates all amounts.  For example, it can be used
-on an income account where amounts are normally displayed as negative
-numbers.  It's also useful to show postings on the checking account
-together with the related account:
-
-$ hledger register --related --invert assets:checking
-
-   With a reporting interval, register shows summary postings, one per
-interval, aggregating the postings to each account:
-
-$ hledger register --monthly income
-2008/01                 income:salary                          $-1          $-1
-2008/06                 income:gifts                           $-1          $-2
-
-   Periods with no activity, and summary postings with a zero amount,
-are not shown by default; use the '--empty'/'-E' flag to see them:
-
-$ hledger register --monthly income -E
-2008/01                 income:salary                          $-1          $-1
-2008/02                                                          0          $-1
-2008/03                                                          0          $-1
-2008/04                                                          0          $-1
-2008/05                                                          0          $-1
-2008/06                 income:gifts                           $-1          $-2
-2008/07                                                          0          $-2
-2008/08                                                          0          $-2
-2008/09                                                          0          $-2
-2008/10                                                          0          $-2
-2008/11                                                          0          $-2
-2008/12                                                          0          $-2
-
-   Often, you'll want to see just one line per interval.  The '--depth'
-option helps with this, causing subaccounts to be aggregated:
-
-$ hledger register --monthly assets --depth 1h
-2008/01                 assets                                  $1           $1
-2008/06                 assets                                 $-1            0
-2008/12                 assets                                 $-1          $-1
-
-   Note when using report intervals, if you specify start/end dates
-these will be adjusted outward if necessary to contain a whole number of
-intervals.  This ensures that the first and last intervals are full
-length and comparable to the others in the report.
-
-* Menu:
-
-* Custom register output::
-
-
-File: hledger.info,  Node: Custom register output,  Up: register
-
-4.23.1 Custom register output
------------------------------
-
-register uses the full terminal width by default, except on windows.
-You can override this by setting the 'COLUMNS' environment variable (not
-a bash shell variable) or by using the '--width'/'-w' option.
-
-   The description and account columns normally share the space equally
-(about half of (width - 40) each).  You can adjust this by adding a
-description width as part of -width's argument, comma-separated:
-'--width W,D' .  Here's a diagram (won't display correctly in -help):
-
-<--------------------------------- width (W) ---------------------------------->
-date (10)  description (D)       account (W-41-D)     amount (12)   balance (12)
-DDDDDDDDDD dddddddddddddddddddd  aaaaaaaaaaaaaaaaaaa  AAAAAAAAAAAA  AAAAAAAAAAAA
-
-   and some examples:
-
-$ hledger reg                     # use terminal width (or 80 on windows)
-$ hledger reg -w 100              # use width 100
-$ COLUMNS=100 hledger reg         # set with one-time environment variable
-$ export COLUMNS=100; hledger reg # set till session end (or window resize)
-$ hledger reg -w 100,40           # set overall width 100, description width 40
-$ hledger reg -w $COLUMNS,40      # use terminal width, & description width 40
-
-   This command also supports output destination and output format
-selection.
-
-
-File: hledger.info,  Node: register-match,  Next: rewrite,  Prev: register,  Up: COMMANDS
-
-4.24 register-match
-===================
-
-register-match
-Print the one posting whose transaction description is closest to DESC,
-in the style of the register command.  If there are multiple equally
-good matches, it shows the most recent.  Query options (options, not
-arguments) can be used to restrict the search space.  Helps
-ledger-autosync detect already-seen transactions when importing.
-
-
-File: hledger.info,  Node: rewrite,  Next: roi,  Prev: register-match,  Up: COMMANDS
-
-4.25 rewrite
-============
-
-rewrite
-Print all transactions, rewriting the postings of matched transactions.
-For now the only rewrite available is adding new postings, like print
--auto.
-
-   This is a start at a generic rewriter of transaction entries.  It
-reads the default journal and prints the transactions, like print, but
-adds one or more specified postings to any transactions matching QUERY.
-The posting amounts can be fixed, or a multiplier of the existing
-transaction's first posting amount.
-
-   Examples:
-
-$ hledger-rewrite.hs ^income --add-posting '(liabilities:tax)  *.33  ; income tax' --add-posting '(reserve:gifts)  $100'
-$ hledger-rewrite.hs expenses:gifts --add-posting '(reserve:gifts)  *-1"'
-$ hledger-rewrite.hs -f rewrites.hledger
-
-   rewrites.hledger may consist of entries like:
-
-= ^income amt:<0 date:2017
-  (liabilities:tax)  *0.33  ; tax on income
-  (reserve:grocery)  *0.25  ; reserve 25% for grocery
-  (reserve:)  *0.25  ; reserve 25% for grocery
-
-   Note the single quotes to protect the dollar sign from bash, and the
-two spaces between account and amount.
-
-   More:
-
-$ hledger rewrite -- [QUERY]        --add-posting "ACCT  AMTEXPR" ...
-$ hledger rewrite -- ^income        --add-posting '(liabilities:tax)  *.33'
-$ hledger rewrite -- expenses:gifts --add-posting '(budget:gifts)  *-1"'
-$ hledger rewrite -- ^income        --add-posting '(budget:foreign currency)  *0.25 JPY; diversify'
-
-   Argument for '--add-posting' option is a usual posting of transaction
-with an exception for amount specification.  More precisely, you can use
-''*'' (star symbol) before the amount to indicate that that this is a
-factor for an amount of original matched posting.  If the amount
-includes a commodity name, the new posting amount will be in the new
-commodity; otherwise, it will be in the matched posting amount's
-commodity.
-
-* Menu:
-
-* Re-write rules in a file::
-
-
-File: hledger.info,  Node: Re-write rules in a file,  Up: rewrite
-
-4.25.1 Re-write rules in a file
--------------------------------
-
-During the run this tool will execute so called "Automated Transactions"
-found in any journal it process.  I.e instead of specifying this
-operations in command line you can put them in a journal file.
-
-$ rewrite-rules.journal
-
-   Make contents look like this:
-
-= ^income
-    (liabilities:tax)  *.33
-
-= expenses:gifts
-    budget:gifts  *-1
-    assets:budget  *1
-
-   Note that ''='' (equality symbol) that is used instead of date in
-transactions you usually write.  It indicates the query by which you
-want to match the posting to add new ones.
-
-$ hledger rewrite -- -f input.journal -f rewrite-rules.journal > rewritten-tidy-output.journal
-
-   This is something similar to the commands pipeline:
-
-$ hledger rewrite -- -f input.journal '^income' --add-posting '(liabilities:tax)  *.33' \
-  | hledger rewrite -- -f - expenses:gifts      --add-posting 'budget:gifts  *-1'       \
-                                                --add-posting 'assets:budget  *1'       \
-  > rewritten-tidy-output.journal
-
-   It is important to understand that relative order of such entries in
-journal is important.  You can re-use result of previously added
-postings.
-
-* Menu:
-
-* Diff output format::
-* rewrite vs print --auto::
-
-
-File: hledger.info,  Node: Diff output format,  Next: rewrite vs print --auto,  Up: Re-write rules in a file
-
-4.25.1.1 Diff output format
-...........................
-
-To use this tool for batch modification of your journal files you may
-find useful output in form of unified diff.
-
-$ hledger rewrite -- --diff -f examples/sample.journal '^income' --add-posting '(liabilities:tax)  *.33'
-
-   Output might look like:
-
---- /tmp/examples/sample.journal
-+++ /tmp/examples/sample.journal
-@@ -18,3 +18,4 @@
- 2008/01/01 income
--    assets:bank:checking  $1
-+    assets:bank:checking            $1
-     income:salary
-+    (liabilities:tax)                0
-@@ -22,3 +23,4 @@
- 2008/06/01 gift
--    assets:bank:checking  $1
-+    assets:bank:checking            $1
-     income:gifts
-+    (liabilities:tax)                0
-
-   If you'll pass this through 'patch' tool you'll get transactions
-containing the posting that matches your query be updated.  Note that
-multiple files might be update according to list of input files
-specified via '--file' options and 'include' directives inside of these
-files.
-
-   Be careful.  Whole transaction being re-formatted in a style of
-output from 'hledger print'.
-
-   See also:
-
-   https://github.com/simonmichael/hledger/issues/99
-
-
-File: hledger.info,  Node: rewrite vs print --auto,  Prev: Diff output format,  Up: Re-write rules in a file
-
-4.25.1.2 rewrite vs. print -auto
-................................
-
-This command predates print -auto, and currently does much the same
-thing, but with these differences:
-
-   * with multiple files, rewrite lets rules in any file affect all
-     other files.  print -auto uses standard directive scoping; rules
-     affect only child files.
-
-   * rewrite's query limits which transactions can be rewritten; all are
-     printed.  print -auto's query limits which transactions are
-     printed.
-
-   * rewrite applies rules specified on command line or in the journal.
-     print -auto applies rules specified in the journal.
-
-
-File: hledger.info,  Node: roi,  Next: stats,  Prev: rewrite,  Up: COMMANDS
-
-4.26 roi
-========
-
-roi
-Shows the time-weighted (TWR) and money-weighted (IRR) rate of return on
-your investments.
-
-   This command assumes that you have account(s) that hold nothing but
-your investments and whenever you record current appraisal/valuation of
-these investments you offset unrealized profit and loss into account(s)
-that, again, hold nothing but unrealized profit and loss.
-
-   Any transactions affecting balance of investment account(s) and not
-originating from unrealized profit and loss account(s) are assumed to be
-your investments or withdrawals.
-
-   At a minimum, you need to supply a query (which could be just an
-account name) to select your investments with '--inv', and another query
-to identify your profit and loss transactions with '--pnl'.
-
-   It will compute and display the internalized rate of return (IRR) and
-time-weighted rate of return (TWR) for your investments for the time
-period requested.  Both rates of return are annualized before display,
-regardless of the length of reporting interval.
-
-
-File: hledger.info,  Node: stats,  Next: tags,  Prev: roi,  Up: COMMANDS
-
-4.27 stats
-==========
-
-stats
-Show some journal statistics.
-
-   The stats command displays summary information for the whole journal,
-or a matched part of it.  With a reporting interval, it shows a report
-for each report period.
-
-   Example:
-
-$ hledger stats
-Main journal file        : /src/hledger/examples/sample.journal
-Included journal files   : 
-Transactions span        : 2008-01-01 to 2009-01-01 (366 days)
-Last transaction         : 2008-12-31 (2333 days ago)
-Transactions             : 5 (0.0 per day)
-Transactions last 30 days: 0 (0.0 per day)
-Transactions last 7 days : 0 (0.0 per day)
-Payees/descriptions      : 5
-Accounts                 : 8 (depth 3)
-Commodities              : 1 ($)
-Market prices            : 12 ($)
-
-   This command also supports output destination and output format
-selection.
-
-
-File: hledger.info,  Node: tags,  Next: test,  Prev: stats,  Up: COMMANDS
-
-4.28 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.
-
-
-File: hledger.info,  Node: test,  Prev: tags,  Up: COMMANDS
-
-4.29 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
-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 as
-a bug!
-
-   This command also accepts tasty test runner options, written after a
-- (double hyphen).  Eg to run only the tests in Hledger.Data.Amount,
-with ANSI colour codes disabled:
-
-$ hledger test -- -pData.Amount --color=never
-
-   For help on these, see https://github.com/feuerbach/tasty#options
-('-- --help' currently doesn't show them).
-
-
-File: hledger.info,  Node: ADD-ON COMMANDS,  Prev: COMMANDS,  Up: Top
-
-5 ADD-ON COMMANDS
-*****************
-
-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
-extension (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
-things to be aware of.  Eg if the 'hledger-web' add-on is installed,
-
-   * 'hledger -h web' shows hledger's help, while 'hledger web -h' shows
-     hledger-web's help.
-
-   * 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'.
-
-   * 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
-options, journal parsing, reporting, etc.
-
-   Here are some hledger add-ons available:
-
-* Menu:
-
-* Official add-ons::
-* Third party add-ons::
-* Experimental add-ons::
-
-
-File: hledger.info,  Node: Official add-ons,  Next: Third party add-ons,  Up: ADD-ON COMMANDS
-
-5.1 Official add-ons
-====================
-
-These are maintained and released along with hledger.
-
-* Menu:
-
-* ui::
-* web::
-
-
-File: hledger.info,  Node: ui,  Next: web,  Up: Official add-ons
-
-5.1.1 ui
---------
-
-hledger-ui provides an efficient terminal interface.
-
-
-File: hledger.info,  Node: web,  Prev: ui,  Up: Official add-ons
-
-5.1.2 web
----------
-
-hledger-web provides a simple web interface.
-
-
-File: hledger.info,  Node: Third party add-ons,  Next: Experimental add-ons,  Prev: Official add-ons,  Up: ADD-ON COMMANDS
-
-5.2 Third party add-ons
-=======================
-
-These are maintained separately, and usually updated shortly after a
-hledger release.
-
-* Menu:
-
-* diff::
-* iadd::
-* interest::
-* irr::
-
-5.2.1 diff
-----------
-
-hledger-diff shows differences in an account's transactions between one
-journal file and another.
-
-
-File: hledger.info,  Node: iadd,  Next: interest,  Prev: ,  Up: Third party add-ons
-
-5.2.2 iadd
-----------
-
-hledger-iadd is a more interactive, terminal UI replacement for the add
-command.
-
-
-File: hledger.info,  Node: interest,  Next: irr,  Prev: iadd,  Up: Third party add-ons
-
-5.2.3 interest
---------------
-
-hledger-interest generates interest transactions for an account
-according to various schemes.
-
-
-File: hledger.info,  Node: irr,  Prev: interest,  Up: Third party add-ons
-
-5.2.4 irr
----------
-
-hledger-irr calculates the internal rate of return of an investment
-account, but it's superseded now by the built-in roi command.
-
-
-File: hledger.info,  Node: Experimental add-ons,  Prev: Third party add-ons,  Up: ADD-ON COMMANDS
-
-5.3 Experimental add-ons
-========================
-
-These are available in source form in the hledger repo's bin/ directory.
-They may be less mature and documented than built-in commands.  Reading
-and tweaking these is a good way to start making your own!
-
-* Menu:
-
-* autosync::
-* chart::
-* check::
-
-
-File: hledger.info,  Node: autosync,  Next: chart,  Up: Experimental add-ons
-
-5.3.1 autosync
---------------
-
-hledger-autosync is a symbolic link for easily running ledger-autosync,
-if installed.  ledger-autosync does deduplicating conversion of OFX data
-and some CSV formats, and can also download the data if your bank offers
-OFX Direct Connect.
-
-
-File: hledger.info,  Node: chart,  Next: check,  Prev: autosync,  Up: Experimental add-ons
-
-5.3.2 chart
------------
-
-hledger-chart.hs is an old pie chart generator, in need of some love.
-
-
-File: hledger.info,  Node: check,  Prev: chart,  Up: Experimental add-ons
-
-5.3.3 check
------------
-
-hledger-check.hs checks more powerful account balance assertions.
-
-
-Tag Table:
-Node: Top68
-Node: EXAMPLES1891
-Ref: #examples1991
-Node: OPTIONS3637
-Ref: #options3739
-Node: General options4138
-Ref: #general-options4263
-Node: Command options6917
-Ref: #command-options7068
-Node: Command arguments7466
-Ref: #command-arguments7620
-Node: Argument files7741
-Ref: #argument-files7917
-Node: Special characters in arguments and queries8183
-Ref: #special-characters-in-arguments-and-queries8417
-Node: More escaping8868
-Ref: #more-escaping9030
-Node: Even more escaping9326
-Ref: #even-more-escaping9520
-Node: Less escaping10191
-Ref: #less-escaping10353
-Node: Command line tips10598
-Ref: #command-line-tips10784
-Node: Unicode characters11161
-Ref: #unicode-characters11317
-Node: Input files12729
-Ref: #input-files12865
-Node: Smart dates14794
-Ref: #smart-dates14935
-Node: Report start & end date16341
-Ref: #report-start-end-date16513
-Node: Report intervals17937
-Ref: #report-intervals18102
-Node: Period expressions18492
-Ref: #period-expressions18652
-Node: Depth limiting22607
-Ref: #depth-limiting22751
-Node: Pivoting23093
-Ref: #pivoting23216
-Node: Valuation24892
-Ref: #valuation25021
-Node: -B Cost25201
-Ref: #b-cost25312
-Node: -V Market value25510
-Ref: #v-market-value25684
-Node: -X Market value in specified commodity27116
-Ref: #x-market-value-in-specified-commodity27355
-Node: --value Flexible valuation27531
-Ref: #value-flexible-valuation27757
-Node: Effect of --value on reports31947
-Ref: #effect-of---value-on-reports32163
-Node: Combining -B -V -X --value37094
-Ref: #combining--b--v--x---value37277
-Node: Output destination37313
-Ref: #output-destination37465
-Node: Output format37748
-Ref: #output-format37900
-Node: Regular expressions38285
-Ref: #regular-expressions38422
-Node: QUERIES39783
-Ref: #queries39885
-Node: COMMANDS43847
-Ref: #commands43959
-Node: accounts45023
-Ref: #accounts45121
-Node: activity45820
-Ref: #activity45930
-Node: add46313
-Ref: #add46412
-Node: balance49157
-Ref: #balance49268
-Node: Classic balance report50726
-Ref: #classic-balance-report50899
-Node: Customising the classic balance report52268
-Ref: #customising-the-classic-balance-report52496
-Node: Colour support54572
-Ref: #colour-support54739
-Node: Flat mode54912
-Ref: #flat-mode55060
-Node: Depth limited balance reports55473
-Ref: #depth-limited-balance-reports55658
-Node: Percentages56114
-Ref: #percentages56280
-Node: Multicolumn balance report57417
-Ref: #multicolumn-balance-report57597
-Node: Budget report62911
-Ref: #budget-report63054
-Node: Nested budgets68256
-Ref: #nested-budgets68368
-Ref: #output-format-171848
-Node: balancesheet71926
-Ref: #balancesheet72062
-Node: balancesheetequity73445
-Ref: #balancesheetequity73594
-Node: cashflow74155
-Ref: #cashflow74283
-Node: check-dates75379
-Ref: #check-dates75506
-Node: check-dupes75785
-Ref: #check-dupes75909
-Node: close76202
-Ref: #close76316
-Node: commodities79982
-Ref: #commodities80109
-Node: descriptions80191
-Ref: #descriptions80319
-Node: diff80500
-Ref: #diff80606
-Node: files81653
-Ref: #files81753
-Node: help81900
-Ref: #help82000
-Node: import83081
-Ref: #import83195
-Node: Importing balance assignments84088
-Ref: #importing-balance-assignments84236
-Node: incomestatement84885
-Ref: #incomestatement85018
-Node: notes86422
-Ref: #notes86535
-Node: payees86661
-Ref: #payees86767
-Node: prices86925
-Ref: #prices87031
-Node: print87372
-Ref: #print87482
-Node: print-unique91975
-Ref: #print-unique92101
-Node: register92386
-Ref: #register92513
-Node: Custom register output96685
-Ref: #custom-register-output96814
-Node: register-match98076
-Ref: #register-match98210
-Node: rewrite98561
-Ref: #rewrite98676
-Node: Re-write rules in a file100531
-Ref: #re-write-rules-in-a-file100665
-Node: Diff output format101875
-Ref: #diff-output-format102044
-Node: rewrite vs print --auto103136
-Ref: #rewrite-vs.-print---auto103315
-Node: roi103871
-Ref: #roi103969
-Node: stats104981
-Ref: #stats105080
-Node: tags105868
-Ref: #tags105966
-Node: test106260
-Ref: #test106344
-Node: ADD-ON COMMANDS107091
-Ref: #add-on-commands107201
-Node: Official add-ons108489
-Ref: #official-add-ons108629
-Node: ui108709
-Ref: #ui108796
-Node: web108850
-Ref: #web108939
-Node: Third party add-ons108985
-Ref: #third-party-add-ons109160
-Ref: #diff-1109319
-Node: iadd109418
-Ref: #iadd109528
-Node: interest109610
-Ref: #interest109731
-Node: irr109826
-Ref: #irr109924
-Node: Experimental add-ons110055
-Ref: #experimental-add-ons110207
-Node: autosync110455
-Ref: #autosync110566
-Node: chart110805
-Ref: #chart110924
-Node: check110995
-Ref: #check111097
+File: hledger.info,  Node: Top,  Next: COMMON TASKS,  Up: (dir)
+
+hledger(1) hledger 1.17
+***********************
+
+hledger - a command-line accounting tool
+
+   'hledger [-f FILE] COMMAND [OPTIONS] [ARGS]'
+'hledger [-f FILE] ADDONCMD -- [OPTIONS] [ARGS]'
+'hledger'
+
+   hledger is a reliable, cross-platform set of programs for tracking
+money, time, or any other commodity, using double-entry accounting and a
+simple, editable file format.  hledger is inspired by and largely
+compatible with ledger(1).
+
+   This is hledger's command-line interface (there are also terminal and
+web interfaces).  Its basic function is to read a plain text file
+describing financial transactions (in accounting terms, a general
+journal) and print useful reports on standard output, or export them as
+CSV. hledger can also read some other file formats such as CSV files,
+translating them to journal format.  Additionally, hledger lists other
+hledger-* executables found in the user's $PATH and can invoke them as
+subcommands.
+
+   hledger reads data from one or more files in hledger journal,
+timeclock, timedot, or CSV format specified with '-f', or
+'$LEDGER_FILE', or '$HOME/.hledger.journal' (on windows, perhaps
+'C:/Users/USER/.hledger.journal').  If using '$LEDGER_FILE', note this
+must be a real environment variable, not a shell variable.  You can
+specify standard input with '-f-'.
+
+   Transactions are dated movements of money between two (or more) named
+accounts, and are recorded with journal entries like this:
+
+2015/10/16 bought food
+ expenses:food          $10
+ assets:cash
+
+   For more about this format, see hledger_journal(5).
+
+   Most users use a text editor to edit the journal, usually with an
+editor mode such as ledger-mode for added convenience.  hledger's
+interactive add command is another way to record new transactions.
+hledger never changes existing transactions.
+
+   To get started, you can either save some entries like the above in
+'~/.hledger.journal', or run 'hledger add' and follow the prompts.  Then
+try some commands like 'hledger print' or 'hledger balance'.  Run
+'hledger' with no arguments for a list of commands.
+
+* Menu:
+
+* COMMON TASKS::
+* OPTIONS::
+* COMMANDS::
+* ENVIRONMENT::
+* FILES::
+* LIMITATIONS::
+* TROUBLESHOOTING::
+
+
+File: hledger.info,  Node: COMMON TASKS,  Next: OPTIONS,  Prev: Top,  Up: Top
+
+1 COMMON TASKS
+**************
+
+Here are some quick examples of how to do some basic tasks with hledger.
+For more details, see the reference section below, the
+hledger_journal(5) manual, or the more extensive docs at
+https://hledger.org.
+
+* Menu:
+
+* Getting help::
+* Constructing command lines::
+* Starting a journal file::
+* Setting opening balances::
+* Recording transactions::
+* Reconciling::
+* Reporting::
+* Migrating to a new file::
+
+
+File: hledger.info,  Node: Getting help,  Next: Constructing command lines,  Up: COMMON TASKS
+
+1.1 Getting help
+================
+
+$ hledger                 # show available commands
+$ hledger --help          # show common options
+$ hledger CMD --help      # show common and command options, and command help
+$ hledger help            # show available manuals/topics
+$ hledger help hledger    # show hledger manual as info/man/text (auto-chosen)
+$ hledger help journal --man  # show the journal manual as a man page
+$ hledger help --help     # show more detailed help for the help command
+
+   Find more docs, chat, mail list, reddit, issue tracker:
+https://hledger.org#help-feedback
+
+
+File: hledger.info,  Node: Constructing command lines,  Next: Starting a journal file,  Prev: Getting help,  Up: COMMON TASKS
+
+1.2 Constructing command lines
+==============================
+
+hledger has an extensive and powerful command line interface.  We strive
+to keep it simple and ergonomic, but you may run into one of the
+confusing real world details described in OPTIONS, below.  If that
+happens, here are some tips that may help:
+
+   * command-specific options must go after the command (it's fine to
+     put all options there) ('hledger CMD OPTS ARGS')
+   * running add-on executables directly simplifies command line parsing
+     ('hledger-ui OPTS ARGS')
+   * enclose "problematic" args in single quotes
+   * if needed, also add a backslash to hide regular expression
+     metacharacters from the shell
+   * to see how a misbehaving command is being parsed, add '--debug=2'.
+
+
+File: hledger.info,  Node: Starting a journal file,  Next: Setting opening balances,  Prev: Constructing command lines,  Up: COMMON TASKS
+
+1.3 Starting a journal file
+===========================
+
+hledger looks for your accounting data in a journal file,
+'$HOME/.hledger.journal' by default:
+
+$ hledger stats
+The hledger journal file "/Users/simon/.hledger.journal" was not found.
+Please create it first, eg with "hledger add" or a text editor.
+Or, specify an existing journal file with -f or LEDGER_FILE.
+
+   You can override this by setting the 'LEDGER_FILE' environment
+variable.  It's a good practice to keep this important file under
+version control, and to start a new file each year.  So you could do
+something like this:
+
+$ mkdir ~/finance
+$ cd ~/finance
+$ git init
+Initialized empty Git repository in /Users/simon/finance/.git/
+$ touch 2020.journal
+$ echo "export LEDGER_FILE=$HOME/finance/2020.journal" >> ~/.bashrc
+$ source ~/.bashrc
+$ hledger stats
+Main file                : /Users/simon/finance/2020.journal
+Included files           : 
+Transactions span        :  to  (0 days)
+Last transaction         : none
+Transactions             : 0 (0.0 per day)
+Transactions last 30 days: 0 (0.0 per day)
+Transactions last 7 days : 0 (0.0 per day)
+Payees/descriptions      : 0
+Accounts                 : 0 (depth 0)
+Commodities              : 0 ()
+Market prices            : 0 ()
+
+
+File: hledger.info,  Node: Setting opening balances,  Next: Recording transactions,  Prev: Starting a journal file,  Up: COMMON TASKS
+
+1.4 Setting opening balances
+============================
+
+Pick a starting date for which you can look up the balances of some
+real-world assets (bank accounts, wallet..)  and liabilities (credit
+cards..).
+
+   To avoid a lot of data entry, you may want to start with just one or
+two accounts, like your checking account or cash wallet; and pick a
+recent starting date, like today or the start of the week.  You can
+always come back later and add more accounts and older transactions, eg
+going back to january 1st.
+
+   Add an opening balances transaction to the journal, declaring the
+balances on this date.  Here are two ways to do it:
+
+   * The first way: open the journal in any text editor and save an
+     entry like this:
+
+     2020-01-01 * opening balances
+         assets:bank:checking                $1000   = $1000
+         assets:bank:savings                 $2000   = $2000
+         assets:cash                          $100   = $100
+         liabilities:creditcard               $-50   = $-50
+         equity:opening/closing balances
+
+     These are start-of-day balances, ie whatever was in the account at
+     the end of the previous day.
+
+     The * after the date is an optional status flag.  Here it means
+     "cleared & confirmed".
+
+     The currency symbols are optional, but usually a good idea as
+     you'll be dealing with multiple currencies sooner or later.
+
+     The = amounts are optional balance assertions, providing extra
+     error checking.
+
+   * The second way: run 'hledger add' and follow the prompts to record
+     a similar transaction:
+
+     $ hledger add
+     Adding transactions to journal file /Users/simon/finance/2020.journal
+     Any command line arguments will be used as defaults.
+     Use tab key to complete, readline keys to edit, enter to accept defaults.
+     An optional (CODE) may follow transaction dates.
+     An optional ; COMMENT may follow descriptions or amounts.
+     If you make a mistake, enter < at any prompt to go one step backward.
+     To end a transaction, enter . when prompted.
+     To quit, enter . at a date prompt or press control-d or control-c.
+     Date [2020-02-07]: 2020-01-01
+     Description: * opening balances
+     Account 1: assets:bank:checking
+     Amount  1: $1000
+     Account 2: assets:bank:savings
+     Amount  2 [$-1000]: $2000
+     Account 3: assets:cash
+     Amount  3 [$-3000]: $100
+     Account 4: liabilities:creditcard
+     Amount  4 [$-3100]: $-50
+     Account 5: equity:opening/closing balances
+     Amount  5 [$-3050]: 
+     Account 6 (or . or enter to finish this transaction): .
+     2020-01-01 * opening balances
+         assets:bank:checking                      $1000
+         assets:bank:savings                       $2000
+         assets:cash                                $100
+         liabilities:creditcard                     $-50
+         equity:opening/closing balances          $-3050
+     
+     Save this transaction to the journal ? [y]: 
+     Saved.
+     Starting the next transaction (. or ctrl-D/ctrl-C to quit)
+     Date [2020-01-01]: .
+
+   If you're using version control, this could be a good time to commit
+the journal.  Eg:
+
+$ git commit -m 'initial balances' 2020.journal
+
+
+File: hledger.info,  Node: Recording transactions,  Next: Reconciling,  Prev: Setting opening balances,  Up: COMMON TASKS
+
+1.5 Recording transactions
+==========================
+
+As you spend or receive money, you can record these transactions using
+one of the methods above (text editor, hledger add) or by using the
+hledger-iadd or hledger-web add-ons, or by using the import command to
+convert CSV data downloaded from your bank.
+
+   Here are some simple transactions, see the hledger_journal(5) manual
+and hledger.org for more ideas:
+
+2020/1/10 * gift received
+  assets:cash   $20
+  income:gifts
+
+2020.1.12 * farmers market
+  expenses:food    $13
+  assets:cash
+
+2020-01-15 paycheck
+  income:salary
+  assets:bank:checking    $1000
+
+
+File: hledger.info,  Node: Reconciling,  Next: Reporting,  Prev: Recording transactions,  Up: COMMON TASKS
+
+1.6 Reconciling
+===============
+
+Periodically you should reconcile - compare your hledger-reported
+balances against external sources of truth, like bank statements or your
+bank's website - to be sure that your ledger accurately represents the
+real-world balances (and, that the real-world institutions have not made
+a mistake!).  This gets easy and fast with (1) practice and (2)
+frequency.  If you do it daily, it can take 2-10 minutes.  If you let it
+pile up, expect it to take longer as you hunt down errors and
+discrepancies.
+
+   A typical workflow:
+
+  1. Reconcile cash.  Count what's in your wallet.  Compare with what
+     hledger reports ('hledger bal cash').  If they are different, try
+     to remember the missing transaction, or look for the error in the
+     already-recorded transactions.  A register report can be helpful
+     ('hledger reg cash').  If you can't find the error, add an
+     adjustment transaction.  Eg if you have $105 after the above, and
+     can't explain the missing $2, it could be:
+
+     2020-01-16 * adjust cash
+         assets:cash    $-2 = $105
+         expenses:misc
+
+  2. Reconcile checking.  Log in to your bank's website.  Compare
+     today's (cleared) balance with hledger's cleared balance ('hledger
+     bal checking -C').  If they are different, track down the error or
+     record the missing transaction(s) or add an adjustment transaction,
+     similar to the above.  Unlike the cash case, you can usually
+     compare the transaction history and running balance from your bank
+     with the one reported by 'hledger reg checking -C'.  This will be
+     easier if you generally record transaction dates quite similar to
+     your bank's clearing dates.
+
+  3. Repeat for other asset/liability accounts.
+
+   Tip: instead of the register command, use hledger-ui to see a
+live-updating register while you edit the journal: 'hledger-ui --watch
+--register checking -C'
+
+   After reconciling, it could be a good time to mark the reconciled
+transactions' status as "cleared and confirmed", if you want to track
+that, by adding the '*' marker.  Eg in the paycheck transaction above,
+insert '*' between '2020-01-15' and 'paycheck'
+
+   If you're using version control, this can be another good time to
+commit:
+
+$ git commit -m 'txns' 2020.journal
+
+
+File: hledger.info,  Node: Reporting,  Next: Migrating to a new file,  Prev: Reconciling,  Up: COMMON TASKS
+
+1.7 Reporting
+=============
+
+Here are some basic reports.
+
+   Show all transactions:
+
+$ hledger print
+2020-01-01 * opening balances
+    assets:bank:checking                      $1000
+    assets:bank:savings                       $2000
+    assets:cash                                $100
+    liabilities:creditcard                     $-50
+    equity:opening/closing balances          $-3050
+
+2020-01-10 * gift received
+    assets:cash              $20
+    income:gifts
+
+2020-01-12 * farmers market
+    expenses:food             $13
+    assets:cash
+
+2020-01-15 * paycheck
+    income:salary
+    assets:bank:checking           $1000
+
+2020-01-16 * adjust cash
+    assets:cash               $-2 = $105
+    expenses:misc
+
+   Show account names, and their hierarchy:
+
+$ hledger accounts --tree
+assets
+  bank
+    checking
+    savings
+  cash
+equity
+  opening/closing balances
+expenses
+  food
+  misc
+income
+  gifts
+  salary
+liabilities
+  creditcard
+
+   Show all account totals:
+
+$ hledger balance
+               $4105  assets
+               $4000    bank
+               $2000      checking
+               $2000      savings
+                $105    cash
+              $-3050  equity:opening/closing balances
+                 $15  expenses
+                 $13    food
+                  $2    misc
+              $-1020  income
+                $-20    gifts
+              $-1000    salary
+                $-50  liabilities:creditcard
+--------------------
+                   0
+
+   Show only asset and liability balances, as a flat list, limited to
+depth 2:
+
+$ hledger bal assets liabilities --flat -2
+               $4000  assets:bank
+                $105  assets:cash
+                $-50  liabilities:creditcard
+--------------------
+               $4055
+
+   Show the same thing without negative numbers, formatted as a simple
+balance sheet:
+
+$ hledger bs --flat -2
+Balance Sheet 2020-01-16
+
+                        || 2020-01-16 
+========================++============
+ Assets                 ||            
+------------------------++------------
+ assets:bank            ||      $4000 
+ assets:cash            ||       $105 
+------------------------++------------
+                        ||      $4105 
+========================++============
+ Liabilities            ||            
+------------------------++------------
+ liabilities:creditcard ||        $50 
+------------------------++------------
+                        ||        $50 
+========================++============
+ Net:                   ||      $4055 
+
+   The final total is your "net worth" on the end date.  (Or use 'bse'
+for a full balance sheet with equity.)
+
+   Show income and expense totals, formatted as an income statement:
+
+hledger is 
+Income Statement 2020-01-01-2020-01-16
+
+               || 2020-01-01-2020-01-16 
+===============++=======================
+ Revenues      ||                       
+---------------++-----------------------
+ income:gifts  ||                   $20 
+ income:salary ||                 $1000 
+---------------++-----------------------
+               ||                 $1020 
+===============++=======================
+ Expenses      ||                       
+---------------++-----------------------
+ expenses:food ||                   $13 
+ expenses:misc ||                    $2 
+---------------++-----------------------
+               ||                   $15 
+===============++=======================
+ Net:          ||                 $1005 
+
+   The final total is your net income during this period.
+
+   Show transactions affecting your wallet, with running total:
+
+$ hledger register cash
+2020-01-01 opening balances     assets:cash                   $100          $100
+2020-01-10 gift received        assets:cash                    $20          $120
+2020-01-12 farmers market       assets:cash                   $-13          $107
+2020-01-16 adjust cash          assets:cash                    $-2          $105
+
+   Show weekly posting counts as a bar chart:
+
+$ hledger activity -W
+2019-12-30 *****
+2020-01-06 ****
+2020-01-13 ****
+
+
+File: hledger.info,  Node: Migrating to a new file,  Prev: Reporting,  Up: COMMON TASKS
+
+1.8 Migrating to a new file
+===========================
+
+At the end of the year, you may want to continue your journal in a new
+file, so that old transactions don't slow down or clutter your reports,
+and to help ensure the integrity of your accounting history.  See the
+close command.
+
+   If using version control, don't forget to 'git add' the new file.
+
+
+File: hledger.info,  Node: OPTIONS,  Next: COMMANDS,  Prev: COMMON TASKS,  Up: Top
+
+2 OPTIONS
+*********
+
+* Menu:
+
+* General options::
+* Command options::
+* Command arguments::
+* Queries::
+* Special characters in arguments and queries::
+* Unicode characters::
+* Input files::
+* Output destination::
+* Output format::
+* Regular expressions::
+* Smart dates::
+* Report start & end date::
+* Report intervals::
+* Period expressions::
+* Depth limiting::
+* Pivoting::
+* Valuation::
+
+
+File: hledger.info,  Node: General options,  Next: Command options,  Up: OPTIONS
+
+2.1 General options
+===================
+
+To see general usage help, including general options which are supported
+by most hledger commands, run 'hledger -h'.
+
+   General help options:
+
+'-h --help'
+
+     show general usage (or after COMMAND, command usage)
+'--version'
+
+     show version
+'--debug[=N]'
+
+     show debug output (levels 1-9, default: 1)
+
+   General input options:
+
+'-f FILE --file=FILE'
+
+     use a different input file.  For stdin, use - (default:
+     '$LEDGER_FILE' or '$HOME/.hledger.journal')
+'--rules-file=RULESFILE'
+
+     Conversion rules file to use when reading CSV (default: FILE.rules)
+'--separator=CHAR'
+
+     Field separator to expect when reading CSV (default: ',')
+'--alias=OLD=NEW'
+
+     rename accounts named OLD to NEW
+'--anon'
+
+     anonymize accounts and payees
+'--pivot FIELDNAME'
+
+     use some other field or tag for the account name
+'-I --ignore-assertions'
+
+     disable balance assertion checks (note: does not disable balance
+     assignments)
+
+   General reporting options:
+
+'-b --begin=DATE'
+
+     include postings/txns on or after this date
+'-e --end=DATE'
+
+     include postings/txns before this date
+'-D --daily'
+
+     multiperiod/multicolumn report by day
+'-W --weekly'
+
+     multiperiod/multicolumn report by week
+'-M --monthly'
+
+     multiperiod/multicolumn report by month
+'-Q --quarterly'
+
+     multiperiod/multicolumn report by quarter
+'-Y --yearly'
+
+     multiperiod/multicolumn report by year
+'-p --period=PERIODEXP'
+
+     set start date, end date, and/or reporting interval all at once
+     using period expressions syntax
+'--date2'
+
+     match the secondary date instead (see command help for other
+     effects)
+'-U --unmarked'
+
+     include only unmarked postings/txns (can combine with -P or -C)
+'-P --pending'
+
+     include only pending postings/txns
+'-C --cleared'
+
+     include only cleared postings/txns
+'-R --real'
+
+     include only non-virtual postings
+'-NUM --depth=NUM'
+
+     hide/aggregate accounts or postings more than NUM levels deep
+'-E --empty'
+
+     show items with zero amount, normally hidden (and vice-versa in
+     hledger-ui/hledger-web)
+'-B --cost'
+
+     convert amounts to their cost at transaction time (using the
+     transaction price, if any)
+'-V --value'
+
+     convert amounts to their market value on the report end date (using
+     the most recent applicable market price, if any)
+'--auto'
+
+     apply automated posting rules to modify transactions.
+'--forecast'
+
+     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.
+
+   When a reporting option appears more than once in the command line,
+the last one takes precedence.
+
+   Some reporting options can also be written as query arguments.
+
+
+File: hledger.info,  Node: Command options,  Next: Command arguments,  Prev: General options,  Up: OPTIONS
+
+2.2 Command options
+===================
+
+To see options for a particular command, including command-specific
+options, run: 'hledger COMMAND -h'.
+
+   Command-specific options must be written after the command name, eg:
+'hledger print -x'.
+
+   Additionally, if the command is an addon, you may need to put its
+options after a double-hyphen, eg: 'hledger ui -- --watch'.  Or, you can
+run the addon executable directly: 'hledger-ui --watch'.
+
+
+File: hledger.info,  Node: Command arguments,  Next: Queries,  Prev: Command options,  Up: OPTIONS
+
+2.3 Command arguments
+=====================
+
+Most hledger commands accept arguments after the command name, which are
+often a query, filtering the data in some way.
+
+   You can save a set of command line options/arguments in a file, and
+then reuse them by writing '@FILENAME' as a command line argument.  Eg:
+'hledger bal @foo.args'.  (To prevent this, eg if you have an argument
+that begins with a literal '@', precede it with '--', eg: 'hledger bal
+-- @ARG').
+
+   Inside the argument file, each line should contain just one option or
+argument.  Avoid the use of spaces, except inside quotes (or you'll see
+a confusing error).  Between a flag and its argument, use = (or
+nothing).  Bad:
+
+assets depth:2
+-X USD
+
+   Good:
+
+assets
+depth:2
+-X=USD
+
+   For special characters (see below), use one less level of quoting
+than you would at the command prompt.  Bad:
+
+-X"$"
+
+   Good:
+
+-X$
+
+   See also: Save frequently used options.
+
+
+File: hledger.info,  Node: Queries,  Next: Special characters in arguments and queries,  Prev: Command arguments,  Up: OPTIONS
+
+2.4 Queries
+===========
+
+One of hledger's strengths is being able to quickly report on precise
+subsets of your data.  Most commands accept an optional query
+expression, written as arguments after the command name, to filter the
+data by date, account name or other criteria.  The syntax is similar to
+a web search: one or more space-separated search terms, quotes to
+enclose whitespace, prefixes to match specific fields, a not: prefix to
+negate the match.
+
+   We do not yet support arbitrary boolean combinations of search terms;
+instead most commands show transactions/postings/accounts which match
+(or negatively match):
+
+   * any of the description terms AND
+   * any of the account terms AND
+   * any of the status terms AND
+   * all the other terms.
+
+   The print command instead shows transactions which:
+
+   * match any of the description terms AND
+   * have any postings matching any of the positive account terms AND
+   * have no postings matching any of the negative account terms AND
+   * match all the other terms.
+
+   The following kinds of search terms can be used.  Remember these can
+also be prefixed with *'not:'*, eg to exclude a particular subaccount.
+
+*'REGEX', 'acct:REGEX'*
+
+     match account names by this regular expression.  (With no prefix,
+     'acct:' is assumed.)  same as above
+
+*'amt:N, amt:<N, amt:<=N, amt:>N, amt:>=N'*
+
+     match postings with a single-commodity amount that is equal to,
+     less than, or greater than N. (Multi-commodity amounts are not
+     tested, and will always match.)  The comparison has two modes: if N
+     is preceded by a + or - sign (or is 0), the two signed numbers are
+     compared.  Otherwise, the absolute magnitudes are compared,
+     ignoring sign.
+*'code:REGEX'*
+
+     match by transaction code (eg check number)
+*'cur:REGEX'*
+
+     match postings or transactions including any amounts whose
+     currency/commodity symbol is fully matched by REGEX. (For a partial
+     match, use '.*REGEX.*').  Note, to match characters which are
+     regex-significant, like the dollar sign ('$'), you need to prepend
+     '\'.  And when using the command line you need to add one more
+     level of quoting to hide it from the shell, so eg do: 'hledger
+     print cur:'\$'' or 'hledger print cur:\\$'.
+*'desc:REGEX'*
+
+     match transaction descriptions.
+*'date:PERIODEXPR'*
+
+     match dates within the specified period.  PERIODEXPR is a period
+     expression (with no report interval).  Examples: 'date:2016',
+     'date:thismonth', 'date:2000/2/1-2/15', 'date:lastweek-'.  If the
+     '--date2' command line flag is present, this matches secondary
+     dates instead.
+*'date2:PERIODEXPR'*
+
+     match secondary dates within the specified period.
+*'depth:N'*
+
+     match (or display, depending on command) accounts at or above this
+     depth
+*'note:REGEX'*
+
+     match transaction notes (part of description right of '|', or whole
+     description when there's no '|')
+*'payee:REGEX'*
+
+     match transaction payee/payer names (part of description left of
+     '|', or whole description when there's no '|')
+*'real:, real:0'*
+
+     match real or virtual postings respectively
+*'status:, status:!, status:*'*
+
+     match unmarked, pending, or cleared transactions respectively
+*'tag:REGEX[=REGEX]'*
+
+     match by tag name, and optionally also by tag value.  Note a tag:
+     query is considered to match a transaction if it matches any of the
+     postings.  Also remember that postings inherit the tags of their
+     parent transaction.
+
+   The following special search term is used automatically in
+hledger-web, only:
+
+*'inacct:ACCTNAME'*
+
+     tells hledger-web to show the transaction register for this
+     account.  Can be filtered further with 'acct' etc.
+
+   Some of these can also be expressed as command-line options (eg
+'depth:2' is equivalent to '--depth 2').  Generally you can mix options
+and query arguments, and the resulting query will be their intersection
+(perhaps excluding the '-p/--period' option).
+
+
+File: hledger.info,  Node: Special characters in arguments and queries,  Next: Unicode characters,  Prev: Queries,  Up: OPTIONS
+
+2.5 Special characters in arguments and queries
+===============================================
+
+In shell command lines, option and argument values which contain
+"problematic" characters, ie spaces, and also characters significant to
+your shell such as '<', '>', '(', ')', '|' and '$', should be escaped by
+enclosing them in quotes or by writing backslashes before the
+characters.  Eg:
+
+   'hledger register -p 'last year' "accounts receivable
+(receivable|payable)" amt:\>100'.
+
+* Menu:
+
+* More escaping::
+* Even more escaping::
+* Less escaping::
+
+
+File: hledger.info,  Node: More escaping,  Next: Even more escaping,  Up: Special characters in arguments and queries
+
+2.5.1 More escaping
+-------------------
+
+Characters significant both to the shell and in regular expressions may
+need one extra level of escaping.  These include parentheses, the pipe
+symbol and the dollar sign.  Eg, to match the dollar symbol, bash users
+should do:
+
+   'hledger balance cur:'\$''
+
+   or:
+
+   'hledger balance cur:\\$'
+
+
+File: hledger.info,  Node: Even more escaping,  Next: Less escaping,  Prev: More escaping,  Up: Special characters in arguments and queries
+
+2.5.2 Even more escaping
+------------------------
+
+When hledger runs an addon executable (eg you type 'hledger ui', hledger
+runs 'hledger-ui'), it de-escapes command-line options and arguments
+once, so you might need to _triple_-escape.  Eg in bash, running the ui
+command and matching the dollar sign, it's:
+
+   'hledger ui cur:'\\$''
+
+   or:
+
+   'hledger ui cur:\\\\$'
+
+   If you asked why _four_ slashes above, this may help:
+
+unescaped:        '$'
+escaped:          '\$'
+double-escaped:   '\\$'
+triple-escaped:   '\\\\$'
+
+   (The number of backslashes in fish shell is left as an exercise for
+the reader.)
+
+   You can always avoid the extra escaping for addons by running the
+addon directly:
+
+   'hledger-ui cur:\\$'
+
+
+File: hledger.info,  Node: Less escaping,  Prev: Even more escaping,  Up: Special characters in arguments and queries
+
+2.5.3 Less escaping
+-------------------
+
+Inside an argument file, or in the search field of hledger-ui or
+hledger-web, or at a GHCI prompt, you need one less level of escaping
+than at the command line.  And backslashes may work better than quotes.
+Eg:
+
+   'ghci> :main balance cur:\$'
+
+
+File: hledger.info,  Node: Unicode characters,  Next: Input files,  Prev: Special characters in arguments and queries,  Up: OPTIONS
+
+2.6 Unicode characters
+======================
+
+hledger is expected to handle non-ascii characters correctly:
+
+   * they should be parsed correctly in input files and on the command
+     line, by all hledger tools (add, iadd, hledger-web's
+     search/add/edit forms, etc.)
+
+   * they should be displayed correctly by all hledger tools, and
+     on-screen alignment should be preserved.
+
+   This requires a well-configured environment.  Here are some tips:
+
+   * A system locale must be configured, and it must be one that can
+     decode the characters being used.  In bash, you can set a locale
+     like this: 'export LANG=en_US.UTF-8'.  There are some more details
+     in Troubleshooting.  This step is essential - without it, hledger
+     will quit on encountering a non-ascii character (as with all
+     GHC-compiled programs).
+
+   * your terminal software (eg Terminal.app, iTerm, CMD.exe, xterm..)
+     must support unicode
+
+   * the terminal must be using a font which includes the required
+     unicode glyphs
+
+   * the terminal should be configured to display wide characters as
+     double width (for report alignment)
+
+   * on Windows, for best results you should run hledger in the same
+     kind of environment in which it was built.  Eg hledger built in the
+     standard CMD.EXE environment (like the binaries on our download
+     page) might show display problems when run in a cygwin or msys
+     terminal, and vice versa.  (See eg #961).
+
+
+File: hledger.info,  Node: Input files,  Next: Output destination,  Prev: Unicode characters,  Up: OPTIONS
+
+2.7 Input files
+===============
+
+hledger reads transactions from a data file (and the add command writes
+to it).  By default this file is '$HOME/.hledger.journal' (or on
+Windows, something like 'C:/Users/USER/.hledger.journal').  You can
+override this with the '$LEDGER_FILE' environment variable:
+
+$ setenv LEDGER_FILE ~/finance/2016.journal
+$ hledger stats
+
+   or with the '-f/--file' option:
+
+$ hledger -f /some/file stats
+
+   The file name '-' (hyphen) means standard input:
+
+$ 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:
+
+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)
+
+   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 -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:
+
+   * 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'.
+
+
+File: hledger.info,  Node: Output destination,  Next: Output format,  Prev: Input files,  Up: OPTIONS
+
+2.8 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:
+
+$ hledger print > foo.txt
+
+   Some commands (print, register, stats, the balance commands) also
+provide the '-o/--output-file' option, which does the same thing without
+needing the shell.  Eg:
+
+$ hledger print -o foo.txt
+$ hledger print -o -        # write to stdout (the default)
+
+
+File: hledger.info,  Node: Output format,  Next: Regular expressions,  Prev: Output destination,  Up: OPTIONS
+
+2.9 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:
+
+$ hledger print -O csv
+
+   or, by a file extension specified with '-o/--output-file':
+
+$ hledger balancesheet -o foo.html   # write HTML to foo.html
+
+   The '-O' option can be used to override the file extension if needed:
+
+$ hledger balancesheet -o foo.txt -O html   # write HTML to foo.txt
+
+   Some notes about JSON output:
+
+   * This feature is marked experimental, and not yet much used; you
+     should expect our JSON to evolve.  Real-world feedback is welcome.
+
+   * Our JSON is rather large and verbose, as it is quite a faithful
+     representation of hledger's internal data types.  To understand the
+     JSON, read the Haskell type definitions, which are mostly in
+     https://github.com/simonmichael/hledger/blob/master/hledger-lib/Hledger/Data/Types.hs.
+
+   * The JSON output from hledger commands is essentially the same as
+     the JSON served by hledger-web's JSON API, but pretty printed,
+     using line breaks and indentation.  Our pretty printer has the
+     ability to elide data in certain cases - rendering non-strings as
+     if they were strings, or displaying "FOO.." instead of FOO's full
+     details.  This should never happen in hledger's JSON output; if you
+     see otherwise, please report as a bug.
+
+   * hledger represents quantities as Decimal values storing up to 255
+     significant digits, eg for repeating decimals.  Such numbers can
+     arise in practice (from automatically-calculated transaction
+     prices), and would break most JSON consumers.  So in JSON, we show
+     quantities as simple Numbers with at most 10 decimal places.  We
+     don't limit the number of integer digits, but that part is under
+     your control.  We hope this approach will not cause problems in
+     practice; if you find otherwise, please let us know.  (Cf #1195)
+
+
+File: hledger.info,  Node: Regular expressions,  Next: Smart dates,  Prev: Output format,  Up: OPTIONS
+
+2.10 Regular expressions
+========================
+
+hledger uses regular expressions in a number of places:
+
+   * query terms, on the command line and in the hledger-web search
+     form: 'REGEX', 'desc:REGEX', 'cur:REGEX', 'tag:...=REGEX'
+   * CSV rules conditional blocks: 'if REGEX ...'
+   * account alias directives and options: 'alias /REGEX/ =
+     REPLACEMENT', '--alias /REGEX/=REPLACEMENT'
+
+   hledger's regular expressions come from the regex-tdfa library.  In
+general they:
+
+   * are case insensitive
+   * are infix matching (do not need to match the entire thing being
+     matched)
+   * are POSIX extended regular expressions
+   * also support GNU word boundaries (\<, \>, \b, \B)
+   * and parenthesised capturing groups and numeric backreferences in
+     replacement strings
+   * do not support mode modifiers like (?s)
+
+   Some things to note:
+
+   * In the 'alias' directive and '--alias' option, regular expressions
+     must be enclosed in forward slashes ('/REGEX/').  Elsewhere in
+     hledger, these are not required.
+
+   * 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:\$'.
+
+   * On the command line, some metacharacters like '$' have a special
+     meaning to the shell and so must be escaped at least once more.
+     See Special characters.
+
+
+File: hledger.info,  Node: Smart dates,  Next: Report start & end date,  Prev: Regular expressions,  Up: OPTIONS
+
+2.11 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
+omitted (defaulting to 1).
+
+   Examples:
+
+'2004/10/1',              exact date, several separators allowed.  Year
+'2004-01-01',             is 4+ digits, month is 1-12, day is 1-31
+'2004.9.1'
+'2004'                    start of year
+'2004/10'                 start of month
+'10/1'                    month and day in current year
+'21'                      day in current month
+'october, oct'            start of month in current year
+'yesterday, today,        -1, 0, 1 days from today
+tomorrow'
+'last/this/next           -1, 0, 1 periods from the current period
+day/week/month/quarter/year'
+'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
+results:
+
+'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
+             8-digit year
+'20181232'   8 digits with an invalid day gives an error
+'201801012'  9+ digits beginning with a valid YYYYMMDD gives an error
+
+
+File: hledger.info,  Node: Report start & end date,  Next: Report intervals,  Prev: Smart dates,  Up: OPTIONS
+
+2.12 Report start & end date
+============================
+
+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
+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',
+'-e/--end', '-p/--period' or a 'date:' query (described below).  All of
+these accept the smart date syntax.
+
+   Some notes:
+
+   * As in Ledger, end dates are exclusive, so you need to write the
+     date _after_ the last day you want to include.
+   * As noted in reporting options: among start/end dates specified with
+     _options_, the last (i.e.  right-most) option takes precedence.
+   * 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          begin on St. Patrick's day 2016
+2016/3/17'
+'-e 12/1'    end at the start of december 1st of the current year
+             (11/30 will be the last date included)
+'-b          all transactions on or after the 1st of the current month
+thismonth'
+'-p          all transactions in the current month
+thismonth'
+'date:2016/3/17-'the above written as queries instead
+'date:-12/1'
+'date:thismonth-'
+'date:thismonth'
+
+
+File: hledger.info,  Node: Report intervals,  Next: Period expressions,  Prev: Report start & end date,  Up: OPTIONS
+
+2.13 Report intervals
+=====================
+
+A report interval can be specified so that commands like register,
+balance 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
+complex intervals may be specified with a period expression.  Report
+intervals can not be specified with a query.
+
+
+File: hledger.info,  Node: Period expressions,  Next: Depth limiting,  Prev: Report intervals,  Up: OPTIONS
+
+2.14 Period expressions
+=======================
+
+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 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
+"-".  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
+also be written as:
+
+'-p "1/1 4/1"'
+'-p "january-apr"'
+'-p "this year to 4/1"'
+
+   If you specify only one date, the missing start or end date will be
+the earliest or latest transaction in your journal:
+
+'-p "from 2009/1/1"'   everything after january 1, 2009
+'-p "from 2009/1"'     the same
+'-p "from 2009"'       the same
+'-p "to 2009"'         everything before january 1, 2009
+
+   A single date with no "from" or "to" defines both the start and end
+date like so:
+
+'-p "2009"'       the year 2009; equivalent to “2009/1/1 to 2010/1/1”
+'-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”
+
+   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
+'-D','-W','-M','-Q', or '-Y' flags.  Between report interval and
+start/end dates (if any), the word 'in' is optional.  Examples:
+
+'-p "weekly from 2009/1/1 to 2009/4/1"'
+'-p "monthly in 2008"'
+'-p "quarterly"'
+
+   Note that 'weekly', 'monthly', 'quarterly' and 'yearly' intervals
+will always start on the first day on week, month, quarter or year
+accordingly, and will end on the last day of same period, even if
+associated period expression specifies different explicit start and end
+date.
+
+   For example:
+
+'-p "weekly from           starts on 2008/12/29, closest preceding
+2009/1/1 to 2009/4/1"'     Monday
+'-p "monthly in            starts on 2018/11/01
+2008/11/25"'
+'-p "quarterly from        starts on 2009/04/01, ends on 2009/06/30,
+2009-05-05 to              which are first and last days of Q2 2009
+2009-06-01"'
+'-p "yearly from           starts on 2009/01/01, first day of 2009
+2009-12-29"'
+
+   The following more complex report intervals are also supported:
+'biweekly', '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
+end on the last one, as described above.
+
+   Examples:
+
+'-p "bimonthly from        periods will have boundaries on 2008/01/01,
+2008"'                     2008/03/01, ...
+'-p "every 2 weeks"'       starts on closest preceding Monday
+'-p "every 5 month from    periods will have boundaries on 2009/03/01,
+2009/03"'                  2009/08/01, ...
+
+   If you want intervals that start on arbitrary day of your choosing
+and span a week, month or year, you need to use any of the following:
+
+   'every Nth day of week', 'every <weekday>', 'every Nth day [of
+month]', 'every Nth weekday [of month]', 'every MM/DD [of year]', 'every
+Nth MMM [of year]', 'every MMM Nth [of year]'.
+
+   Examples:
+
+'-p "every 2nd day of    periods will go from Tue to Tue
+week"'
+'-p "every Tue"'         same
+'-p "every 15th day"'    period boundaries will be on 15th of each
+                         month
+'-p "every 2nd           period boundaries will be on second Monday of
+Monday"'                 each month
+'-p "every 11/05"'       yearly periods with boundaries on 5th of Nov
+'-p "every 5th Nov"'     same
+'-p "every Nov 5th"'     same
+
+   Show historical balances at end of 15th each month (N is exclusive
+end date):
+
+   'hledger balance -H -p "every 16th day"'
+
+   Group postings from start of wednesday to end of next tuesday (N is
+start date and exclusive end date):
+
+   'hledger register checking -p "every 3rd day of week"'
+
+
+File: hledger.info,  Node: Depth limiting,  Next: Pivoting,  Prev: Period expressions,  Up: OPTIONS
+
+2.15 Depth limiting
+===================
+
+With the '--depth N' option (short form: '-N'), commands like account,
+balance and register will show only the uppermost accounts in the
+account tree, down to level N. Use this when you want a summary with
+less detail.  This flag has the same effect as a 'depth:' query argument
+(so '-2', '--depth=2' or 'depth:2' are basically equivalent).
+
+
+File: hledger.info,  Node: Pivoting,  Next: Valuation,  Prev: Depth limiting,  Up: OPTIONS
+
+2.16 Pivoting
+=============
+
+Normally hledger sums amounts, and organizes them in a hierarchy, based
+on account name.  The '--pivot FIELD' option causes it to sum and
+organize hierarchy based on the value of some other field instead.
+FIELD can be: 'code', 'description', 'payee', 'note', or the full name
+(case insensitive) of any tag.  As with account names, values containing
+'colon:separated:parts' will be displayed hierarchically in reports.
+
+   '--pivot' is a general option affecting all reports; you can think of
+hledger transforming the journal before any other processing, replacing
+every posting's account name with the value of the specified field on
+that posting, inheriting it from the transaction or using a blank value
+if it's not present.
+
+   An example:
+
+2016/02/16 Member Fee Payment
+    assets:bank account                    2 EUR
+    income:member fees                    -2 EUR  ; member: John Doe
+
+   Normal balance report showing account names:
+
+$ hledger balance
+               2 EUR  assets:bank account
+              -2 EUR  income:member fees
+--------------------
+                   0
+
+   Pivoted balance report, using member: tag values instead:
+
+$ hledger balance --pivot member
+               2 EUR
+              -2 EUR  John Doe
+--------------------
+                   0
+
+   One way to show only amounts with a member: value (using a query,
+described below):
+
+$ hledger balance --pivot member tag:member=.
+              -2 EUR  John Doe
+--------------------
+              -2 EUR
+
+   Another way (the acct: query matches against the pivoted "account
+name"):
+
+$ hledger balance --pivot member acct:.
+              -2 EUR  John Doe
+--------------------
+              -2 EUR
+
+
+File: hledger.info,  Node: Valuation,  Prev: Pivoting,  Up: OPTIONS
+
+2.17 Valuation
+==============
+
+* Menu:
+
+* -B Cost::
+* -V Market value::
+* -X Market value in specified commodity::
+* --value Flexible valuation::
+* Effect of --value on reports::
+* Combining -B -V -X --value::
+
+
+File: hledger.info,  Node: -B Cost,  Next: -V Market value,  Up: Valuation
+
+2.17.1 -B: Cost
+---------------
+
+The '-B/--cost' flag converts amounts to their cost (or selling price)
+at transaction time, if they have a transaction price specified.  This
+flag is equivalent to '--value=cost', described below.
+
+
+File: hledger.info,  Node: -V Market value,  Next: -X Market value in specified commodity,  Prev: -B Cost,  Up: Valuation
+
+2.17.2 -V: Market value
+-----------------------
+
+The '-V/--market' flag converts reported amounts to their market value
+in a default valuation commodity, using the market prices in effect on a
+default valuation date.  For single period reports, the valuation date
+is today (equivalent to '--value=now'); for multiperiod reports, it is
+the last day of each subperiod (equivalent to '--value=end').
+
+   The default valuation commodity is the one referenced in the latest
+applicable market price dated on or before the valuation date.  If most
+of your P declarations lead to a single home currency, this will usually
+be what you want.  (To specify the commodity, see -X below.)
+
+   Note that in hledger, market prices are always declared explicitly
+with P directives; we do not infer them from transaction prices as
+Ledger does.
+
+   Here's a quick example of -V:
+
+; one euro is worth this many dollars from nov 1
+P 2016/11/01 € $1.10
+
+; purchase some euros on nov 3
+2016/11/3
+    assets:euros        €100
+    assets:checking
+
+; the euro is worth fewer dollars by dec 21
+P 2016/12/21 € $1.03
+
+   How many euros do I have ?
+
+$ hledger -f t.j bal -N euros
+                €100  assets:euros
+
+   What are they worth at end of nov 3 ?
+
+$ hledger -f t.j bal -N euros -V -e 2016/11/4
+             $110.00  assets:euros
+
+   What are they worth after 2016/12/21 ?  (no report end date
+specified, defaults to today)
+
+$ hledger -f t.j bal -N euros -V
+             $103.00  assets:euros
+
+
+File: hledger.info,  Node: -X Market value in specified commodity,  Next: --value Flexible valuation,  Prev: -V Market value,  Up: Valuation
+
+2.17.3 -X: Market value in specified commodity
+----------------------------------------------
+
+The '-X/--exchange' option is like '-V', except it specifies the target
+commodity you would like to convert to.  It is equivalent to
+'--value=now,COMM' or '--value=end,COMM'.
+
+
+File: hledger.info,  Node: --value Flexible valuation,  Next: Effect of --value on reports,  Prev: -X Market value in specified commodity,  Up: Valuation
+
+2.17.4 -value: Flexible valuation
+---------------------------------
+
+_(experimental, added 201905)_
+
+   '-B', '-V' and '-X' are special cases of the more general '--value'
+option:
+
+ --value=TYPE[,COMM]  TYPE is cost, then, end, now or YYYY-MM-DD.
+                      COMM is an optional commodity symbol.
+                      Shows amounts converted to:
+                      - cost commodity using transaction prices (then optionally to COMM using market prices at period end(s))
+                      - default valuation commodity (or COMM) using market prices at posting dates
+                      - default valuation commodity (or COMM) using market prices at period end(s)
+                      - default valuation commodity (or COMM) using current market prices
+                      - default valuation commodity (or COMM) using market prices at some date
+
+   The TYPE part basically selects either "cost", or "market value" plus
+a valuation date:
+
+'--value=cost'
+
+     Convert amounts to cost, using the prices recorded in transactions.
+'--value=then'
+
+     Convert amounts to their value in a default valuation commodity,
+     using market prices on each posting's date.  This is currently
+     supported only by the print and register commands.
+'--value=end'
+
+     Convert amounts to their value in a default valuation commodity,
+     using market prices on the last day of the report period (or if
+     unspecified, the journal's end date); or in multiperiod reports,
+     market prices on the last day of each subperiod.
+'--value=now'
+
+     Convert amounts to their value in default valuation commodity using
+     current market prices (as of when report is generated).
+'--value=YYYY-MM-DD'
+
+     Convert amounts to their value in default valuation commodity using
+     market prices on this date.
+
+   The default valuation commodity is the commodity mentioned in the
+most recent applicable market price declaration.  When all your price
+declarations lead to a single home currency, this will usually do what
+you want.
+
+   To select a different valuation commodity, add the optional ',COMM'
+part: a comma, then the target commodity's symbol.  Eg:
+*'--value=now,EUR'*.  hledger will do its best to convert amounts to
+this commodity, using:
+
+   * declared prices (from source commodity to valuation commodity)
+   * reverse prices (declared prices from valuation to source commodity,
+     inverted)
+   * indirect prices (prices calculated from the shortest chain of
+     declared or reverse prices from source to valuation commodity)
+
+   in that order.
+
+   Here are some examples showing the effect of '--value' as seen with
+'print':
+
+P 2000-01-01 A  1 B
+P 2000-02-01 A  2 B
+P 2000-03-01 A  3 B
+P 2000-04-01 A  4 B
+
+2000-01-01
+  (a)      1 A @ 5 B
+
+2000-02-01
+  (a)      1 A @ 6 B
+
+2000-03-01
+  (a)      1 A @ 7 B
+
+   Show the cost of each posting:
+
+$ hledger -f- print --value=cost
+2000-01-01
+    (a)             5 B
+
+2000-02-01
+    (a)             6 B
+
+2000-03-01
+    (a)             7 B
+
+   Show the value as of the last day of the report period (2000-02-29):
+
+$ hledger -f- print --value=end date:2000/01-2000/03
+2000-01-01
+    (a)             2 B
+
+2000-02-01
+    (a)             2 B
+
+   With no report period specified, that shows the value as of the last
+day of the journal (2000-03-01):
+
+$ hledger -f- print --value=end
+2000-01-01
+    (a)             3 B
+
+2000-02-01
+    (a)             3 B
+
+2000-03-01
+    (a)             3 B
+
+   Show the current value (the 2000-04-01 price is still in effect
+today):
+
+$ hledger -f- print --value=now
+2000-01-01
+    (a)             4 B
+
+2000-02-01
+    (a)             4 B
+
+2000-03-01
+    (a)             4 B
+
+   Show the value on 2000/01/15:
+
+$ hledger -f- print --value=2000-01-15
+2000-01-01
+    (a)             1 B
+
+2000-02-01
+    (a)             1 B
+
+2000-03-01
+    (a)             1 B
+
+   You may need to explicitly set a commodity's display style, when
+reverse prices are used.  Eg this output might be surprising:
+
+P 2000-01-01 A 2B
+
+2000-01-01
+  a  1B
+  b
+
+$ hledger print -x -X A
+2000-01-01
+    a               0
+    b               0
+
+   Explanation: because there's no amount or commodity directive
+specifying a display style for A, 0.5A gets the default style, which
+shows no decimal digits.  Because the displayed amount looks like zero,
+the commodity symbol and minus sign are not displayed either.  Adding a
+commodity directive sets a more useful display style for A:
+
+P 2000-01-01 A 2B
+commodity 0.00A
+
+2000-01-01
+  a  1B
+  b
+
+$ hledger print -X A
+2000-01-01
+    a           0.50A
+    b          -0.50A
+
+
+File: hledger.info,  Node: Effect of --value on reports,  Next: Combining -B -V -X --value,  Prev: --value Flexible valuation,  Up: Valuation
+
+2.17.5 Effect of -value on reports
+----------------------------------
+
+Here is a reference for how '--value' currently affects each part of
+hledger's reports.  It's work in progress, but may be useful for
+troubleshooting or reporting bugs.  See also the definitions and notes
+below.  If you find problems, please report them, ideally with a
+reproducible example.  Related: #329, #1083.
+
+Report       '-B',        '-V', '-X'   '--value=then' '--value=end' '--value=DATE',
+type         '--value=cost'                                         '--value=now'
+-------------------------------------------------------------------------------
+*print*
+posting      cost         value at     value at       value at      value at
+amounts                   report end   posting date   report or     DATE/today
+                          or today                    journal end
+balance      unchanged    unchanged    unchanged      unchanged     unchanged
+assertions
+/
+assignments
+*register*
+starting     cost         value at     not            value at      value at
+balance                   day before   supported      day before    DATE/today
+(with -H)                 report or                   report or
+                          journal                     journal
+                          start                       start
+posting      cost         value at     value at       value at      value at
+amounts                   report end   posting date   report or     DATE/today
+(no report                or today                    journal end
+interval)
+summary      summarised   value at     sum of         value at      value at
+posting      cost         period       postings in    period ends   DATE/today
+amounts                   ends         interval,
+(with                                  valued at
+report                                 interval
+interval)                              start
+running      sum/average  sum/average  sum/average    sum/average   sum/average
+total/averageof           of           of displayed   of            of
+             displayed    displayed    values         displayed     displayed
+             values       values                      values        values
+*balance
+(bs, bse,
+cf, is..)*
+balances     sums of      value at     not            value at      value at
+(no report   costs        report end   supported      report or     DATE/today
+interval)                 or today                    journal end   of sums
+                          of sums of                  of sums of    of
+                          postings                    postings      postings
+balances     sums of      value at     not            value at      value at
+(with        costs        period       supported      period ends   DATE/today
+report                    ends of                     of sums of    of sums
+interval)                 sums of                     postings      of
+                          postings                                  postings
+starting     sums of      sums of      not            sums of       sums of
+balances     costs of     postings     supported      postings      postings
+(with        postings     before                      before        before
+report       before       report                      report        report
+interval     report       start                       start         start
+and -H)      start
+budget       like         like         not            like          like
+amounts      balances     balances     supported      balances      balances
+with
+-budget
+grand        sum of       sum of       not            sum of        sum of
+total (no    displayed    displayed    supported      displayed     displayed
+report       values       values                      values        values
+interval)
+row          sums/averagessums/averagesnot            sums/averages sums/averages
+totals/averagesof         of           supported      of            of
+(with        displayed    displayed                   displayed     displayed
+report       values       values                      values        values
+interval)
+column       sums of      sums of      not            sums of       sums of
+totals       displayed    displayed    supported      displayed     displayed
+             values       values                      values        values
+grand        sum/average  sum/average  not            sum/average   sum/average
+total/averageof column    of column    supported      of column     of
+             totals       totals                      totals        column
+                                                                    totals
+
+   *Additional notes*
+
+_cost_
+
+     calculated using price(s) recorded in the transaction(s).
+_value_
+
+     market value using available market price declarations, or the
+     unchanged amount if no conversion rate can be found.
+_report start_
+
+     the first day of the report period specified with -b or -p or
+     date:, otherwise today.
+_report or journal start_
+
+     the first day of the report period specified with -b or -p or
+     date:, otherwise the earliest transaction date in the journal,
+     otherwise today.
+_report end_
+
+     the last day of the report period specified with -e or -p or date:,
+     otherwise today.
+_report or journal end_
+
+     the last day of the report period specified with -e or -p or date:,
+     otherwise the latest transaction date in the journal, otherwise
+     today.
+_report interval_
+
+     a flag (-D/-W/-M/-Q/-Y) or period expression that activates the
+     report's multi-period mode (whether showing one or many
+     subperiods).
+
+
+File: hledger.info,  Node: Combining -B -V -X --value,  Prev: Effect of --value on reports,  Up: Valuation
+
+2.17.6 Combining -B, -V, -X, -value
+-----------------------------------
+
+The rightmost of these flags wins.
+
+
+File: hledger.info,  Node: COMMANDS,  Next: ENVIRONMENT,  Prev: OPTIONS,  Up: Top
+
+3 COMMANDS
+**********
+
+hledger provides a number of subcommands; 'hledger' with no arguments
+shows a list.
+
+   If you install additional 'hledger-*' packages, or if you put
+programs or scripts named 'hledger-NAME' in your PATH, these will also
+be listed as subcommands.
+
+   Run a subcommand by writing its name as first argument (eg 'hledger
+incomestatement').  You can also write one of the standard short aliases
+displayed in parentheses in the command list ('hledger b'), or any any
+unambiguous prefix of a command name ('hledger inc').
+
+   Here are all the builtin commands in alphabetical order.  See also
+'hledger' for a more organised command list, and 'hledger CMD -h' for
+detailed command help.
+
+* Menu:
+
+* accounts::
+* activity::
+* add::
+* balance::
+* balancesheet::
+* balancesheetequity::
+* cashflow::
+* check-dates::
+* check-dupes::
+* close::
+* commodities::
+* descriptions::
+* diff::
+* files::
+* help::
+* import::
+* incomestatement::
+* notes::
+* payees::
+* prices::
+* print::
+* print-unique::
+* register::
+* register-match::
+* rewrite::
+* roi::
+* stats::
+* tags::
+* test::
+* Add-on Commands::
+
+
+File: hledger.info,  Node: accounts,  Next: activity,  Up: COMMANDS
+
+3.1 accounts
+============
+
+accounts, a
+Show account names.
+
+   This command lists account names, either declared with account
+directives (-declared), posted to (-used), or both (the default).  With
+query arguments, only matched account names and account names referenced
+by matched postings are shown.  It shows a flat list by default.  With
+'--tree', it uses indentation to show the account hierarchy.  In flat
+mode you can add '--drop N' to omit the first few account name
+components.  Account names can be depth-clipped with 'depth:N' or
+'--depth N' or '-N'.
+
+   Examples:
+
+$ hledger accounts
+assets:bank:checking
+assets:bank:saving
+assets:cash
+expenses:food
+expenses:supplies
+income:gifts
+income:salary
+liabilities:debts
+
+
+File: hledger.info,  Node: activity,  Next: add,  Prev: accounts,  Up: COMMANDS
+
+3.2 activity
+============
+
+activity
+Show an ascii barchart of posting counts per interval.
+
+   The activity command displays an ascii histogram showing transaction
+counts by day, week, month or other reporting interval (by day is the
+default).  With query arguments, it counts only matched transactions.
+
+   Examples:
+
+$ hledger activity --quarterly
+2008-01-01 **
+2008-04-01 *******
+2008-07-01 
+2008-10-01 **
+
+
+File: hledger.info,  Node: add,  Next: balance,  Prev: activity,  Up: COMMANDS
+
+3.3 add
+=======
+
+add
+Prompt for transactions and add them to the journal.
+
+   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
+transactions, 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.
+
+   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 control-d or control-c to exit.
+
+   Features:
+
+   * add tries to provide useful defaults, using the most similar (by
+     description) recent transaction (filtered by the query, if any) as
+     a template.
+   * You can also set the initial defaults with command line arguments.
+   * Readline-style edit keys can be used during data entry.
+   * The tab key will auto-complete whenever possible - accounts,
+     descriptions, dates ('yesterday', 'today', 'tomorrow').  If the
+     input area is empty, it will insert the default value.
+   * If the journal defines a default commodity, it will be added to any
+     bare numbers entered.
+   * A parenthesised transaction code may be entered following a date.
+   * Comments and tags may be entered following a description or amount.
+   * If you make a mistake, enter '<' at any prompt to go one step
+     backward.
+   * Input prompts are displayed in a different colour when the terminal
+     supports it.
+
+   Example (see the tutorial for a detailed explanation):
+
+$ hledger add
+Adding transactions to journal file /src/hledger/examples/sample.journal
+Any command line arguments will be used as defaults.
+Use tab key to complete, readline keys to edit, enter to accept defaults.
+An optional (CODE) may follow transaction dates.
+An optional ; COMMENT may follow descriptions or amounts.
+If you make a mistake, enter < at any prompt to go one step backward.
+To end a transaction, enter . when prompted.
+To quit, enter . at a date prompt or press control-d or control-c.
+Date [2015/05/22]: 
+Description: supermarket
+Account 1: expenses:food
+Amount  1: $10
+Account 2: assets:checking
+Amount  2 [$-10.0]: 
+Account 3 (or . or enter to finish this transaction): .
+2015/05/22 supermarket
+    expenses:food             $10
+    assets:checking        $-10.0
+
+Save this transaction to the journal ? [y]: 
+Saved.
+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 platform
+(cf #1056).
+
+
+File: hledger.info,  Node: balance,  Next: balancesheet,  Prev: add,  Up: COMMANDS
+
+3.4 balance
+===========
+
+balance, bal, b
+Show accounts and their balances.
+
+   The balance command is hledger's most versatile command.  Note,
+despite the name, it is not always used for showing real-world account
+balances; the more accounting-aware balancesheet and incomestatement may
+be more convenient for that.
+
+   By default, it displays all accounts, and each account's change in
+balance during the entire period of the journal.  Balance changes are
+calculated by adding up the postings in each account.  You can limit the
+postings matched, by a query, to see fewer accounts, changes over a
+different time period, changes from only cleared transactions, etc.
+
+   If you include an account's complete history of postings in the
+report, the balance change is equivalent to the account's current ending
+balance.  For a real-world account, typically you won't have all
+transactions in the journal; instead you'll have all transactions after
+a certain date, and an "opening balances" transaction setting the
+correct starting balance on that date.  Then the balance command will
+show real-world account balances.  In some cases the -H/-historical flag
+is used to ensure this (more below).
+
+   The balance command can produce several styles of report:
+
+* Menu:
+
+* Classic balance report::
+* Customising the classic balance report::
+* Colour support::
+* Flat mode::
+* Depth limited balance reports::
+* Percentages::
+* Multicolumn balance report::
+* Budget report::
+* Output format::
+
+
+File: hledger.info,  Node: Classic balance report,  Next: Customising the classic balance report,  Up: balance
+
+3.4.1 Classic balance report
+----------------------------
+
+This is the original balance report, as found in Ledger.  It usually
+looks like this:
+
+$ hledger balance
+                 $-1  assets
+                  $1    bank:saving
+                 $-2    cash
+                  $2  expenses
+                  $1    food
+                  $1    supplies
+                 $-2  income
+                 $-1    gifts
+                 $-1    salary
+                  $1  liabilities:debts
+--------------------
+                   0
+
+   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.
+
+   "Boring" accounts, which contain a single interesting subaccount and
+no balance of their own, are elided into the following line for more
+compact output.  (Eg above, the "liabilities" account.)  Use
+'--no-elide' to prevent this.
+
+   Account balances are "inclusive" - they include the balances of any
+subaccounts.
+
+   Accounts which have zero balance (and no non-zero subaccounts) are
+omitted.  Use '-E/--empty' to show them.
+
+   A final total is displayed by default; use '-N/--no-total' to
+suppress it, eg:
+
+$ hledger balance -p 2008/6 expenses --no-total
+                  $2  expenses
+                  $1    food
+                  $1    supplies
+
+
+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
+--------------------------------------------
+
+You can customise the layout of classic balance reports with '--format
+FMT':
+
+$ hledger balance --format "%20(account) %12(total)"
+              assets          $-1
+         bank:saving           $1
+                cash          $-2
+            expenses           $2
+                food           $1
+            supplies           $1
+              income          $-2
+               gifts          $-1
+              salary          $-1
+   liabilities:debts           $1
+---------------------------------
+                                0
+
+   The FMT format string (plus a newline) specifies the formatting
+applied to each account/balance pair.  It may contain any suitable text,
+with data fields interpolated like so:
+
+   '%[MIN][.MAX](FIELDNAME)'
+
+   * MIN pads with spaces to at least this width (optional)
+
+   * MAX truncates at this width (optional)
+
+   * FIELDNAME must be enclosed in parentheses, and can be one of:
+
+        * 'depth_spacer' - a number of spaces equal to the account's
+          depth, or if MIN is specified, MIN * depth spaces.
+        * 'account' - the account's name
+        * 'total' - the account's balance/posted total, right justified
+
+   Also, FMT can begin with an optional prefix to control how
+multi-commodity amounts are rendered:
+
+   * '%_' - render on multiple lines, bottom-aligned (the default)
+   * '%^' - render on multiple lines, top-aligned
+   * '%,' - render on one line, comma-separated
+
+   There are some quirks.  Eg in one-line mode, '%(depth_spacer)' has no
+effect, instead '%(account)' has indentation built in.  Experimentation
+may be needed to get pleasing results.
+
+   Some example formats:
+
+   * '%(total)' - the account's total
+   * '%-20.20(account)' - the account's name, left justified, padded to
+     20 characters and clipped at 20 characters
+   * '%,%-50(account) %25(total)' - account name padded to 50
+     characters, total padded to 20 characters, with multiple
+     commodities rendered on one line
+   * '%20(total) %2(depth_spacer)%-(account)' - the default format for
+     the single-column balance report
+
+
+File: hledger.info,  Node: Colour support,  Next: Flat mode,  Prev: Customising the classic balance report,  Up: balance
+
+3.4.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
+
+
+File: hledger.info,  Node: Flat mode,  Next: Depth limited balance reports,  Prev: Colour support,  Up: balance
+
+3.4.4 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
+this mode, you can also use '--drop N' to omit the first few account
+name components.
+
+$ hledger balance -p 2008/6 expenses -N --flat --drop 1
+                  $1  food
+                  $1  supplies
+
+
+File: hledger.info,  Node: Depth limited balance reports,  Next: Percentages,  Prev: Flat mode,  Up: balance
+
+3.4.5 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 a complex set of accounts and get an overview.
+
+$ hledger balance -N -1
+                 $-1  assets
+                  $2  expenses
+                 $-2  income
+                  $1  liabilities
+
+   Flat-mode balance reports, which normally show exclusive balances,
+show inclusive balances at the depth limit.
+
+
+File: hledger.info,  Node: Percentages,  Next: Multicolumn balance report,  Prev: Depth limited balance reports,  Up: balance
+
+3.4.6 Percentages
+-----------------
+
+With '-%' or '--percent', balance reports show each account's value
+expressed 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 -%
+             100.0 %  expenses
+              50.0 %    food
+              50.0 %    supplies
+--------------------
+             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
+relative 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 (eg
+'hledger balance -B') all percentage values will be zero.
+
+   This flag does not work if the report contains any mixed commodity
+accounts.  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.
+
+
+File: hledger.info,  Node: Multicolumn balance report,  Next: Budget report,  Prev: Percentages,  Up: balance
+
+3.4.7 Multicolumn balance report
+--------------------------------
+
+Multicolumn or tabular balance reports are a very useful hledger
+feature, and usually the preferred style.  They share many of the above
+features, but they show the report as a table, with columns representing
+time periods.  This mode is activated by providing a reporting interval.
+
+   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 for a monthly income statement:
+
+     $ hledger balance --quarterly income expenses -E
+     Balance changes in 2008:
+     
+                        ||  2008q1  2008q2  2008q3  2008q4 
+     ===================++=================================
+      expenses:food     ||       0      $1       0       0 
+      expenses:supplies ||       0      $1       0       0 
+      income:gifts      ||       0     $-1       0       0 
+      income:salary     ||     $-1       0       0       0 
+     -------------------++---------------------------------
+                        ||     $-1      $1       0       0 
+
+  2. With '--cumulative': each column shows the ending balance for that
+     period, accumulating the changes across periods, starting from 0 at
+     the report start date:
+
+     $ hledger balance --quarterly income expenses -E --cumulative
+     Ending balances (cumulative) in 2008:
+     
+                        ||  2008/03/31  2008/06/30  2008/09/30  2008/12/31 
+     ===================++=================================================
+      expenses:food     ||           0          $1          $1          $1 
+      expenses:supplies ||           0          $1          $1          $1 
+      income:gifts      ||           0         $-1         $-1         $-1 
+      income:salary     ||         $-1         $-1         $-1         $-1 
+     -------------------++-------------------------------------------------
+                        ||         $-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 useful eg for a multi-period balance sheet, and when you
+     are showing only the data after a certain start date:
+
+     $ hledger balance ^assets ^liabilities --quarterly --historical --begin 2008/4/1
+     Ending balances (historical) in 2008/04/01-2008/12/31:
+     
+                           ||  2008/06/30  2008/09/30  2008/12/31 
+     ======================++=====================================
+      assets:bank:checking ||          $1          $1           0 
+      assets:bank:saving   ||          $1          $1          $1 
+      assets:cash          ||         $-2         $-2         $-2 
+      liabilities:debts    ||           0           0          $1 
+     ----------------------++-------------------------------------
+                           ||           0           0           0 
+
+   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;
+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 the
+displayed report periods.  This is so that the first and last periods
+will be "full" and comparable to the others.
+
+   The '-E/--empty' flag does two things in multicolumn balance reports:
+first, the report will show all columns within the specified report
+period (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 row.
+
+   Here's an example of all three:
+
+$ hledger balance -Q income expenses --tree -ETA
+Balance changes in 2008:
+
+            ||  2008q1  2008q2  2008q3  2008q4    Total  Average 
+============++===================================================
+ expenses   ||       0      $2       0       0       $2       $1 
+   food     ||       0      $1       0       0       $1        0 
+   supplies ||       0      $1       0       0       $1        0 
+ income     ||     $-1     $-1       0       0      $-2      $-1 
+   gifts    ||       0     $-1       0       0      $-1        0 
+   salary   ||     $-1       0       0       0      $-1        0 
+------------++---------------------------------------------------
+            ||     $-1      $1       0       0        0        0 
+
+(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.
+
+
+File: hledger.info,  Node: Budget report,  Next: ,  Prev: Multicolumn balance report,  Up: balance
+
+3.4.8 Budget report
+-------------------
+
+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
+income, expenses, time usage, etc.  -budget is most often combined with
+a report interval.
+
+   For example, you can take average monthly expenses in the common
+expense categories to construct a minimal monthly budget:
+
+;; Budget
+~ monthly
+  income  $2000
+  expenses:food    $400
+  expenses:bus     $50
+  expenses:movies  $30
+  assets:bank:checking
+
+;; Two months worth of expenses
+2017-11-01
+  income  $1950
+  expenses:food    $396
+  expenses:bus     $49
+  expenses:movies  $30
+  expenses:supplies  $20
+  assets:bank:checking
+
+2017-12-01
+  income  $2100
+  expenses:food    $412
+  expenses:bus     $53
+  expenses:gifts   $100
+  assets:bank:checking
+
+   You can now see a monthly budget report:
+
+$ hledger balance -M --budget
+Budget performance in 2017/11/01-2017/12/31:
+
+                      ||                      Nov                       Dec 
+======================++====================================================
+ assets               || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
+ assets:bank          || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
+ assets:bank:checking || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
+ expenses             ||   $495 [ 103% of   $480]    $565 [ 118% of   $480] 
+ expenses:bus         ||    $49 [  98% of    $50]     $53 [ 106% of    $50] 
+ expenses:food        ||   $396 [  99% of   $400]    $412 [ 103% of   $400] 
+ expenses:movies      ||    $30 [ 100% of    $30]       0 [   0% of    $30] 
+ income               ||  $1950 [  98% of  $2000]   $2100 [ 105% of  $2000] 
+----------------------++----------------------------------------------------
+                      ||      0 [              0]       0 [              0] 
+
+   Note this is different from a normal balance report in several ways:
+
+   * Only accounts with budget goals during the report period are shown,
+     by default.
+
+   * In each column, in square brackets after the actual amount,
+     budgeted amounts are shown, along with the percentage of budget
+     used.
+
+   * All parent accounts are always shown, even in flat mode.  Eg
+     assets, assets:bank, and expenses above.
+
+   * 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
+transactions, 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
+ones, giving the full picture.  Eg:
+
+$ hledger balance -M --budget --empty
+Budget performance in 2017/11/01-2017/12/31:
+
+                      ||                      Nov                       Dec 
+======================++====================================================
+ assets               || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
+ assets:bank          || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
+ assets:bank:checking || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480] 
+ expenses             ||   $495 [ 103% of   $480]    $565 [ 118% of   $480] 
+ expenses:bus         ||    $49 [  98% of    $50]     $53 [ 106% of    $50] 
+ expenses:food        ||   $396 [  99% of   $400]    $412 [ 103% of   $400] 
+ expenses:gifts       ||      0                      $100                   
+ expenses:movies      ||    $30 [ 100% of    $30]       0 [   0% of    $30] 
+ expenses:supplies    ||    $20                         0                   
+ income               ||  $1950 [  98% of  $2000]   $2100 [ 105% of  $2000] 
+----------------------++----------------------------------------------------
+                      ||      0 [              0]       0 [              0] 
+
+   You can roll over unspent budgets to next period with '--cumulative':
+
+$ hledger balance -M --budget --cumulative
+Budget performance in 2017/11/01-2017/12/31:
+
+                      ||                      Nov                       Dec 
+======================++====================================================
+ assets               || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960] 
+ assets:bank          || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960] 
+ assets:bank:checking || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960] 
+ expenses             ||   $495 [ 103% of   $480]   $1060 [ 110% of   $960] 
+ expenses:bus         ||    $49 [  98% of    $50]    $102 [ 102% of   $100] 
+ expenses:food        ||   $396 [  99% of   $400]    $808 [ 101% of   $800] 
+ expenses:movies      ||    $30 [ 100% of    $30]     $30 [  50% of    $60] 
+ income               ||  $1950 [  98% of  $2000]   $4050 [ 101% of  $4000] 
+----------------------++----------------------------------------------------
+                      ||      0 [              0]       0 [              0] 
+
+   For more examples, see Budgeting and Forecasting.
+
+* Menu:
+
+* Nested budgets::
+
+
+File: hledger.info,  Node: Nested budgets,  Up: Budget report
+
+3.4.8.1 Nested budgets
+......................
+
+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
+budget(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
+account, all its parents would have budget as well.
+
+   To illustrate this, consider the following budget:
+
+~ monthly from 2019/01
+    expenses:personal             $1,000.00
+    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
+means that budget for both 'expenses:personal' and 'expenses' is $1100.
+
+   Transactions in 'expenses:personal:electronics' will be counted both
+towards its $100 budget and $1100 of 'expenses:personal' , and
+transactions 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:
+
+~ monthly from 2019/01
+    expenses:personal             $1,000.00
+    expenses:personal:electronics    $100.00
+    liabilities
+
+2019/01/01 Google home hub
+    expenses:personal:electronics          $90.00
+    liabilities                           $-90.00
+
+2019/01/02 Phone screen protector
+    expenses:personal:electronics:upgrades          $10.00
+    liabilities
+
+2019/01/02 Weekly train ticket
+    expenses:personal:train tickets       $153.00
+    liabilities
+
+2019/01/03 Flowers
+    expenses:personal          $30.00
+    liabilities
+
+   As you can see, we have transactions in
+'expenses:personal:electronics:upgrades' and 'expenses:personal:train
+tickets', and since both of these accounts are without explicitly
+defined budget, these transactions would be counted towards budgets of
+'expenses:personal:electronics' and 'expenses:personal' accordingly:
+
+$ hledger balance --budget -M
+Budget performance in 2019/01:
+
+                               ||                           Jan 
+===============================++===============================
+ expenses                      ||  $283.00 [  26% of  $1100.00] 
+ expenses:personal             ||  $283.00 [  26% of  $1100.00] 
+ expenses:personal:electronics ||  $100.00 [ 100% of   $100.00] 
+ liabilities                   || $-283.00 [  26% of $-1100.00] 
+-------------------------------++-------------------------------
+                               ||        0 [                 0] 
+
+   And with '--empty', we can get a better picture of budget allocation
+and consumption:
+
+$ hledger balance --budget -M --empty
+Budget performance in 2019/01:
+
+                                        ||                           Jan 
+========================================++===============================
+ expenses                               ||  $283.00 [  26% of  $1100.00] 
+ expenses:personal                      ||  $283.00 [  26% of  $1100.00] 
+ expenses:personal:electronics          ||  $100.00 [ 100% of   $100.00] 
+ expenses:personal:electronics:upgrades ||   $10.00                      
+ expenses:personal:train tickets        ||  $153.00                      
+ liabilities                            || $-283.00 [  26% of $-1100.00] 
+----------------------------------------++-------------------------------
+                                        ||        0 [                 0] 
+
+3.4.9 Output format
+-------------------
+
+This command also supports the output destination and output format
+options The output formats supported are 'txt', 'csv', (multicolumn
+non-budget reports only) 'html', and (experimental) 'json'.
+
+
+File: hledger.info,  Node: balancesheet,  Next: balancesheetequity,  Prev: balance,  Up: COMMANDS
+
+3.5 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).
+
+   Note this report shows all account balances with normal positive sign
+(like conventional financial statements, unlike balance/print/register)
+(experimental).
+
+   Example:
+
+$ hledger balancesheet
+Balance Sheet
+
+Assets:
+                 $-1  assets
+                  $1    bank:saving
+                 $-2    cash
+--------------------
+                 $-1
+
+Liabilities:
+                  $1  liabilities:debts
+--------------------
+                  $1
+
+Total:
+--------------------
+                   0
+
+   With a reporting interval, multiple columns will be shown, one for
+each report period.  As with multicolumn balance reports, you can alter
+the report mode with '--change'/'--cumulative'/'--historical'.  Normally
+balancesheet shows historical ending balances, which is what you need
+for a balance sheet; note this means it ignores report begin dates (and
+'-T/--row-total', since summing end balances generally does not make
+sense).  Instead of absolute values percentages can be displayed with
+'-%'.
+
+   This command also supports the output destination and output format
+options The output formats supported are 'txt', 'csv', 'html', and
+(experimental) 'json'.
+
+
+File: hledger.info,  Node: balancesheetequity,  Next: cashflow,  Prev: balancesheet,  Up: COMMANDS
+
+3.6 balancesheetequity
+======================
+
+balancesheetequity, bse
+Just like balancesheet, but also reports Equity (which it assumes is
+under a top-level 'equity' account).
+
+   Example:
+
+$ hledger balancesheetequity
+Balance Sheet With Equity
+
+Assets:
+                 $-2  assets
+                  $1    bank:saving
+                 $-3    cash
+--------------------
+                 $-2
+
+Liabilities:
+                  $1  liabilities:debts
+--------------------
+                  $1
+
+Equity:
+          $1  equity:owner
+--------------------
+          $1
+
+Total:
+--------------------
+                   0
+
+   This command also supports the output destination and output format
+options The output formats supported are 'txt', 'csv', 'html', and
+(experimental) 'json'.
+
+
+File: hledger.info,  Node: cashflow,  Next: check-dates,  Prev: balancesheetequity,  Up: COMMANDS
+
+3.7 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).
+
+   Example:
+
+$ hledger cashflow
+Cashflow Statement
+
+Cash flows:
+                 $-1  assets
+                  $1    bank:saving
+                 $-2    cash
+--------------------
+                 $-1
+
+Total:
+--------------------
+                 $-1
+
+   With a reporting interval, multiple columns will be shown, one for
+each report period.  Normally cashflow shows changes in assets per
+period, though as with multicolumn balance reports you can alter the
+report mode with '--change'/'--cumulative'/'--historical'.  Instead of
+absolute values percentages can be displayed with '-%'.
+
+   This command also supports the output destination and output format
+options The output formats supported are 'txt', 'csv', 'html', and
+(experimental) 'json'.
+
+
+File: hledger.info,  Node: check-dates,  Next: check-dupes,  Prev: cashflow,  Up: COMMANDS
+
+3.8 check-dates
+===============
+
+check-dates
+Check that transactions are sorted by increasing date.  With -date2,
+checks secondary dates instead.  With -strict, dates must also be
+unique.  With a query, only matched transactions' dates are checked.
+Reads the default journal file, or another specified with -f.
+
+
+File: hledger.info,  Node: check-dupes,  Next: close,  Prev: check-dates,  Up: COMMANDS
+
+3.9 check-dupes
+===============
+
+check-dupes
+Reports account names having the same leaf but different prefixes.  In
+other words, two or more leaves that are categorized differently.  Reads
+the default journal file, or another specified as an argument.
+
+   An example: http://stefanorodighiero.net/software/hledger-dupes.html
+
+
+File: hledger.info,  Node: close,  Next: commodities,  Prev: check-dupes,  Up: COMMANDS
+
+3.10 close
+==========
+
+close, equity
+Prints a "closing balances" transaction and an "opening balances"
+transaction that bring account balances to and from zero, respectively.
+These can be added to your journal file(s), eg to bring asset/liability
+balances forward into a new journal file, or to close out
+revenues/expenses to retained earnings at the end of a period.
+
+   You can print just one of these transactions by using the '--close'
+or '--open' flag.  You can customise their descriptions with the
+'--close-desc' and '--open-desc' options.
+
+   One amountless posting to "equity:opening/closing balances" is added
+to balance the transactions, by default.  You can customise this account
+name with '--close-acct' and '--open-acct'; if you specify only one of
+these, it will be used for both.
+
+   With '--x/--explicit', the equity posting's amount will be shown.
+And if it involves multiple commodities, a posting for each commodity
+will be shown, as with the print command.
+
+   With '--interleaved', the equity postings are shown next to the
+postings they balance, which makes troubleshooting easier.
+
+   By default, transaction prices in the journal are ignored when
+generating the closing/opening transactions.  With '--show-costs', this
+cost information is preserved ('balance -B' reports will be unchanged
+after the transition).  Separate postings are generated for each cost in
+each commodity.  Note this can generate very large journal entries, if
+you have many foreign currency or investment transactions.
+
+* Menu:
+
+* close usage::
+
+
+File: hledger.info,  Node: close usage,  Up: close
+
+3.10.1 close usage
+------------------
+
+If you split your journal files by time (eg yearly), you will typically
+run this command at the end of the year, and save the closing
+transaction as last entry of the old file, and the opening transaction
+as the first entry of the new file.  This makes the files self
+contained, so that correct balances are reported no matter which of them
+are loaded.  Ie, if you load just one file, the balances are initialised
+correctly; or if you load several files, the redundant closing/opening
+transactions cancel each other out.  (They will show up in print or
+register reports; you can exclude them with a query like
+'not:desc:'(opening|closing) balances''.)
+
+   If you're running a business, you might also use this command to
+"close the books" at the end of an accounting period, transferring
+income statement account balances to retained earnings.  (You may want
+to change the equity account name to something like "equity:retained
+earnings".)
+
+   By default, the closing transaction is dated yesterday, the balances
+are calculated as of end of yesterday, and the opening transaction is
+dated today.  To close on some other date, use: 'hledger close -e
+OPENINGDATE'.  Eg, to close/open on the 2018/2019 boundary, use '-e
+2019'.  You can also use -p or 'date:PERIOD' (any starting date is
+ignored).
+
+   Both transactions will include balance assertions for the
+closed/reopened accounts.  You probably shouldn't use status or realness
+filters (like -C or -R or 'status:') with this command, or the generated
+balance assertions will depend on these flags.  Likewise, if you run
+this command with -auto, the balance assertions will probably always
+require -auto.
+
+   Examples:
+
+   Carrying asset/liability balances into a new file for 2019:
+
+$ hledger close -f 2018.journal -e 2019 assets liabilities --open
+    # (copy/paste the output to the start of your 2019 journal file)
+$ hledger close -f 2018.journal -e 2019 assets liabilities --close
+    # (copy/paste the output to the end of your 2018 journal file)
+
+   Now:
+
+$ hledger bs -f 2019.journal                   # one file - balances are correct
+$ hledger bs -f 2018.journal -f 2019.journal   # two files - balances still correct
+$ hledger bs -f 2018.journal not:desc:closing  # to see year-end balances, must exclude closing txn
+
+   Transactions spanning the closing date can complicate matters,
+breaking balance assertions:
+
+2018/12/30 a purchase made in 2018, clearing the following year
+    expenses:food          5
+    assets:bank:checking  -5  ; [2019/1/2]
+
+   Here's one way to resolve that:
+
+; in 2018.journal:
+2018/12/30 a purchase made in 2018, clearing the following year
+    expenses:food          5
+    liabilities:pending
+
+; in 2019.journal:
+2019/1/2 clearance of last year's pending transactions
+    liabilities:pending    5 = 0
+    assets:checking
+
+
+File: hledger.info,  Node: commodities,  Next: descriptions,  Prev: close,  Up: COMMANDS
+
+3.11 commodities
+================
+
+commodities
+List all commodity/currency symbols used or declared in the journal.
+
+
+File: hledger.info,  Node: descriptions,  Next: diff,  Prev: commodities,  Up: COMMANDS
+
+3.12 descriptions
+=================
+
+descriptions Show descriptions.
+
+   This command lists all descriptions that appear in transactions.
+
+   Examples:
+
+$ hledger descriptions
+Store Name
+Gas Station | Petrol
+Person A
+
+
+File: hledger.info,  Node: diff,  Next: files,  Prev: descriptions,  Up: COMMANDS
+
+3.13 diff
+=========
+
+diff
+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.)
+Since postings not transactions are compared, this also works when
+multiple 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 the account balance, you can compare the bank data with your
+journal to find out the cause.
+
+   Examples:
+
+$ hledger diff -f $LEDGER_FILE -f bank.csv assets:bank:giro 
+These transactions are in the first file only:
+
+2014/01/01 Opening Balances
+    assets:bank:giro              EUR ...
+    ...
+    equity:opening balances       EUR -...
+
+These transactions are in the second file only:
+
+
+File: hledger.info,  Node: files,  Next: help,  Prev: diff,  Up: COMMANDS
+
+3.14 files
+==========
+
+files
+List all files included in the journal.  With a REGEX argument, only
+file names matching the regular expression (case sensitive) are shown.
+
+
+File: hledger.info,  Node: help,  Next: import,  Prev: files,  Up: COMMANDS
+
+3.15 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 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 force a
+particular viewer with the '--info', '--man', '--pager', '--cat' flags.
+
+   Examples:
+
+$ hledger help
+Please choose a manual by typing "hledger help MANUAL" (a substring is ok).
+Manuals: hledger hledger-ui hledger-web journal csv timeclock timedot
+
+$ hledger help h --man
+
+hledger(1)                    hledger User Manuals                    hledger(1)
+
+NAME
+       hledger - a command-line accounting tool
+
+SYNOPSIS
+       hledger [-f FILE] COMMAND [OPTIONS] [ARGS]
+       hledger [-f FILE] ADDONCMD -- [OPTIONS] [ARGS]
+       hledger
+
+DESCRIPTION
+       hledger  is  a  cross-platform  program  for tracking money, time, or any
+...
+
+
+File: hledger.info,  Node: import,  Next: incomestatement,  Prev: help,  Up: COMMANDS
+
+3.16 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 transactions
+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 each one.  So eg to add new transactions from all CSV files to
+the main journal, it's just: 'hledger import *.csv'
+
+   New transactions are detected in the same way as print -new: by
+assuming 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
+see only uncategorised transactions:
+
+$ hledger import --dry ... | hledger -f- print unknown --ignore-assertions
+
+* Menu:
+
+* Importing balance assignments::
+
+
+File: hledger.info,  Node: Importing balance assignments,  Up: import
+
+3.16.1 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
+balance assignments (eg from an institution that provides only balances
+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,
+please test it and send a pull request.)
+
+
+File: hledger.info,  Node: incomestatement,  Next: notes,  Prev: import,  Up: COMMANDS
+
+3.17 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,
+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 simple income statement.  It currently
+assumes that you have top-level accounts named 'income' (or 'revenue')
+and 'expense' (plural forms also allowed.)
+
+$ hledger incomestatement
+Income Statement
+
+Revenues:
+                 $-2  income
+                 $-1    gifts
+                 $-1    salary
+--------------------
+                 $-2
+
+Expenses:
+                  $2  expenses
+                  $1    food
+                  $1    supplies
+--------------------
+                  $2
+
+Total:
+--------------------
+                   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
+absolute values percentages can be displayed with '-%'.
+
+   This command also supports the output destination and output format
+options The output formats supported are 'txt', 'csv', 'html', and
+(experimental) 'json'.
+
+
+File: hledger.info,  Node: notes,  Next: payees,  Prev: incomestatement,  Up: COMMANDS
+
+3.18 notes
+==========
+
+notes Show notes.
+
+   This command lists all notes that appear in transactions.
+
+   Examples:
+
+$ hledger notes
+Petrol
+Snacks
+
+
+File: hledger.info,  Node: payees,  Next: prices,  Prev: notes,  Up: COMMANDS
+
+3.19 payees
+===========
+
+payees Show payee names.
+
+   This command lists all payee names that appear in transactions.
+
+   Examples:
+
+$ hledger payees
+Store Name
+Gas Station
+Person A
+
+
+File: hledger.info,  Node: prices,  Next: print,  Prev: payees,  Up: COMMANDS
+
+3.20 prices
+===========
+
+prices
+Print market price directives from the journal.  With -costs, also print
+synthetic market prices based on transaction prices.  With
+-inverted-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.
+
+
+File: hledger.info,  Node: print,  Next: print-unique,  Prev: prices,  Up: COMMANDS
+
+3.21 print
+==========
+
+print, txns, p
+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,
+transactions 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
+directives or inter-transaction comments
+
+$ hledger print
+2008/01/01 income
+    assets:bank:checking            $1
+    income:salary                  $-1
+
+2008/06/01 gift
+    assets:bank:checking            $1
+    income:gifts                   $-1
+
+2008/06/02 save
+    assets:bank:saving              $1
+    assets:bank:checking           $-1
+
+2008/06/03 * eat & shop
+    expenses:food                $1
+    expenses:supplies            $1
+    assets:cash                 $-2
+
+2008/12/31 * pay off
+    liabilities:debts               $1
+    assets:bank:checking           $-1
+
+   Normally, the journal entry's explicit or implicit amount style is
+preserved.  For example, when an amount is omitted in the journal, it
+will not appear in the output.  Similarly, when a transaction price is
+implied but not written, it will not appear in the output.  You can use
+the '-x'/'--explicit' flag to make all amounts and transaction prices
+explicit, 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 the output parseable.
+
+   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
+transaction: 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
+special 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
+ignoring 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
+increasing dates, and that transactions on the same day do not get
+reordered.  See also the import command.
+
+   This command also supports the output destination and output format
+options The output formats supported are 'txt', 'csv', and
+(experimental) 'json'.
+
+   Here's an example of print's CSV output:
+
+$ hledger print -Ocsv
+"txnidx","date","date2","status","code","description","comment","account","amount","commodity","credit","debit","posting-status","posting-comment"
+"1","2008/01/01","","","","income","","assets:bank:checking","1","$","","1","",""
+"1","2008/01/01","","","","income","","income:salary","-1","$","1","","",""
+"2","2008/06/01","","","","gift","","assets:bank:checking","1","$","","1","",""
+"2","2008/06/01","","","","gift","","income:gifts","-1","$","1","","",""
+"3","2008/06/02","","","","save","","assets:bank:saving","1","$","","1","",""
+"3","2008/06/02","","","","save","","assets:bank:checking","-1","$","1","","",""
+"4","2008/06/03","","*","","eat & shop","","expenses:food","1","$","","1","",""
+"4","2008/06/03","","*","","eat & shop","","expenses:supplies","1","$","","1","",""
+"4","2008/06/03","","*","","eat & shop","","assets:cash","-2","$","2","","",""
+"5","2008/12/31","","*","","pay off","","liabilities:debts","1","$","","1","",""
+"5","2008/12/31","","*","","pay off","","assets:bank:checking","-1","$","1","","",""
+
+   * There is one CSV record per posting, with the parent transaction's
+     fields repeated.
+   * 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 order, etc.)
+   * The amount is separated into "commodity" (the symbol) and "amount"
+     (numeric quantity) fields.
+   * The numeric amount is repeated in either the "credit" or "debit"
+     column, for convenience.  (Those names are not accurate in the
+     accounting sense; it just puts negative amounts under credit and
+     zero or greater amounts under debit.)
+
+
+File: hledger.info,  Node: print-unique,  Next: register,  Prev: print,  Up: COMMANDS
+
+3.22 print-unique
+=================
+
+print-unique
+Print transactions which do not reuse an already-seen description.
+
+   Example:
+
+$ cat unique.journal
+1/1 test
+ (acct:one)  1
+2/2 test
+ (acct:two)  2
+$ LEDGER_FILE=unique.journal hledger print-unique
+(-f option not supported)
+2015/01/01 test
+    (acct:one)             1
+
+
+File: hledger.info,  Node: register,  Next: register-match,  Prev: print-unique,  Up: COMMANDS
+
+3.23 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:
+
+$ hledger register checking
+2008/01/01 income               assets:bank:checking            $1           $1
+2008/06/01 gift                 assets:bank:checking            $1           $2
+2008/06/02 save                 assets:bank:checking           $-1           $1
+2008/12/31 pay off              assets:bank:checking           $-1            0
+
+   With -date2, it shows and sorts by secondary date instead.
+
+   The '--historical'/'-H' flag adds the balance from any undisplayed
+prior postings to the running total.  This is useful when you want to
+see only recent activity, with a historically accurate running balance:
+
+$ hledger register checking -b 2008/6 --historical
+2008/06/01 gift                 assets:bank:checking            $1           $2
+2008/06/02 save                 assets:bank:checking           $-1           $1
+2008/12/31 pay off              assets:bank:checking           $-1            0
+
+   The '--depth' option limits the amount of sub-account detail
+displayed.
+
+   The '--average'/'-A' flag shows the running average posting amount
+instead of the running total (so, the final number displayed is the
+average for the whole report period).  This flag implies '--empty' (see
+below).  It is affected by '--historical'.  It works best when showing
+just one account and one commodity.
+
+   The '--related'/'-r' flag shows the _other_ postings in the
+transactions of the postings which would normally be shown.
+
+   The '--invert' flag negates all amounts.  For example, it can be used
+on an income account where amounts are normally displayed as negative
+numbers.  It's also useful to show postings on the checking account
+together with the related account:
+
+$ hledger register --related --invert assets:checking
+
+   With a reporting interval, register shows summary postings, one per
+interval, aggregating the postings to each account:
+
+$ hledger register --monthly income
+2008/01                 income:salary                          $-1          $-1
+2008/06                 income:gifts                           $-1          $-2
+
+   Periods with no activity, and summary postings with a zero amount,
+are not shown by default; use the '--empty'/'-E' flag to see them:
+
+$ hledger register --monthly income -E
+2008/01                 income:salary                          $-1          $-1
+2008/02                                                          0          $-1
+2008/03                                                          0          $-1
+2008/04                                                          0          $-1
+2008/05                                                          0          $-1
+2008/06                 income:gifts                           $-1          $-2
+2008/07                                                          0          $-2
+2008/08                                                          0          $-2
+2008/09                                                          0          $-2
+2008/10                                                          0          $-2
+2008/11                                                          0          $-2
+2008/12                                                          0          $-2
+
+   Often, you'll want to see just one line per interval.  The '--depth'
+option helps with this, causing subaccounts to be aggregated:
+
+$ hledger register --monthly assets --depth 1h
+2008/01                 assets                                  $1           $1
+2008/06                 assets                                 $-1            0
+2008/12                 assets                                 $-1          $-1
+
+   Note when using report intervals, if you specify start/end dates
+these will be adjusted outward if necessary to contain a whole number of
+intervals.  This ensures that the first and last intervals are full
+length and comparable to the others in the report.
+
+* Menu:
+
+* Custom register output::
+
+
+File: hledger.info,  Node: Custom register output,  Up: register
+
+3.23.1 Custom register output
+-----------------------------
+
+register uses the full terminal width by default, except on windows.
+You can override this by setting the 'COLUMNS' environment variable (not
+a bash shell variable) or by using the '--width'/'-w' option.
+
+   The description and account columns normally share the space equally
+(about half of (width - 40) each).  You can adjust this by adding a
+description width as part of -width's argument, comma-separated:
+'--width W,D' .  Here's a diagram (won't display correctly in -help):
+
+<--------------------------------- width (W) ---------------------------------->
+date (10)  description (D)       account (W-41-D)     amount (12)   balance (12)
+DDDDDDDDDD dddddddddddddddddddd  aaaaaaaaaaaaaaaaaaa  AAAAAAAAAAAA  AAAAAAAAAAAA
+
+   and some examples:
+
+$ hledger reg                     # use terminal width (or 80 on windows)
+$ hledger reg -w 100              # use width 100
+$ COLUMNS=100 hledger reg         # set with one-time environment variable
+$ export COLUMNS=100; hledger reg # set till session end (or window resize)
+$ hledger reg -w 100,40           # set overall width 100, description width 40
+$ hledger reg -w $COLUMNS,40      # use terminal width, & description width 40
+
+   This command also supports the output destination and output format
+options The output formats supported are 'txt', 'csv', and
+(experimental) 'json'.
+
+
+File: hledger.info,  Node: register-match,  Next: rewrite,  Prev: register,  Up: COMMANDS
+
+3.24 register-match
+===================
+
+register-match
+Print the one posting whose transaction description is closest to DESC,
+in the style of the register command.  If there are multiple equally
+good matches, it shows the most recent.  Query options (options, not
+arguments) can be used to restrict the search space.  Helps
+ledger-autosync detect already-seen transactions when importing.
+
+
+File: hledger.info,  Node: rewrite,  Next: roi,  Prev: register-match,  Up: COMMANDS
+
+3.25 rewrite
+============
+
+rewrite
+Print all transactions, rewriting the postings of matched transactions.
+For now the only rewrite available is adding new postings, like print
+-auto.
+
+   This is a start at a generic rewriter of transaction entries.  It
+reads the default journal and prints the transactions, like print, but
+adds one or more specified postings to any transactions matching QUERY.
+The posting amounts can be fixed, or a multiplier of the existing
+transaction's first posting amount.
+
+   Examples:
+
+$ hledger-rewrite.hs ^income --add-posting '(liabilities:tax)  *.33  ; income tax' --add-posting '(reserve:gifts)  $100'
+$ hledger-rewrite.hs expenses:gifts --add-posting '(reserve:gifts)  *-1"'
+$ hledger-rewrite.hs -f rewrites.hledger
+
+   rewrites.hledger may consist of entries like:
+
+= ^income amt:<0 date:2017
+  (liabilities:tax)  *0.33  ; tax on income
+  (reserve:grocery)  *0.25  ; reserve 25% for grocery
+  (reserve:)  *0.25  ; reserve 25% for grocery
+
+   Note the single quotes to protect the dollar sign from bash, and the
+two spaces between account and amount.
+
+   More:
+
+$ hledger rewrite -- [QUERY]        --add-posting "ACCT  AMTEXPR" ...
+$ hledger rewrite -- ^income        --add-posting '(liabilities:tax)  *.33'
+$ hledger rewrite -- expenses:gifts --add-posting '(budget:gifts)  *-1"'
+$ hledger rewrite -- ^income        --add-posting '(budget:foreign currency)  *0.25 JPY; diversify'
+
+   Argument for '--add-posting' option is a usual posting of transaction
+with an exception for amount specification.  More precisely, you can use
+''*'' (star symbol) before the amount to indicate that that this is a
+factor for an amount of original matched posting.  If the amount
+includes a commodity name, the new posting amount will be in the new
+commodity; otherwise, it will be in the matched posting amount's
+commodity.
+
+* Menu:
+
+* Re-write rules in a file::
+
+
+File: hledger.info,  Node: Re-write rules in a file,  Up: rewrite
+
+3.25.1 Re-write rules in a file
+-------------------------------
+
+During the run this tool will execute so called "Automated Transactions"
+found in any journal it process.  I.e instead of specifying this
+operations in command line you can put them in a journal file.
+
+$ rewrite-rules.journal
+
+   Make contents look like this:
+
+= ^income
+    (liabilities:tax)  *.33
+
+= expenses:gifts
+    budget:gifts  *-1
+    assets:budget  *1
+
+   Note that ''='' (equality symbol) that is used instead of date in
+transactions you usually write.  It indicates the query by which you
+want to match the posting to add new ones.
+
+$ hledger rewrite -- -f input.journal -f rewrite-rules.journal > rewritten-tidy-output.journal
+
+   This is something similar to the commands pipeline:
+
+$ hledger rewrite -- -f input.journal '^income' --add-posting '(liabilities:tax)  *.33' \
+  | hledger rewrite -- -f - expenses:gifts      --add-posting 'budget:gifts  *-1'       \
+                                                --add-posting 'assets:budget  *1'       \
+  > rewritten-tidy-output.journal
+
+   It is important to understand that relative order of such entries in
+journal is important.  You can re-use result of previously added
+postings.
+
+* Menu:
+
+* Diff output format::
+* rewrite vs print --auto::
+
+
+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
+...........................
+
+To use this tool for batch modification of your journal files you may
+find useful output in form of unified diff.
+
+$ hledger rewrite -- --diff -f examples/sample.journal '^income' --add-posting '(liabilities:tax)  *.33'
+
+   Output might look like:
+
+--- /tmp/examples/sample.journal
++++ /tmp/examples/sample.journal
+@@ -18,3 +18,4 @@
+ 2008/01/01 income
+-    assets:bank:checking  $1
++    assets:bank:checking            $1
+     income:salary
++    (liabilities:tax)                0
+@@ -22,3 +23,4 @@
+ 2008/06/01 gift
+-    assets:bank:checking  $1
++    assets:bank:checking            $1
+     income:gifts
++    (liabilities:tax)                0
+
+   If you'll pass this through 'patch' tool you'll get transactions
+containing the posting that matches your query be updated.  Note that
+multiple files might be update according to list of input files
+specified via '--file' options and 'include' directives inside of these
+files.
+
+   Be careful.  Whole transaction being re-formatted in a style of
+output from 'hledger print'.
+
+   See also:
+
+   https://github.com/simonmichael/hledger/issues/99
+
+
+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
+................................
+
+This command predates print -auto, and currently does much the same
+thing, but with these differences:
+
+   * with multiple files, rewrite lets rules in any file affect all
+     other files.  print -auto uses standard directive scoping; rules
+     affect only child files.
+
+   * rewrite's query limits which transactions can be rewritten; all are
+     printed.  print -auto's query limits which transactions are
+     printed.
+
+   * rewrite applies rules specified on command line or in the journal.
+     print -auto applies rules specified in the journal.
+
+
+File: hledger.info,  Node: roi,  Next: stats,  Prev: rewrite,  Up: COMMANDS
+
+3.26 roi
+========
+
+roi
+Shows the time-weighted (TWR) and money-weighted (IRR) rate of return on
+your investments.
+
+   This command assumes that you have account(s) that hold nothing but
+your investments and whenever you record current appraisal/valuation of
+these investments you offset unrealized profit and loss into account(s)
+that, again, hold nothing but unrealized profit and loss.
+
+   Any transactions affecting balance of investment account(s) and not
+originating from unrealized profit and loss account(s) are assumed to be
+your investments or withdrawals.
+
+   At a minimum, you need to supply a query (which could be just an
+account name) to select your investments with '--inv', and another query
+to identify your profit and loss transactions with '--pnl'.
+
+   It will compute and display the internalized rate of return (IRR) and
+time-weighted rate of return (TWR) for your investments for the time
+period requested.  Both rates of return are annualized before display,
+regardless of the length of reporting interval.
+
+
+File: hledger.info,  Node: stats,  Next: tags,  Prev: roi,  Up: COMMANDS
+
+3.27 stats
+==========
+
+stats
+Show some journal statistics.
+
+   The stats command displays summary information for the whole journal,
+or a matched part of it.  With a reporting interval, it shows a report
+for each report period.
+
+   Example:
+
+$ hledger stats
+Main journal file        : /src/hledger/examples/sample.journal
+Included journal files   : 
+Transactions span        : 2008-01-01 to 2009-01-01 (366 days)
+Last transaction         : 2008-12-31 (2333 days ago)
+Transactions             : 5 (0.0 per day)
+Transactions last 30 days: 0 (0.0 per day)
+Transactions last 7 days : 0 (0.0 per day)
+Payees/descriptions      : 5
+Accounts                 : 8 (depth 3)
+Commodities              : 1 ($)
+Market prices            : 12 ($)
+
+   This command also supports output destination and output format
+selection.
+
+
+File: hledger.info,  Node: tags,  Next: test,  Prev: stats,  Up: COMMANDS
+
+3.28 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.
+
+
+File: hledger.info,  Node: test,  Next: Add-on Commands,  Prev: tags,  Up: COMMANDS
+
+3.29 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
+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 as
+a bug!
+
+   This command also accepts tasty test runner options, written after a
+- (double hyphen).  Eg to run only the tests in Hledger.Data.Amount,
+with ANSI colour codes disabled:
+
+$ hledger test -- -pData.Amount --color=never
+
+   For help on these, see https://github.com/feuerbach/tasty#options
+('-- --help' currently doesn't show them).
+
+
+File: hledger.info,  Node: Add-on Commands,  Prev: test,  Up: COMMANDS
+
+3.30 Add-on Commands
+====================
+
+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
+extension (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
+things to be aware of.  Eg if the 'hledger-web' add-on is installed,
+
+   * 'hledger -h web' shows hledger's help, while 'hledger web -h' shows
+     hledger-web's help.
+
+   * 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'.
+
+   * 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
+options, journal parsing, reporting, etc.
+
+   Two important add-ons are the hledger-ui and hledger-web user
+interfaces.  These are maintained and released along with hledger:
+
+* Menu:
+
+* ui::
+* web::
+* iadd::
+* interest::
+
+
+File: hledger.info,  Node: ui,  Next: web,  Up: Add-on Commands
+
+3.30.1 ui
+---------
+
+hledger-ui provides an efficient terminal interface.
+
+
+File: hledger.info,  Node: web,  Next: iadd,  Prev: ui,  Up: Add-on Commands
+
+3.30.2 web
+----------
+
+hledger-web provides a simple web interface.
+
+   Third party add-ons, maintained separately from hledger, include:
+
+
+File: hledger.info,  Node: iadd,  Next: interest,  Prev: web,  Up: Add-on Commands
+
+3.30.3 iadd
+-----------
+
+hledger-iadd is a more interactive, terminal UI replacement for the add
+command.
+
+
+File: hledger.info,  Node: interest,  Prev: iadd,  Up: Add-on Commands
+
+3.30.4 interest
+---------------
+
+hledger-interest generates interest transactions for an account
+according to various schemes.
+
+   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.
+
+
+File: hledger.info,  Node: ENVIRONMENT,  Next: FILES,  Prev: COMMANDS,  Up: Top
+
+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'.
+Default: '~/.hledger.journal' (on windows, perhaps
+'C:/Users/USER/.hledger.journal').
+
+   A typical value is '~/DIR/YYYY.journal', where DIR is a
+version-controlled finance directory and YYYY is the current year.  Or
+'~/DIR/current.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
+(say, an Emacs dock icon).  Eg on MacOS Catalina I have a
+'~/.MacOSX/environment.plist' file containing
+
+{
+  "LEDGER_FILE" : "~/finance/current.journal"
+}
+
+   To see the effect you may need to 'killall Dock', or reboot.
+
+
+File: hledger.info,  Node: FILES,  Next: LIMITATIONS,  Prev: ENVIRONMENT,  Up: Top
+
+5 FILES
+*******
+
+Reads data from one or more files in hledger journal, timeclock,
+timedot, or CSV format specified with '-f', or '$LEDGER_FILE', or
+'$HOME/.hledger.journal' (on windows, perhaps
+'C:/Users/USER/.hledger.journal').
+
+
+File: hledger.info,  Node: LIMITATIONS,  Next: TROUBLESHOOTING,  Prev: FILES,  Up: Top
+
+6 LIMITATIONS
+*************
+
+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 must be configured (or there will be an unhelpful error).  Eg on
+POSIX, set LANG to something other than C.
+
+   In a Microsoft Windows CMD window, non-ascii characters and colours
+are not supported.
+
+   On Windows, non-ascii characters may not display correctly when
+running a hledger built in CMD in MSYS/CYGWIN, or vice-versa.
+
+   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 differences.
+
+   On large data files, hledger is slower and uses more memory than
+Ledger.
+
+
+File: hledger.info,  Node: TROUBLESHOOTING,  Prev: LIMITATIONS,  Up: Top
+
+7 TROUBLESHOOTING
+*****************
+
+Here are some issues you might encounter when you run hledger (and
+remember 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,
+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
+need to use 'export'.  Here's an explanation.
+
+   *"Illegal byte sequence" or "Invalid or incomplete multibyte or wide
+character" errors*
+In order to handle non-ascii letters and symbols (like £), hledger needs
+an appropriate locale.  This is usually configured system-wide; you can
+also configure it temporarily.  The locale may need to be one that
+supports UTF-8, if you built hledger with GHC < 7.2 (or possibly always,
+I'm not sure yet).
+
+   Here's an example of setting the locale temporarily, on ubuntu
+gnu/linux:
+
+$ file my.journal
+my.journal: UTF-8 Unicode text                 # <- the file is UTF8-encoded
+$ locale -a
+C
+en_US.utf8                             # <- a UTF8-aware locale is available
+POSIX
+$ LANG=en_US.utf8 hledger -f my.journal print   # <- use it for this command
+
+   Here's one way to set it permanently, there are probably better ways:
+
+$ echo "export LANG=en_US.UTF-8" >>~/.bash_profile
+$ bash --login
+
+   If we preferred to use eg 'fr_FR.utf8', we might have to install that
+first:
+
+$ apt-get install language-pack-fr
+$ locale -a
+C
+en_US.utf8
+fr_BE.utf8
+fr_CA.utf8
+fr_CH.utf8
+fr_FR.utf8
+fr_LU.utf8
+POSIX
+$ LANG=fr_FR.utf8 hledger -f my.journal print
+
+   Note some platforms allow variant locale spellings, but not all
+(ubuntu accepts 'fr_FR.UTF8', mac osx requires exactly 'fr_FR.UTF-8').
+
+
+Tag Table:
+Node: Top68
+Node: COMMON TASKS2315
+Ref: #common-tasks2427
+Node: Getting help2834
+Ref: #getting-help2966
+Node: Constructing command lines3519
+Ref: #constructing-command-lines3711
+Node: Starting a journal file4408
+Ref: #starting-a-journal-file4606
+Node: Setting opening balances5794
+Ref: #setting-opening-balances5990
+Node: Recording transactions9131
+Ref: #recording-transactions9311
+Node: Reconciling9867
+Ref: #reconciling10010
+Node: Reporting12267
+Ref: #reporting12407
+Node: Migrating to a new file16406
+Ref: #migrating-to-a-new-file16554
+Node: OPTIONS16853
+Ref: #options16960
+Node: General options17330
+Ref: #general-options17455
+Node: Command options20225
+Ref: #command-options20376
+Node: Command arguments20774
+Ref: #command-arguments20921
+Node: Queries21801
+Ref: #queries21956
+Node: Special characters in arguments and queries25918
+Ref: #special-characters-in-arguments-and-queries26146
+Node: More escaping26597
+Ref: #more-escaping26759
+Node: Even more escaping27055
+Ref: #even-more-escaping27249
+Node: Less escaping27920
+Ref: #less-escaping28082
+Node: Unicode characters28327
+Ref: #unicode-characters28509
+Node: Input files29921
+Ref: #input-files30064
+Node: Output destination31993
+Ref: #output-destination32145
+Node: Output format32570
+Ref: #output-format32720
+Node: Regular expressions34768
+Ref: #regular-expressions34925
+Node: Smart dates36286
+Ref: #smart-dates36437
+Node: Report start & end date37798
+Ref: #report-start-end-date37970
+Node: Report intervals39408
+Ref: #report-intervals39573
+Node: Period expressions39963
+Ref: #period-expressions40123
+Node: Depth limiting44249
+Ref: #depth-limiting44393
+Node: Pivoting44735
+Ref: #pivoting44858
+Node: Valuation46534
+Ref: #valuation46636
+Node: -B Cost46816
+Ref: #b-cost46927
+Node: -V Market value47125
+Ref: #v-market-value47299
+Node: -X Market value in specified commodity48731
+Ref: #x-market-value-in-specified-commodity48970
+Node: --value Flexible valuation49146
+Ref: #value-flexible-valuation49372
+Node: Effect of --value on reports53877
+Ref: #effect-of---value-on-reports54093
+Node: Combining -B -V -X --value59639
+Ref: #combining--b--v--x---value59822
+Node: COMMANDS59858
+Ref: #commands59966
+Node: accounts61050
+Ref: #accounts61148
+Node: activity61847
+Ref: #activity61957
+Node: add62340
+Ref: #add62439
+Node: balance65178
+Ref: #balance65289
+Node: Classic balance report66747
+Ref: #classic-balance-report66920
+Node: Customising the classic balance report68289
+Ref: #customising-the-classic-balance-report68517
+Node: Colour support70593
+Ref: #colour-support70760
+Node: Flat mode70933
+Ref: #flat-mode71081
+Node: Depth limited balance reports71494
+Ref: #depth-limited-balance-reports71679
+Node: Percentages72135
+Ref: #percentages72301
+Node: Multicolumn balance report73438
+Ref: #multicolumn-balance-report73618
+Node: Budget report78880
+Ref: #budget-report79023
+Node: Nested budgets84225
+Ref: #nested-budgets84337
+Ref: #output-format-187818
+Node: balancesheet88015
+Ref: #balancesheet88151
+Node: balancesheetequity89617
+Ref: #balancesheetequity89766
+Node: cashflow90489
+Ref: #cashflow90617
+Node: check-dates91796
+Ref: #check-dates91923
+Node: check-dupes92202
+Ref: #check-dupes92326
+Node: close92619
+Ref: #close92733
+Node: close usage94255
+Ref: #close-usage94348
+Node: commodities97161
+Ref: #commodities97288
+Node: descriptions97370
+Ref: #descriptions97498
+Node: diff97679
+Ref: #diff97785
+Node: files98832
+Ref: #files98932
+Node: help99079
+Ref: #help99179
+Node: import100260
+Ref: #import100374
+Node: Importing balance assignments101267
+Ref: #importing-balance-assignments101415
+Node: incomestatement102064
+Ref: #incomestatement102197
+Node: notes103684
+Ref: #notes103797
+Node: payees103923
+Ref: #payees104029
+Node: prices104187
+Ref: #prices104293
+Node: print104634
+Ref: #print104744
+Node: print-unique109530
+Ref: #print-unique109656
+Node: register109941
+Ref: #register110068
+Node: Custom register output114240
+Ref: #custom-register-output114369
+Node: register-match115706
+Ref: #register-match115840
+Node: rewrite116191
+Ref: #rewrite116306
+Node: Re-write rules in a file118161
+Ref: #re-write-rules-in-a-file118295
+Node: Diff output format119505
+Ref: #diff-output-format119674
+Node: rewrite vs print --auto120766
+Ref: #rewrite-vs.-print---auto120945
+Node: roi121501
+Ref: #roi121599
+Node: stats122611
+Ref: #stats122710
+Node: tags123498
+Ref: #tags123596
+Node: test123890
+Ref: #test123998
+Node: Add-on Commands124745
+Ref: #add-on-commands124862
+Node: ui126205
+Ref: #ui126293
+Node: web126347
+Ref: #web126450
+Node: iadd126566
+Ref: #iadd126677
+Node: interest126759
+Ref: #interest126866
+Node: ENVIRONMENT127106
+Ref: #environment127218
+Node: FILES128047
+Ref: #files-1128150
+Node: LIMITATIONS128363
+Ref: #limitations128482
+Node: TROUBLESHOOTING129224
+Ref: #troubleshooting129337
 
 End Tag Table
 
diff --git a/hledger.txt b/hledger.txt
--- a/hledger.txt
+++ b/hledger.txt
@@ -12,2812 +12,3179 @@
        hledger
 
 DESCRIPTION
-       hledger  is  a  cross-platform program for tracking money, time, or any
-       other commodity, using double-entry accounting and a  simple,  editable
-       file  format.   hledger  is  inspired  by  and  largely compatible with
-       ledger(1).
-       Tested on unix, mac, windows, hledger aims to be a reliable,  practical
-       tool for daily use.
-
-       This  is  hledger's command-line interface (there are also terminal and
-       web interfaces).  Its basic function is to read a plain text  file  de-
-       scribing  financial  transactions (in accounting terms, a general jour-
-       nal) and print useful reports on standard output,  or  export  them  as
-       CSV.   hledger can also read some other file formats such as CSV files,
-       translating them to journal format.  Additionally, hledger lists  other
-       hledger-*  executables found in the user's $PATH and can invoke them as
-       subcommands.
-
-       hledger reads data from one or more files  in  hledger  journal,  time-
-       clock,  timedot,  or  CSV format specified with -f, or $LEDGER_FILE, or
-       $HOME/.hledger.journal          (on          windows,           perhaps
-       C:/Users/USER/.hledger.journal).  If using $LEDGER_FILE, note this must
-       be a real environment variable, not a shell variable.  You can  specify
-       standard input with -f-.
-
-       Transactions  are  dated movements of money between two (or more) named
-       accounts, and are recorded with journal entries like this:
-
-              2015/10/16 bought food
-               expenses:food          $10
-               assets:cash
-
-       For more about this format, see hledger_journal(5).
-
-       Most users use a text editor to edit the journal, usually with an  edi-
-       tor mode such as ledger-mode for added convenience.  hledger's interac-
-       tive add command is another way to record  new  transactions.   hledger
-       never changes existing transactions.
-
-       To  get  started,  you  can  either save some entries like the above in
-       ~/.hledger.journal, or run hledger add and follow  the  prompts.   Then
-       try  some  commands like hledger print or hledger balance.  Run hledger
-       with no arguments for a list of commands.
-
-EXAMPLES
-       Two simple transactions in hledger journal format:
-
-              2015/9/30 gift received
-                assets:cash   $20
-                income:gifts
-
-              2015/10/16 farmers market
-                expenses:food    $10
-                assets:cash
-
-       Some basic reports:
-
-              $ hledger print
-              2015/09/30 gift received
-                  assets:cash            $20
-                  income:gifts          $-20
-
-              2015/10/16 farmers market
-                  expenses:food           $10
-                  assets:cash            $-10
-
-              $ hledger accounts --tree
-              assets
-                cash
-              expenses
-                food
-              income
-                gifts
-
-              $ hledger balance
-                               $10  assets:cash
-                               $10  expenses:food
-                              $-20  income:gifts
-              --------------------
-                                 0
-
-              $ hledger register cash
-              2015/09/30 gift received   assets:cash               $20           $20
-              2015/10/16 farmers market  assets:cash              $-10           $10
-
-       More commands:
-
-              $ hledger                                 # show available commands
-              $ hledger add                             # add more transactions to the journal file
-              $ hledger balance                         # all accounts with aggregated balances
-              $ hledger balance --help                  # show detailed help for balance command
-              $ hledger balance --depth 1               # only top-level accounts
-              $ hledger register                        # show account postings, with running total
-              $ hledger reg income                      # show postings to/from income accounts
-              $ hledger reg 'assets:some bank:checking' # show postings to/from this checking account
-              $ hledger print desc:shop                 # show transactions with shop in the description
-              $ hledger activity -W                     # show transaction counts per week as a bar chart
-
-OPTIONS
-   General options
-       To see general usage help, including general  options  which  are  sup-
-       ported by most hledger commands, run hledger -h.
-
-       General help options:
-
-       -h --help
-              show general usage (or after COMMAND, command usage)
-
-       --version
-              show version
-
-       --debug[=N]
-              show debug output (levels 1-9, default: 1)
-
-       General input options:
-
-       -f FILE --file=FILE
-              use  a  different  input  file.   For  stdin,  use  -  (default:
-              $LEDGER_FILE or $HOME/.hledger.journal)
-
-       --rules-file=RULESFILE
-              Conversion  rules  file  to  use  when  reading  CSV   (default:
-              FILE.rules)
-
-       --separator=CHAR
-              Field separator to expect when reading CSV (default: ',')
-
-       --alias=OLD=NEW
-              rename accounts named OLD to NEW
-
-       --anon anonymize accounts and payees
-
-       --pivot FIELDNAME
-              use some other field or tag for the account name
-
-       -I --ignore-assertions
-              ignore any failing balance assertions
-
-       General reporting options:
-
-       -b --begin=DATE
-              include postings/txns on or after this date
-
-       -e --end=DATE
-              include postings/txns before this date
-
-       -D --daily
-              multiperiod/multicolumn report by day
-
-       -W --weekly
-              multiperiod/multicolumn report by week
-
-       -M --monthly
-              multiperiod/multicolumn report by month
-
-       -Q --quarterly
-              multiperiod/multicolumn report by quarter
-
-       -Y --yearly
-              multiperiod/multicolumn report by year
-
-       -p --period=PERIODEXP
-              set  start date, end date, and/or reporting interval all at once
-              using period expressions syntax
-
-       --date2
-              match the secondary date instead (see command help for other ef-
-              fects)
-
-       -U --unmarked
-              include only unmarked postings/txns (can combine with -P or -C)
-
-       -P --pending
-              include only pending postings/txns
-
-       -C --cleared
-              include only cleared postings/txns
-
-       -R --real
-              include only non-virtual postings
-
-       -NUM --depth=NUM
-              hide/aggregate accounts or postings more than NUM levels deep
-
-       -E --empty
-              show  items with zero amount, normally hidden (and vice-versa in
-              hledger-ui/hledger-web)
-
-       -B --cost
-              convert amounts to their cost at  transaction  time  (using  the
-              transaction price, if any)
-
-       -V --value
-              convert  amounts  to  their  market value on the report end date
-              (using the most recent applicable market price, if any)
-
-       --auto apply automated posting rules to modify transactions.
-
-       --forecast
-              apply periodic transaction rules  to  generate  future  transac-
-              tions, to 6 months from now or report end date.
-
-       When a reporting option appears more than once in the command line, the
-       last one takes precedence.
-
-       Some reporting options can also be written as query arguments.
-
-   Command options
-       To see options for a particular command, including command-specific op-
-       tions, run: hledger COMMAND -h.
-
-       Command-specific  options  must  be written after the command name, eg:
-       hledger print -x.
-
-       Additionally, if the command is an addon, you may need to put  its  op-
-       tions  after  a  double-hyphen, eg: hledger ui -- --watch.  Or, you can
-       run the addon executable directly: hledger-ui --watch.
-
-   Command arguments
-       Most hledger commands accept arguments after the  command  name,  which
-       are often a query, filtering the data in some way.
-
-   Argument files
-       You can save a set of command line options/arguments in a file, one per
-       line, and then reuse them by writing @FILENAME in a command  line.   To
-       prevent this expansion of @-arguments, precede them with a -- argument.
-       For more, see Save frequently used options.
-
-   Special characters in arguments and queries
-       In shell command lines, option and argument values which contain "prob-
-       lematic" characters, ie spaces, and also characters significant to your
-       shell such as <, >, (, ), | and $, should be escaped by enclosing  them
-       in quotes or by writing backslashes before the characters.  Eg:
-
-       hledger   register   -p   'last  year'  "accounts  receivable  (receiv-
-       able|payable)" amt:\>100.
-
-   More escaping
-       Characters significant both to the shell and in regular expressions may
-       need  one extra level of escaping.  These include parentheses, the pipe
-       symbol and the dollar sign.  Eg, to match the dollar symbol, bash users
-       should do:
-
-       hledger balance cur:'\$'
-
-       or:
-
-       hledger balance cur:\\$
-
-   Even more escaping
-       When  hledger runs an addon executable (eg you type hledger ui, hledger
-       runs hledger-ui), it  de-escapes  command-line  options  and  arguments
-       once,  so  you might need to triple-escape.  Eg in bash, running the ui
-       command and matching the dollar sign, it's:
-
-       hledger ui cur:'\\$'
-
-       or:
-
-       hledger ui cur:\\\\$
-
-       If you asked why four slashes above, this may help:
-
-       unescaped:        $
-       escaped:          \$
-       double-escaped:   \\$
-       triple-escaped:   \\\\$
-
-       (The number of backslashes in fish shell is left as an exercise for the
-       reader.)
-
-       You can always avoid the extra escaping for addons by running the addon
-       directly:
-
-       hledger-ui cur:\\$
-
-   Less escaping
-       Inside an argument file, or  in  the  search  field  of  hledger-ui  or
-       hledger-web,  or  at a GHCI prompt, you need one less level of escaping
-       than at the command line.  And backslashes may work better than quotes.
-       Eg:
-
-       ghci> :main balance cur:\$
-
-   Command line tips
-       If in doubt, keep things simple:
-
-       o write options after the command (hledger CMD -OPTIONS ARGS)
-
-       o run add-on executables directly (hledger-ui -OPTIONS ARGS)
-
-       o enclose problematic args in single quotes
-
-       o if needed, also add a backslash to escape regexp metacharacters
-
-       To  find  out exactly how a command line is being parsed, add --debug=2
-       to troubleshoot.
-
-   Unicode characters
-       hledger is expected to handle non-ascii characters correctly:
-
-       o they should be parsed correctly in input files  and  on  the  command
-         line,  by all hledger tools (add, iadd, hledger-web's search/add/edit
-         forms, etc.)
-
-       o they should be displayed correctly by  all  hledger  tools,  and  on-
-         screen alignment should be preserved.
-
-       This requires a well-configured environment.  Here are some tips:
-
-       o A  system  locale must be configured, and it must be one that can de-
-         code the characters being used.  In bash, you can set a  locale  like
-         this:  export LANG=en_US.UTF-8.  There are some more details in Trou-
-         bleshooting.  This step is essential - without it, hledger will  quit
-         on  encountering a non-ascii character (as with all GHC-compiled pro-
-         grams).
-
-       o your terminal software (eg  Terminal.app,  iTerm,  CMD.exe,  xterm..)
-         must support unicode
-
-       o the terminal must be using a font which includes the required unicode
-         glyphs
-
-       o the terminal should be configured to display wide characters as  dou-
-         ble width (for report alignment)
-
-       o on  Windows, for best results you should run hledger in the same kind
-         of environment in which it was built.  Eg hledger built in the  stan-
-         dard  CMD.EXE  environment  (like  the binaries on our download page)
-         might show display problems when run in a cygwin  or  msys  terminal,
-         and vice versa.  (See eg #961).
-
-   Input files
-       hledger reads transactions from a data file (and the add command writes
-       to it).  By default this file is $HOME/.hledger.journal (or on Windows,
-       something  like C:/Users/USER/.hledger.journal).  You can override this
-       with the $LEDGER_FILE environment variable:
-
-              $ setenv LEDGER_FILE ~/finance/2016.journal
-              $ hledger stats
-
-       or with the -f/--file option:
-
-              $ hledger -f /some/file stats
-
-       The file name - (hyphen) means standard input:
-
-              $ 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:
-
-       Reader:    Reads:                            Used for file extensions:
-       -----------------------------------------------------------------------------
-       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)
-
-       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 -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:
-
-       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.
-
-   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
-       omitted (defaulting to 1).
-
-       Examples:
-
-       2004/10/1,     2004-01-01,   exact  date, several sepa-
-       2004.9.1                     rators allowed.   Year  is
-                                    4+  digits, month is 1-12,
-                                    day is 1-31
-       2004                         start of year
-       2004/10                      start of month
-       10/1                         month and day  in  current
-                                    year
-       21                           day in current month
-       october, oct                 start  of month in current
-                                    year
-       yesterday, today, tomorrow   -1, 0, 1 days from today
-       last/this/next               -1, 0, 1 periods from  the
-       day/week/month/quar-         current period
-       ter/year
-       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-
-       sults:
-
-       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 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
-       journal data, by default.  So, the effective report start and end dates
-       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,
-       -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
-         after the last day you want to include.
-
-       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
-         smallest common time span.
-
-       Examples:
-
-       -b 2016/3/17      begin  on  St.   Patrick's
-                         day 2016
-
-
-
-
-       -e 12/1           end at the start of decem-
-                         ber  1st  of  the  current
-                         year  (11/30  will  be the
-                         last date included)
-       -b thismonth      all transactions on or af-
-                         ter the 1st of the current
-                         month
-       -p thismonth      all  transactions  in  the
-                         current month
-       date:2016/3/17-   the   above   written   as
-                         queries instead
-       date:-12/1
-       date:thismonth-
-       date:thismonth
-
-   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-
-       tervals can not be specified with a query.
-
-   Period expressions
-       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
-       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
-       "-".  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
-       also be written as:
-
-       -p "1/1 4/1"
-       -p "january-apr"
-       -p "this year to 4/1"
-
-       If you specify only one date, the missing start or end date will be the
-       earliest or latest transaction in your journal:
-
-       -p "from 2009/1/1"   everything  after  january
-                            1, 2009
-       -p "from 2009/1"     the same
-       -p "from 2009"       the same
-       -p "to 2009"         everything  before january
-                            1, 2009
-
-       A single date with no "from" or "to" defines both  the  start  and  end
-       date like so:
-
-       -p "2009"       the  year 2009; equivalent
-                       to "2009/1/1 to 2010/1/1"
-       -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
-                       to "2009/1/1 to 2009/1/2"
-
-       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
-       flags.  Between report interval and start/end dates (if any), the  word
-       in is optional.  Examples:
-
-       -p "weekly from 2009/1/1 to 2009/4/1"
-       -p "monthly in 2008"
-       -p "quarterly"
-
-       Note  that  weekly, monthly, quarterly and yearly intervals will always
-       start on the first day on week, month, quarter or year accordingly, and
-       will  end on the last day of same period, even if associated period ex-
-       pression specifies different explicit start and end date.
-
-       For example:
-
-       -p "weekly from 2009/1/1  to  2009/4/1"
-       --  starts  on 2008/12/29, closest pre-
-       ceding Monday
-       -p "monthly in 2008/11/25" -- starts on
-       2018/11/01
-       -p   "quarterly   from   2009-05-05  to
-       2009-06-01"  -  starts  on  2009/04/01,
-       ends on 2009/06/30, which are first and
-       last days of Q2 2009
-       -p "yearly from 2009-12-29" - starts on
-       2009/01/01, first day of 2009
-
-       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.
-
-       All  of  these  will start on the first day of the requested period and
-       end on the last one, as described above.
-
-       Examples:
-
-       -p "bimonthly  from  2008"  --  periods
-       will  have  boundaries  on  2008/01/01,
-       2008/03/01, ...
-       -p "every 2 weeks" -- starts on closest
-       preceding Monday
-       -p  "every 5 month from 2009/03" -- pe-
-       riods   will   have    boundaries    on
-       2009/03/01, 2009/08/01, ...
-
-       If  you want intervals that start on arbitrary day of your choosing and
-       span a week, month or year, you need to use any of the following:
-
-       every Nth day of week, every <weekday>, every Nth day [of month], every
-       Nth weekday [of month], every MM/DD [of year], every Nth MMM [of year],
-       every MMM Nth [of year].
-
-       Examples:
-
-       -p "every 2nd day of week"  --  periods
-       will go from Tue to Tue
-       -p "every Tue" -- same
-       -p  "every  15th  day" -- period bound-
-       aries will be on 15th of each month
-       -p "every 2nd Monday" -- period  bound-
-       aries  will be on second Monday of each
-       month
-
-       -p "every 11/05" -- yearly periods with
-       boundaries on 5th of Nov
-       -p "every 5th Nov" -- same
-       -p "every Nov 5th" -- same
-
-       Show  historical balances at end of 15th each month (N is exclusive end
-       date):
-
-       hledger balance -H -p "every 16th day"
-
-       Group postings from start of wednesday to end of  next  tuesday  (N  is
-       start date and exclusive end date):
-
-       hledger register checking -p "every 3rd day of week"
-
-   Depth limiting
-       With the --depth N option (short form: -N), commands like account, bal-
-       ance and register will show only the uppermost accounts in the  account
-       tree,  down to level N.  Use this when you want a summary with less de-
-       tail.  This flag has the same effect as a depth: query argument (so -2,
-       --depth=2 or depth:2 are basically equivalent).
-
-   Pivoting
-       Normally hledger sums amounts, and organizes them in a hierarchy, based
-       on account name.  The --pivot FIELD option causes it to sum  and  orga-
-       nize  hierarchy  based on the value of some other field instead.  FIELD
-       can be: code, description, payee, note, or the full name (case insensi-
-       tive) of any tag.  As with account names, values containing colon:sepa-
-       rated:parts will be displayed hierarchically in reports.
-
-       --pivot is a general option affecting all reports;  you  can  think  of
-       hledger transforming the journal before any other processing, replacing
-       every posting's account name with the value of the specified  field  on
-       that posting, inheriting it from the transaction or using a blank value
-       if it's not present.
-
-       An example:
-
-              2016/02/16 Member Fee Payment
-                  assets:bank account                    2 EUR
-                  income:member fees                    -2 EUR  ; member: John Doe
-
-       Normal balance report showing account names:
-
-              $ hledger balance
-                             2 EUR  assets:bank account
-                            -2 EUR  income:member fees
-              --------------------
-                                 0
-
-       Pivoted balance report, using member: tag values instead:
-
-              $ hledger balance --pivot member
-                             2 EUR
-                            -2 EUR  John Doe
-              --------------------
-                                 0
-
-       One way to show only amounts with a member: value (using a  query,  de-
-       scribed below):
-
-              $ hledger balance --pivot member tag:member=.
-                            -2 EUR  John Doe
-              --------------------
-                            -2 EUR
-
-       Another  way  (the  acct:  query  matches  against the pivoted "account
-       name"):
-
-              $ hledger balance --pivot member acct:.
-                            -2 EUR  John Doe
-              --------------------
-                            -2 EUR
-
-   Valuation
-   -B: Cost
-       The -B/--cost flag converts amounts to their cost (or selling price) at
-       transaction  time,  if  they  have a transaction price specified.  This
-       flag is equivalent to --value=cost, described below.
-
-   -V: Market value
-       The -V/--market flag converts reported amounts to their market value in
-       a  default  valuation commodity, using the market prices in effect on a
-       default valuation date.  For single period reports, the valuation  date
-       is  today  (equivalent  to --value=now); for multiperiod reports, it is
-       the last day of each subperiod (equivalent to --value=end).
-
-       The default valuation commodity is the one referenced in the latest ap-
-       plicable  market  price dated on or before the valuation date.  If most
-       of your P declarations lead to a single home currency, this  will  usu-
-       ally be what you want.  (To specify the commodity, see -X below.)
-
-       Note that in hledger, market prices are always declared explicitly with
-       P directives; we do not infer them from transaction  prices  as  Ledger
-       does.
-
-       Here's a quick example of -V:
-
-              ; one euro is worth this many dollars from nov 1
-              P 2016/11/01 EUR $1.10
-
-              ; purchase some euros on nov 3
-              2016/11/3
-                  assets:euros        EUR100
-                  assets:checking
-
-              ; the euro is worth fewer dollars by dec 21
-              P 2016/12/21 EUR $1.03
-
-       How many euros do I have ?
-
-              $ hledger -f t.j bal -N euros
-                              EUR100  assets:euros
-
-       What are they worth at end of nov 3 ?
-
-              $ hledger -f t.j bal -N euros -V -e 2016/11/4
-                           $110.00  assets:euros
-
-       What  are they worth after 2016/12/21 ?  (no report end date specified,
-       defaults to today)
-
-              $ hledger -f t.j bal -N euros -V
-                           $103.00  assets:euros
-
-   -X: Market value in specified commodity
-       The -X/--exchange option is like -V, except  it  specifies  the  target
-       commodity   you  would  like  to  convert  to.   It  is  equivalent  to
-       --value=now,COMM or --value=end,COMM.
-
-   --value: Flexible valuation
-       (experimental, added 201905)
-
-       -B, -V and -X are special cases of the more general --value option:
-
-               --value=TYPE[,COMM]  TYPE is cost, end, now or YYYY-MM-DD.
-                                    COMM is an optional commodity symbol.
-                                    Shows amounts converted to:
-                                    - cost commodity using transaction prices (then optionally to COMM using market prices at period end(s))
-                                    - default valuation commodity (or COMM) using market prices at period end(s)
-                                    - default valuation commodity (or COMM) using current market prices
-                                    - default valuation commodity (or COMM) using market prices at some date
-
-       The TYPE part basically selects either "cost", or "market value" plus a
-       valuation date:
-
-       --value=cost
-              Convert  amounts  to cost, using the prices recorded in transac-
-              tions.
-
-       --value=end
-              Convert amounts to their value in a default valuation commodity,
-              using  market prices on the last day of the report period (or if
-              unspecified, the journal's end date); or in multiperiod reports,
-              market prices on the last day of each subperiod.
-
-       --value=now
-              Convert  amounts  to  their value in default valuation commodity
-              using current market prices (as of when report is generated).
-
-       --value=YYYY-MM-DD
-              Convert amounts to their value in  default  valuation  commodity
-              using market prices on this date.
-
-       The  default valuation commodity is the commodity mentioned in the most
-       recent applicable market price declaration.  When all your price decla-
-       rations  lead  to a single home currency, this will usually do what you
-       want.
-
-       To select a different valuation commodity, add the optional ,COMM part:
-       a  comma,  then  the  target  commodity's symbol.  Eg: --value=now,EUR.
-       hledger will do its best to convert amounts to this commodity, using:
-
-       o declared prices (from source commodity to valuation commodity)
-
-       o reverse prices (declared prices from valuation to  source  commodity,
-         inverted)
-
-       o indirect  prices  (prices  calculated  from the shortest chain of de-
-         clared or reverse prices from source to valuation commodity)
-
-       in that order.
-
-       Here are some examples showing the  effect  of  --value  as  seen  with
-       print:
-
-              P 2000-01-01 A  1 B
-              P 2000-02-01 A  2 B
-              P 2000-03-01 A  3 B
-              P 2000-04-01 A  4 B
-
-              2000-01-01
-                (a)      1 A @ 5 B
-
-              2000-02-01
-                (a)      1 A @ 6 B
-
-              2000-03-01
-                (a)      1 A @ 7 B
-
-       Show the cost of each posting:
-
-              $ hledger -f- print --value=cost
-              2000/01/01
-                  (a)             5 B
-
-              2000/02/01
-                  (a)             6 B
-
-              2000/03/01
-                  (a)             7 B
-
-       Show the value as of the last day of the report period (2000-02-29):
-
-              $ hledger -f- print --value=end date:2000/01-2000/03
-              2000-01-01
-                  (a)             2 B
-
-              2000-02-01
-                  (a)             2 B
-
-       With  no  report  period specified, that shows the value as of the last
-       day of the journal (2000-03-01):
-
-              $ hledger -f- print --value=end
-              2000/01/01
-                  (a)             3 B
-
-              2000/02/01
-                  (a)             3 B
-
-              2000/03/01
-                  (a)             3 B
-
-       Show the current value (the 2000-04-01 price is still in effect today):
-
-              $ hledger -f- print --value=now
-              2000-01-01
-                  (a)             4 B
-
-              2000-02-01
-                  (a)             4 B
-
-              2000-03-01
-                  (a)             4 B
-
-       Show the value on 2000/01/15:
-
-              $ hledger -f- print --value=2000-01-15
-              2000/01/01
-                  (a)             1 B
-
-              2000/02/01
-                  (a)             1 B
-
-              2000/03/01
-                  (a)             1 B
-
-       You may need to explicitly set a commodity's display  style,  when  re-
-       verse prices are used.  Eg this output might be surprising:
-
-              P 2000-01-01 A 2B
-
-              2000-01-01
-                a  1B
-                b
-
-              $ hledger print -x -X A
-              2000/01/01
-                  a               0
-                  b               0
-
-       Explanation:  because there's no amount or commodity directive specify-
-       ing a display style for A, 0.5A gets the default style, which shows  no
-       decimal digits.  Because the displayed amount looks like zero, the com-
-       modity symbol and minus sign are not displayed either.  Adding  a  com-
-       modity directive sets a more useful display style for A:
-
-              P 2000-01-01 A 2B
-              commodity 0.00A
-
-              2000-01-01
-                a  1B
-                b
-
-              $ hledger print -X A
-              2000/01/01
-                  a           0.50A
-                  b          -0.50A
-
-   Effect of --value on reports
-       Here  is  a  reference  for  how --value currently affects each part of
-       hledger's reports.  It's work in progress, but may be useful for  trou-
-       bleshooting  or reporting bugs.  See also the definitions and notes be-
-       low.  If you find problems, please report them, ideally with  a  repro-
-       ducible example.  Related: #329, #1083.
-
-       Report type      -B,              -V, -X            --value=end        --value=DATE,
-                        --value=cost                                          --value=now
-       -------------------------------------------------------------------------------------
-       print
-       posting          cost             value at report   value at report    value      at
-       amounts                           end or today      or journal end     DATE/today
-       balance asser-   unchanged        unchanged         unchanged          unchanged
-       tions  /   as-
-       signments
-
-       register
-       starting  bal-   cost             value  at   day   value   at  day    value      at
-       ance (with -H)                    before   report   before   report    DATE/today
-                                         or      journal   or      journal
-                                         start             start
-       posting          cost             value at report   value at report    value      at
-       amounts    (no                    end or today      or journal end     DATE/today
-       report  inter-
-       val)
-       summary  post-   summarised       value at period   value at period    value      at
-       ing    amounts   cost             ends              ends               DATE/today
-       (with   report
-       interval)
-       running    to-   sum/average of   sum/average  of   sum/average  of    sum/average
-       tal/average      displayed val-   displayed  val-   displayed  val-    of  displayed
-                        ues              ues               ues                values
-
-       balance   (bs,
-       bse, cf, is..)
-       balances   (no   sums of costs    value at report   value at report    value      at
-       report  inter-                    end or today of   or journal  end    DATE/today of
-       val)                              sums  of  post-   of    sums   of    sums of post-
-                                         ings              postings           ings
-       balances (with   sums of costs    value at period   value at period    value      at
-       report  inter-                    ends of sums of   ends of sums of    DATE/today of
-       val)                              postings          postings           sums of post-
-                                                                              ings
-       starting  bal-   sums  of costs   sums  of  post-   sums  of  post-    sums of post-
-       ances    (with   of    postings   ings before re-   ings before re-    ings   before
-       report  inter-   before  report   port start        port start         report start
-       val and -H)      start
-       budget amounts   like balances    like balances     like balances      like balances
-       with --budget
-       grand    total   sum   of  dis-   sum   of   dis-   sum   of   dis-    sum  of  dis-
-       (no report in-   played values    played values     played values      played values
-       terval)
-
-       row totals/av-   sums/averages    sums/averages     sums/averages      sums/averages
-       erages   (with   of   displayed   of    displayed   of    displayed    of  displayed
-       report  inter-   values           values            values             values
-       val)
-       column totals    sums  of  dis-   sums   of  dis-   sums  of   dis-    sums  of dis-
-                        played values    played values     played values      played values
-       grand      to-   sum/average of   sum/average  of   sum/average  of    sum/average
-       tal/average      column totals    column totals     column totals      of column to-
-                                                                              tals
-
-
-       Additional notes
-
-       cost   calculated using price(s) recorded in the transaction(s).
-
-       value  market value using available market price declarations,  or  the
-              unchanged amount if no conversion rate can be found.
-
-       report start
-              the  first  day  of the report period specified with -b or -p or
-              date:, otherwise today.
-
-       report or journal start
-              the first day of the report period specified with -b  or  -p  or
-              date:,  otherwise  the earliest transaction date in the journal,
-              otherwise today.
-
-       report end
-              the last day of the report period specified with  -e  or  -p  or
-              date:, otherwise today.
-
-       report or journal end
-              the  last  day  of  the report period specified with -e or -p or
-              date:, otherwise the latest transaction  date  in  the  journal,
-              otherwise today.
-
-       report interval
-              a  flag (-D/-W/-M/-Q/-Y) or period expression that activates the
-              report's multi-period mode (whether showing one or many subperi-
-              ods).
-
-   Combining -B, -V, -X, --value
-       The rightmost of these flags wins.
-
-   Output destination
-       Some  commands (print, register, stats, the balance commands) can write
-       their output to a destination other than the  console.   This  is  con-
-       trolled by the -o/--output-file option.
-
-              $ hledger balance -o -     # write to stdout (the default)
-              $ hledger balance -o FILE  # write to FILE
-
-   Output format
-       Some  commands  can  write their output in other formats.  Eg print and
-       register can output CSV, and the balance commands  can  output  CSV  or
-       HTML.  This is controlled by the -O/--output-format option, or by spec-
-       ifying a .csv or .html file extension with -o/--output-file.
-
-              $ hledger balance -O csv       # write CSV to stdout
-              $ hledger balance -o FILE.csv  # write CSV to FILE.csv
-
-   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:
-         REGEX, desc:REGEX, cur:REGEX, tag:...=REGEX
-
-       o CSV rules conditional blocks: if REGEX ...
-
-       o account  alias  directives  and options: alias /REGEX/ = REPLACEMENT,
-         --alias /REGEX/=REPLACEMENT
-
-       hledger's regular expressions come from  the  regex-tdfa  library.   In
-       general they:
-
-       o are case insensitive
-
-       o are  infix  matching  (do  not  need  to match the entire thing being
-         matched)
-
-       o are POSIX extended regular expressions
-
-       o also support GNU word boundaries (\<, \>, \b, \B)
-
-       o and parenthesised capturing groups and numeric backreferences in  re-
-         placement strings
-
-       o do not support mode modifiers like (?s)
-
-       Some things to note:
-
-       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
-         with the dollar sign in hledger-web, write cur:\$.
-
-       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.
-
-QUERIES
-       One  of  hledger's strengths is being able to quickly report on precise
-       subsets of your data.  Most commands accept an optional  query  expres-
-       sion,  written  as arguments after the command name, to filter the data
-       by date, account name or other criteria.  The syntax is  similar  to  a
-       web search: one or more space-separated search terms, quotes to enclose
-       whitespace, prefixes to match specific fields, a not: prefix to  negate
-       the match.
-
-       We  do  not yet support arbitrary boolean combinations of search terms;
-       instead most commands show transactions/postings/accounts  which  match
-       (or negatively match):
-
-       o any of the description terms AND
-
-       o any of the account terms AND
-
-       o any of the status terms AND
-
-       o all the other terms.
-
-       The print command instead shows transactions which:
-
-       o match any of the description terms AND
-
-       o have any postings matching any of the positive account terms AND
-
-       o have no postings matching any of the negative account terms AND
-
-       o match all the other terms.
-
-       The  following  kinds  of search terms can be used.  Remember these can
-       also be prefixed with not:, eg to exclude a particular subaccount.
-
-       REGEX, acct:REGEX
-              match account names by this regular expression.  (With  no  pre-
-              fix, acct: is assumed.)  same as above
-
-       amt:N, amt:<N, amt:<=N, amt:>N, amt:>=N
-              match  postings with a single-commodity amount that is equal to,
-              less than, or greater than N.  (Multi-commodity amounts are  not
-              tested, and will always match.) The comparison has two modes: if
-              N is preceded by a + or - sign (or is 0), the two signed numbers
-              are  compared.  Otherwise, the absolute magnitudes are compared,
-              ignoring sign.
-
-       code:REGEX
-              match by transaction code (eg check number)
-
-       cur:REGEX
-              match postings or transactions including any amounts whose  cur-
-              rency/commodity  symbol  is fully matched by REGEX.  (For a par-
-              tial match, use .*REGEX.*).  Note, to match characters which are
-              regex-significant, like the dollar sign ($), you need to prepend
-              \.  And when using the command line you need  to  add  one  more
-              level  of  quoting  to hide it from the shell, so eg do: hledger
-              print cur:'\$' or hledger print cur:\\$.
-
-       desc:REGEX
-              match transaction descriptions.
-
-       date:PERIODEXPR
-              match dates within the specified period.  PERIODEXPR is a period
-              expression  (with  no  report  interval).   Examples: date:2016,
-              date:thismonth,  date:2000/2/1-2/15,  date:lastweek-.   If   the
-              --date2  command  line  flag  is present, this matches secondary
-              dates instead.
-
-       date2:PERIODEXPR
-              match secondary dates within the specified period.
-
-       depth:N
-              match (or display, depending on command) accounts  at  or  above
-              this depth
-
-       note:REGEX
-              match  transaction  notes  (part  of  description right of |, or
-              whole description when there's no |)
-
-       payee:REGEX
-              match transaction payee/payer names (part of description left of
-              |, or whole description when there's no |)
-
-       real:, real:0
-              match real or virtual postings respectively
-
-       status:, status:!, status:*
-              match unmarked, pending, or cleared transactions respectively
-
-       tag:REGEX[=REGEX]
-              match  by  tag  name,  and optionally also by tag value.  Note a
-              tag: query is considered to match a transaction  if  it  matches
-              any  of  the  postings.  Also remember that postings inherit the
-              tags of their parent transaction.
-
-       The following special search term is used automatically in hledger-web,
-       only:
-
-       inacct:ACCTNAME
-              tells  hledger-web to show the transaction register for this ac-
-              count.  Can be filtered further with acct etc.
-
-       Some of these can also be expressed as command-line options (eg depth:2
-       is  equivalent  to --depth 2).  Generally you can mix options and query
-       arguments, and the resulting query will be their intersection  (perhaps
-       excluding the -p/--period option).
-
-COMMANDS
-       hledger  provides  a  number  of subcommands; hledger with no arguments
-       shows a list.
-
-       If you install additional hledger-* packages, or if you put programs or
-       scripts  named  hledger-NAME in your PATH, these will also be listed as
-       subcommands.
-
-       Run a subcommand by writing its name as first argument (eg hledger  in-
-       comestatement).   You  can also write one of the standard short aliases
-       displayed in parentheses in the command list (hledger b),  or  any  any
-       unambiguous prefix of a command name (hledger inc).
-
-       Here  are  all  the  builtin  commands in alphabetical order.  See also
-       hledger for a more organised command list, and hledger CMD -h  for  de-
-       tailed command help.
-
-   accounts
-       accounts, a
-       Show account names.
-
-       This  command  lists account names, either declared with account direc-
-       tives (--declared), posted to (--used), or both  (the  default).   With
-       query  arguments,  only  matched account names and account names refer-
-       enced by matched postings are shown.  It shows a flat list by  default.
-       With  --tree,  it  uses  indentation to show the account hierarchy.  In
-       flat mode you can add --drop N to omit the first few account name  com-
-       ponents.   Account names can be depth-clipped with depth:N or --depth N
-       or -N.
-
-       Examples:
-
-              $ hledger accounts
-              assets:bank:checking
-              assets:bank:saving
-              assets:cash
-              expenses:food
-              expenses:supplies
-              income:gifts
-              income:salary
-              liabilities:debts
-
-   activity
-       activity
-       Show an ascii barchart of posting counts per interval.
-
-       The activity command displays an ascii  histogram  showing  transaction
-       counts  by  day, week, month or other reporting interval (by day is the
-       default).  With query arguments, it counts only matched transactions.
-
-       Examples:
-
-              $ hledger activity --quarterly
-              2008-01-01 **
-              2008-04-01 *******
-              2008-07-01
-              2008-10-01 **
-
-   add
-       add
-       Prompt for transactions and add them to the journal.
-
-       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.
-
-       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
-       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
-         template.
-
-       o You can also set the initial defaults with command line arguments.
-
-       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
-         empty, it will insert the default value.
-
-       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.
-
-       o Comments and tags may be entered following a description or amount.
-
-       o If  you make a mistake, enter < at any prompt to restart the transac-
-         tion.
-
-       o Input prompts are displayed in a different colour when  the  terminal
-         supports it.
-
-       Example (see the tutorial for a detailed explanation):
-
-              $ hledger add
-              Adding transactions to journal file /src/hledger/examples/sample.journal
-              Any command line arguments will be used as defaults.
-              Use tab key to complete, readline keys to edit, enter to accept defaults.
-              An optional (CODE) may follow transaction dates.
-              An optional ; COMMENT may follow descriptions or amounts.
-              If you make a mistake, enter < at any prompt to restart the transaction.
-              To end a transaction, enter . when prompted.
-              To quit, enter . at a date prompt or press control-d or control-c.
-              Date [2015/05/22]:
-              Description: supermarket
-              Account 1: expenses:food
-              Amount  1: $10
-              Account 2: assets:checking
-              Amount  2 [$-10.0]:
-              Account 3 (or . or enter to finish this transaction): .
-              2015/05/22 supermarket
-                  expenses:food             $10
-                  assets:checking        $-10.0
-
-              Save this transaction to the journal ? [y]:
-              Saved.
-              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).
-
-   balance
-       balance, bal, b
-       Show accounts and their balances.
-
-       The balance command is hledger's most versatile command.  Note, despite
-       the name, it is not always used for  showing  real-world  account  bal-
-       ances;  the  more accounting-aware balancesheet and incomestatement may
-       be more convenient for that.
-
-       By default, it displays all accounts, and each account's change in bal-
-       ance during the entire period of the journal.  Balance changes are cal-
-       culated by adding up the postings in each account.  You can  limit  the
-       postings  matched,  by  a  query, to see fewer accounts, changes over a
-       different time period, changes from only cleared transactions, etc.
-
-       If you include an account's complete history of postings in the report,
-       the  balance  change is equivalent to the account's current ending bal-
-       ance.  For a real-world account, typically you won't have all  transac-
-       tions in the journal; instead you'll have all transactions after a cer-
-       tain date, and an "opening balances" transaction  setting  the  correct
-       starting  balance  on  that  date.   Then the balance command will show
-       real-world account balances.  In some cases the -H/--historical flag is
-       used to ensure this (more below).
-
-       The balance command can produce several styles of report:
-
-   Classic balance report
-       This  is  the  original balance report, as found in Ledger.  It usually
-       looks like this:
-
-              $ hledger balance
-                               $-1  assets
-                                $1    bank:saving
-                               $-2    cash
-                                $2  expenses
-                                $1    food
-                                $1    supplies
-                               $-2  income
-                               $-1    gifts
-                               $-1    salary
-                                $1  liabilities:debts
-              --------------------
-                                 0
-
-       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.
-
-       "Boring" accounts, which contain a single interesting subaccount and no
-       balance of their own, are elided into the following line for more  com-
-       pact  output.  (Eg above, the "liabilities" account.) Use --no-elide to
-       prevent this.
-
-       Account balances are "inclusive" - they include  the  balances  of  any
-       subaccounts.
-
-       Accounts  which  have  zero  balance  (and no non-zero subaccounts) are
-       omitted.  Use -E/--empty to show them.
-
-       A final total is displayed by default; use  -N/--no-total  to  suppress
-       it, eg:
-
-              $ hledger balance -p 2008/6 expenses --no-total
-                                $2  expenses
-                                $1    food
-                                $1    supplies
-
-   Customising the classic balance report
-       You  can  customise the layout of classic balance reports with --format
-       FMT:
-
-              $ hledger balance --format "%20(account) %12(total)"
-                            assets          $-1
-                       bank:saving           $1
-                              cash          $-2
-                          expenses           $2
-                              food           $1
-                          supplies           $1
-                            income          $-2
-                             gifts          $-1
-                            salary          $-1
-                 liabilities:debts           $1
-              ---------------------------------
-                                              0
-
-       The FMT format string (plus a newline) specifies the formatting applied
-       to  each  account/balance pair.  It may contain any suitable text, with
-       data fields interpolated like so:
-
-       %[MIN][.MAX](FIELDNAME)
-
-       o MIN pads with spaces to at least this width (optional)
-
-       o MAX truncates at this width (optional)
-
-       o FIELDNAME must be enclosed in parentheses, and can be one of:
-
-         o depth_spacer - a number of spaces equal to the account's depth,  or
-           if MIN is specified, MIN * depth spaces.
-
-         o account - the account's name
-
-         o total - the account's balance/posted total, right justified
-
-       Also,  FMT  can begin with an optional prefix to control how multi-com-
-       modity amounts are rendered:
-
-       o %_ - render on multiple lines, bottom-aligned (the default)
-
-       o %^ - render on multiple lines, top-aligned
-
-       o %, - render on one line, comma-separated
-
-       There are some quirks.  Eg in one-line mode, %(depth_spacer) has no ef-
-       fect, instead %(account) has indentation built in.  Experimentation may
-       be needed to get pleasing results.
-
-       Some example formats:
-
-       o %(total) - the account's total
-
-       o %-20.20(account) - the account's name, left justified, padded  to  20
-         characters and clipped at 20 characters
-
-       o %,%-50(account)   %25(total)  - account name padded to 50 characters,
-         total padded to 20 characters, with multiple commodities rendered  on
-         one line
-
-       o %20(total)   %2(depth_spacer)%-(account) - the default format for the
-         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
-
-   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
-       this mode, you can also use --drop N to omit the first few account name
-       components.
-
-              $ hledger balance -p 2008/6 expenses -N --flat --drop 1
-                                $1  food
-                                $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
-       a complex set of accounts and get an overview.
-
-              $ hledger balance -N -1
-                               $-1  assets
-                                $2  expenses
-                               $-2  income
-                                $1  liabilities
-
-       Flat-mode balance reports, which normally show exclusive balances, show
-       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
-       obtain an overview of expenses:
-
-              $ hledger balance expenses -%
-                           100.0 %  expenses
-                            50.0 %    food
-                            50.0 %    supplies
-              --------------------
-                           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-
-       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
-       (eg hledger balance -B) all percentage values will be zero.
-
-       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-
-       terval.
-
-       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
-          for a monthly income statement:
-
-                  $ hledger balance --quarterly income expenses -E
-                  Balance changes in 2008:
-
-                                     ||  2008q1  2008q2  2008q3  2008q4
-                  ===================++=================================
-                   expenses:food     ||       0      $1       0       0
-                   expenses:supplies ||       0      $1       0       0
-                   income:gifts      ||       0     $-1       0       0
-                   income:salary     ||     $-1       0       0       0
-                  -------------------++---------------------------------
-                                     ||     $-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
-          the report start date:
-
-                  $ hledger balance --quarterly income expenses -E --cumulative
-                  Ending balances (cumulative) in 2008:
-
-                                     ||  2008/03/31  2008/06/30  2008/09/30  2008/12/31
-                  ===================++=================================================
-                   expenses:food     ||           0          $1          $1          $1
-                   expenses:supplies ||           0          $1          $1          $1
-                   income:gifts      ||           0         $-1         $-1         $-1
-                   income:salary     ||         $-1         $-1         $-1         $-1
-                  -------------------++-------------------------------------------------
-                                     ||         $-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
-          useful eg for a multi-period balance sheet, and when you are showing
-          only the data after a certain start date:
-
-                  $ hledger balance ^assets ^liabilities --quarterly --historical --begin 2008/4/1
-                  Ending balances (historical) in 2008/04/01-2008/12/31:
-
-                                        ||  2008/06/30  2008/09/30  2008/12/31
-                  ======================++=====================================
-                   assets:bank:checking ||          $1          $1           0
-                   assets:bank:saving   ||          $1          $1          $1
-                   assets:cash          ||         $-2         $-2         $-2
-                   liabilities:debts    ||           0           0          $1
-                  ----------------------++-------------------------------------
-                                        ||           0           0           0
-
-       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;
-       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
-       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:
-       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
-       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
-       row.
-
-       Here's an example of all three:
-
-              $ hledger balance -Q income expenses --tree -ETA
-              Balance changes in 2008:
-
-                          ||  2008q1  2008q2  2008q3  2008q4    Total  Average
-              ============++===================================================
-               expenses   ||       0      $2       0       0       $2       $1
-                 food     ||       0      $1       0       0       $1        0
-                 supplies ||       0      $1       0       0       $1        0
-               income     ||     $-1     $-1       0       0      $-2      $-1
-                 gifts    ||       0     $-1       0       0      $-1        0
-                 salary   ||     $-1       0       0       0      $-1        0
-              ------------++---------------------------------------------------
-                          ||     $-1      $1       0       0        0        0
-
-              # Average is rounded to the dollar here since all journal amounts are
-
-       Limitations:
-
-       In multicolumn reports the -V/--value flag uses the market price on the
-       report  end  date,  for all columns (not the price on each column's end
-       date).
-
-       Eliding of boring parent accounts in tree mode, as in the classic  bal-
-       ance report, is not yet supported in multicolumn reports.
-
-   Budget report
-       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
-       a report interval.
-
-       For  example,  you  can take average monthly expenses in the common ex-
-       pense categories to construct a minimal monthly budget:
-
-              ;; Budget
-              ~ monthly
-                income  $2000
-                expenses:food    $400
-                expenses:bus     $50
-                expenses:movies  $30
-                assets:bank:checking
-
-              ;; Two months worth of expenses
-              2017-11-01
-                income  $1950
-                expenses:food    $396
-                expenses:bus     $49
-                expenses:movies  $30
-                expenses:supplies  $20
-                assets:bank:checking
-
-              2017-12-01
-                income  $2100
-                expenses:food    $412
-                expenses:bus     $53
-                expenses:gifts   $100
-                assets:bank:checking
-
-       You can now see a monthly budget report:
-
-              $ hledger balance -M --budget
-              Budget performance in 2017/11/01-2017/12/31:
-
-                                    ||                      Nov                       Dec
-              ======================++====================================================
-               assets               || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480]
-               assets:bank          || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480]
-               assets:bank:checking || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480]
-               expenses             ||   $495 [ 103% of   $480]    $565 [ 118% of   $480]
-               expenses:bus         ||    $49 [  98% of    $50]     $53 [ 106% of    $50]
-               expenses:food        ||   $396 [  99% of   $400]    $412 [ 103% of   $400]
-               expenses:movies      ||    $30 [ 100% of    $30]       0 [   0% of    $30]
-               income               ||  $1950 [  98% of  $2000]   $2100 [ 105% of  $2000]
-              ----------------------++----------------------------------------------------
-                                    ||      0 [              0]       0 [              0]
-
-       Note this is different from a normal balance report in several ways:
-
-       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, budgeted
-         amounts are shown, along with the percentage of budget used.
-
-       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
-         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
-       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
-       ones, giving the full picture.  Eg:
-
-              $ hledger balance -M --budget --empty
-              Budget performance in 2017/11/01-2017/12/31:
-
-                                    ||                      Nov                       Dec
-              ======================++====================================================
-               assets               || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480]
-               assets:bank          || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480]
-               assets:bank:checking || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480]
-               expenses             ||   $495 [ 103% of   $480]    $565 [ 118% of   $480]
-               expenses:bus         ||    $49 [  98% of    $50]     $53 [ 106% of    $50]
-               expenses:food        ||   $396 [  99% of   $400]    $412 [ 103% of   $400]
-               expenses:gifts       ||      0                      $100
-               expenses:movies      ||    $30 [ 100% of    $30]       0 [   0% of    $30]
-               expenses:supplies    ||    $20                         0
-               income               ||  $1950 [  98% of  $2000]   $2100 [ 105% of  $2000]
-              ----------------------++----------------------------------------------------
-                                    ||      0 [              0]       0 [              0]
-
-       You can roll over unspent budgets to next period with --cumulative:
-
-              $ hledger balance -M --budget --cumulative
-              Budget performance in 2017/11/01-2017/12/31:
-
-                                    ||                      Nov                       Dec
-              ======================++====================================================
-               assets               || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960]
-               assets:bank          || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960]
-               assets:bank:checking || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960]
-               expenses             ||   $495 [ 103% of   $480]   $1060 [ 110% of   $960]
-               expenses:bus         ||    $49 [  98% of    $50]    $102 [ 102% of   $100]
-               expenses:food        ||   $396 [  99% of   $400]    $808 [ 101% of   $800]
-               expenses:movies      ||    $30 [ 100% of    $30]     $30 [  50% of    $60]
-               income               ||  $1950 [  98% of  $2000]   $4050 [ 101% of  $4000]
-              ----------------------++----------------------------------------------------
-                                    ||      0 [              0]       0 [              0]
-
-       For more examples, see Budgeting and Forecasting.
-
-   Nested budgets
-       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
-       parent, much like account balances behave.
-
-       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:
-
-              ~ monthly from 2019/01
-                  expenses:personal             $1,000.00
-                  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  implicity
-       means that budget for both expenses:personal and expenses is $1100.
-
-       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
-       only towards the budget of expenses:personal.
-
-       For example, let's consider these transactions:
-
-              ~ monthly from 2019/01
-                  expenses:personal             $1,000.00
-                  expenses:personal:electronics    $100.00
-                  liabilities
-
-              2019/01/01 Google home hub
-                  expenses:personal:electronics          $90.00
-                  liabilities                           $-90.00
-
-              2019/01/02 Phone screen protector
-                  expenses:personal:electronics:upgrades          $10.00
-                  liabilities
-
-              2019/01/02 Weekly train ticket
-                  expenses:personal:train tickets       $153.00
-                  liabilities
-
-              2019/01/03 Flowers
-                  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-
-       tions would be counted towards budgets of expenses:personal:electronics
-       and expenses:personal accordingly:
-
-              $ hledger balance --budget -M
-              Budget performance in 2019/01:
-
-                                             ||                           Jan
-              ===============================++===============================
-               expenses                      ||  $283.00 [  26% of  $1100.00]
-               expenses:personal             ||  $283.00 [  26% of  $1100.00]
-               expenses:personal:electronics ||  $100.00 [ 100% of   $100.00]
-               liabilities                   || $-283.00 [  26% of $-1100.00]
-              -------------------------------++-------------------------------
-                                             ||        0 [                 0]
-
-       And with --empty, we can get a better picture of budget allocation  and
-       consumption:
-
-              $ hledger balance --budget -M --empty
-              Budget performance in 2019/01:
-
-                                                      ||                           Jan
-              ========================================++===============================
-               expenses                               ||  $283.00 [  26% of  $1100.00]
-               expenses:personal                      ||  $283.00 [  26% of  $1100.00]
-               expenses:personal:electronics          ||  $100.00 [ 100% of   $100.00]
-               expenses:personal:electronics:upgrades ||   $10.00
-               expenses:personal:train tickets        ||  $153.00
-               liabilities                            || $-283.00 [  26% of $-1100.00]
-              ----------------------------------------++-------------------------------
-                                                      ||        0 [                 0]
-
-   Output format
-       The  balance  command supports output destination and output format se-
-       lection.
-
-   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).
-
-       Note  this  report shows all account balances with normal positive sign
-       (like conventional financial statements, unlike balance/print/register)
-       (experimental).
-
-       Example:
-
-              $ hledger balancesheet
-              Balance Sheet
-
-              Assets:
-                               $-1  assets
-                                $1    bank:saving
-                               $-2    cash
-              --------------------
-                               $-1
-
-              Liabilities:
-                                $1  liabilities:debts
-              --------------------
-                                $1
-
-              Total:
-              --------------------
-                                 0
-
-       With a reporting interval, multiple columns will be shown, one for each
-       report period.  As with multicolumn balance reports, you can alter  the
-       report  mode  with  --change/--cumulative/--historical.   Normally bal-
-       ancesheet shows historical ending balances, which is what you need  for
-       a  balance  sheet;  note  this means it ignores report begin dates (and
-       -T/--row-total, since summing end  balances  generally  does  not  make
-       sense).   Instead  of absolute values percentages can be displayed with
-       -%.
-
-       This command also supports output destination and output format  selec-
-       tion.
-
-   balancesheetequity
-       balancesheetequity, bse
-       Just  like  balancesheet,  but also reports Equity (which it assumes is
-       under a top-level equity account).
-
-       Example:
-
-              $ hledger balancesheetequity
-              Balance Sheet With Equity
-
-              Assets:
-                               $-2  assets
-                                $1    bank:saving
-                               $-3    cash
-              --------------------
-                               $-2
-
-              Liabilities:
-                                $1  liabilities:debts
-              --------------------
-                                $1
-
-              Equity:
-                        $1  equity:owner
-              --------------------
-                        $1
-
-              Total:
-              --------------------
-                                 0
-
-   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).
-
-       Example:
-
-              $ hledger cashflow
-              Cashflow Statement
-
-              Cash flows:
-                               $-1  assets
-                                $1    bank:saving
-                               $-2    cash
-              --------------------
-                               $-1
-
-              Total:
-              --------------------
-                               $-1
-
-       With a reporting interval, multiple columns will be shown, one for each
-       report period.  Normally cashflow shows changes in assets  per  period,
-       though  as  with  multicolumn  balance reports you can alter the report
-       mode with --change/--cumulative/--historical.  Instead of absolute val-
-       ues percentages can be displayed with -%.
-
-       This  command also supports output destination and output format selec-
-       tion.
-
-   check-dates
-       check-dates
-       Check that transactions are sorted by increasing date.   With  --date2,
-       checks  secondary  dates  instead.   With  --strict, dates must also be
-       unique.  With a query, only matched transactions'  dates  are  checked.
-       Reads the default journal file, or another specified with -f.
-
-   check-dupes
-       check-dupes
-       Reports  account names having the same leaf but different prefixes.  In
-       other words, two or  more  leaves  that  are  categorized  differently.
-       Reads the default journal file, or another specified as an argument.
-
-       An example: http://stefanorodighiero.net/software/hledger-dupes.html
-
-   close
-       close, equity
-       Prints  a  "closing  balances"  transaction  and  an "opening balances"
-       transaction that bring account balances to and from zero, respectively.
-       Useful for bringing asset/liability balances forward into a new journal
-       file, or for closing out revenues/expenses to retained earnings at  the
-       end of a period.
-
-       The  closing  transaction  transfers  balances  to "equity:closing bal-
-       ances", and  the  opening  transaction  transfers  balances  from  "eq-
-       uity:opening  balances", or you can customise these with the --close-to
-       and --open-from options.  You can choose  to  print  just  one  of  the
-       transactions by using the --opening or --closing flag.
-
-       If you split your journal files by time (eg yearly), you will typically
-       run this command at the end of the year, and save the closing  transac-
-       tion  as last entry of the old file, and the opening transaction as the
-       first entry of the new file.  This makes the files self  contained,  so
-       that  correct balances are reported no matter which of them are loaded.
-       Ie, if you load just one file, the balances are initialised  correctly;
-       or  if  you  load several files, the redundant closing/opening transac-
-       tions cancel each other out.  (They will show up in print  or  register
-       reports;  you  can  exclude  them  with  a  query like not:desc:'(open-
-       ing|closing) balances'.)
-
-       If you're running a business, you might also use this command to "close
-       the  books"  at  the  end  of an accounting period, transferring income
-       statement account balances to retained  earnings.   (You  may  want  to
-       change the equity account name to something like "equity:retained earn-
-       ings".)
-
-       By default, the closing transaction is dated  yesterday,  the  balances
-       are  calculated  as of end of yesterday, and the opening transaction is
-       dated today.  To close on some other date, use: hledger close -e  OPEN-
-       INGDATE.   Eg,  to  close/open  on the 2018/2019 boundary, use -e 2019.
-       You can also use -p or date:PERIOD (any starting date is ignored).
-
-       Both transactions will include balance assertions  for  the  closed/re-
-       opened accounts.  You probably shouldn't use status or realness filters
-       (like -C or -R or status:) with this command, or the generated  balance
-       assertions  will depend on these flags.  Likewise, if you run this com-
-       mand with --auto, the balance assertions will probably  always  require
-       --auto.
-
-       When  account  balances have cost information (transaction prices), the
-       closing/opening transactions will preserve it, so that  eg  balance  -B
-       reports will not be affected.
-
-       Examples:
-
-       Carrying  asset/liability  balances  into a new file for 2019, all from
-       command line:
-
-       Warning: we use >> here to append; be careful not to type  a  single  >
-       which would wipe your journal!
-
-              $ hledger close -f 2018.journal -e 2019 assets liabilities --opening >>2019.journal
-              $ hledger close -f 2018.journal -e 2019 assets liabilities --closing >>2018.journal
-
-       Now:
-
-              $ hledger bs -f 2019.journal                   # one file - balances are correct
-              $ hledger bs -f 2018.journal -f 2019.journal   # two files - balances still correct
-              $ hledger bs -f 2018.journal not:desc:closing  # to see year-end balances, must exclude closing txn
-
-       Transactions spanning the closing date can complicate matters, breaking
-       balance assertions:
-
-              2018/12/30 a purchase made in 2018, clearing the following year
-                  expenses:food          5
-                  assets:bank:checking  -5  ; [2019/1/2]
-
-       Here's one way to resolve that:
-
-              ; in 2018.journal:
-              2018/12/30 a purchase made in 2018, clearing the following year
-                  expenses:food          5
-                  liabilities:pending
-
-              ; in 2019.journal:
-              2019/1/2 clearance of last year's pending transactions
-                  liabilities:pending    5 = 0
-                  assets:checking
-
-   commodities
-       commodities
-       List all commodity/currency symbols used or declared in the journal.
-
-   descriptions
-       descriptions Show descriptions.
-
-       This command lists all descriptions that appear in transactions.
-
-       Examples:
-
-              $ hledger descriptions
-              Store Name
-              Gas Station | Petrol
-              Person A
-
-   diff
-       diff
-       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.)
-       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
-       the account balance, you can compare the bank data with your journal to
-       find out the cause.
-
-       Examples:
-
-              $ hledger diff -f $LEDGER_FILE -f bank.csv assets:bank:giro
-              These transactions are in the first file only:
-
-              2014/01/01 Opening Balances
-                  assets:bank:giro              EUR ...
-                  ...
-                  equity:opening balances       EUR -...
-
-              These transactions are in the second file only:
-
-   files
-       files
-       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
-       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
-       force a particular viewer with the --info, --man, --pager, --cat flags.
-
-       Examples:
-
-              $ hledger help
-              Please choose a manual by typing "hledger help MANUAL" (a substring is ok).
-              Manuals: hledger hledger-ui hledger-web journal csv timeclock timedot
-
-              $ hledger help h --man
-
-              hledger(1)                    hledger User Manuals                    hledger(1)
-
-              NAME
-                     hledger - a command-line accounting tool
-
-              SYNOPSIS
-                     hledger [-f FILE] COMMAND [OPTIONS] [ARGS]
-                     hledger [-f FILE] ADDONCMD -- [OPTIONS] [ARGS]
-                     hledger
-
-              DESCRIPTION
-                     hledger  is  a  cross-platform  program  for tracking money, time, or any
-              ...
-
-   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
-       FILEs' transactions as imported, without actually importing any.
-
-       The input files are specified as arguments - no need to write -f before
-       each one.  So eg to add new transactions from all CSV files to the main
-       journal, it's just: hledger import *.csv
-
-       New transactions are detected in the same way as print --new: by assum-
-       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
-       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
-       balance assignments (eg from an institution that provides only balances
-       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,
-       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 a simple income statement.  It currently assumes
-       that you have top-level accounts named income (or revenue) and  expense
-       (plural forms also allowed.)
-
-              $ hledger incomestatement
-              Income Statement
-
-              Revenues:
-                               $-2  income
-                               $-1    gifts
-                               $-1    salary
-              --------------------
-                               $-2
-
-              Expenses:
-                                $2  expenses
-                                $1    food
-                                $1    supplies
-              --------------------
-                                $2
-
-              Total:
-              --------------------
-                                 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-
-       lute values percentages can be displayed with -%.
-
-       This  command also supports output destination and output format selec-
-       tion.
-
-   notes
-       notes Show notes.
-
-       This command lists all notes that appear in transactions.
-
-       Examples:
-
-              $ hledger notes
-              Petrol
-              Snacks
-
-   payees
-       payees Show payee names.
-
-       This command lists all payee names that appear in transactions.
-
-       Examples:
-
-              $ hledger payees
-              Store Name
-              Gas Station
-              Person A
-
-   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.
-       Price amounts are always displayed with their full precision.
-
-   print
-       print, txns, p
-       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-
-       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-
-       rectives or inter-transaction comments
-
-              $ hledger print
-              2008/01/01 income
-                  assets:bank:checking            $1
-                  income:salary                  $-1
-
-              2008/06/01 gift
-                  assets:bank:checking            $1
-                  income:gifts                   $-1
-
-              2008/06/02 save
-                  assets:bank:saving              $1
-                  assets:bank:checking           $-1
-
-              2008/06/03 * eat & shop
-                  expenses:food                $1
-                  expenses:supplies            $1
-                  assets:cash                 $-2
-
-              2008/12/31 * pay off
-                  liabilities:debts               $1
-                  assets:bank:checking           $-1
-
-       Normally, the journal entry's explicit or implicit amount style is pre-
-       served.  Ie when an amount is omitted in the journal, it will be  omit-
-       ted  in  the  output.   You  can use the -x/--explicit flag to make all
-       amounts explicit, which can be useful for troubleshooting or for making
-       your journal more readable and robust against data entry errors.  Note,
-       -x will cause postings with a multi-commodity amount (these  can  arise
-       when  a  multi-commodity  transaction  has  an implicit amount) will be
-       split into multiple single-commodity postings, for valid  journal  out-
-       put.
-
-       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
-       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
-       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-
-       ordered.  See also the import command.
-
-       This  command also supports output destination and output format selec-
-       tion.  Here's an example of print's CSV output:
-
-              $ hledger print -Ocsv
-              "txnidx","date","date2","status","code","description","comment","account","amount","commodity","credit","debit","posting-status","posting-comment"
-              "1","2008/01/01","","","","income","","assets:bank:checking","1","$","","1","",""
-              "1","2008/01/01","","","","income","","income:salary","-1","$","1","","",""
-              "2","2008/06/01","","","","gift","","assets:bank:checking","1","$","","1","",""
-              "2","2008/06/01","","","","gift","","income:gifts","-1","$","1","","",""
-              "3","2008/06/02","","","","save","","assets:bank:saving","1","$","","1","",""
-              "3","2008/06/02","","","","save","","assets:bank:checking","-1","$","1","","",""
-              "4","2008/06/03","","*","","eat & shop","","expenses:food","1","$","","1","",""
-              "4","2008/06/03","","*","","eat & shop","","expenses:supplies","1","$","","1","",""
-              "4","2008/06/03","","*","","eat & shop","","assets:cash","-2","$","2","","",""
-              "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
-         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
-         order, etc.)
-
-       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
-         greater amounts under debit.)
-
-   print-unique
-       print-unique
-       Print transactions which do not reuse an already-seen description.
-
-       Example:
-
-              $ cat unique.journal
-              1/1 test
-               (acct:one)  1
-              2/2 test
-               (acct:two)  2
-              $ LEDGER_FILE=unique.journal hledger print-unique
-              (-f option not supported)
-              2015/01/01 test
-                  (acct:one)             1
-
-   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:
-
-              $ hledger register checking
-              2008/01/01 income               assets:bank:checking            $1           $1
-              2008/06/01 gift                 assets:bank:checking            $1           $2
-              2008/06/02 save                 assets:bank:checking           $-1           $1
-              2008/12/31 pay off              assets:bank:checking           $-1            0
-
-       With --date2, it shows and sorts by secondary date instead.
-
-       The --historical/-H flag adds the balance from  any  undisplayed  prior
-       postings  to  the  running  total.  This is useful when you want to see
-       only recent activity, with a historically accurate running balance:
-
-              $ hledger register checking -b 2008/6 --historical
-              2008/06/01 gift                 assets:bank:checking            $1           $2
-              2008/06/02 save                 assets:bank:checking           $-1           $1
-              2008/12/31 pay off              assets:bank:checking           $-1            0
-
-       The --depth option limits the amount of sub-account detail displayed.
-
-       The --average/-A flag shows the running average posting amount  instead
-       of the running total (so, the final number displayed is the average for
-       the whole report period).  This flag implies --empty (see  below).   It
-       is  affected  by --historical.  It works best when showing just one ac-
-       count and one commodity.
-
-       The --related/-r flag shows the other postings in the  transactions  of
-       the postings which would normally be shown.
-
-       The  --invert flag negates all amounts.  For example, it can be used on
-       an income account where amounts are normally displayed as negative num-
-       bers.   It's  also  useful to show postings on the checking account to-
-       gether with the related account:
-
-              $ hledger register --related --invert assets:checking
-
-       With a reporting interval, register shows summary postings, one per in-
-       terval, aggregating the postings to each account:
-
-              $ hledger register --monthly income
-              2008/01                 income:salary                          $-1          $-1
-              2008/06                 income:gifts                           $-1          $-2
-
-       Periods  with no activity, and summary postings with a zero amount, are
-       not shown by default; use the --empty/-E flag to see them:
-
-              $ hledger register --monthly income -E
-              2008/01                 income:salary                          $-1          $-1
-              2008/02                                                          0          $-1
-              2008/03                                                          0          $-1
-              2008/04                                                          0          $-1
-              2008/05                                                          0          $-1
-              2008/06                 income:gifts                           $-1          $-2
-              2008/07                                                          0          $-2
-              2008/08                                                          0          $-2
-              2008/09                                                          0          $-2
-              2008/10                                                          0          $-2
-              2008/11                                                          0          $-2
-              2008/12                                                          0          $-2
-
-       Often, you'll want to see just one line per interval.  The --depth  op-
-       tion helps with this, causing subaccounts to be aggregated:
-
-              $ hledger register --monthly assets --depth 1h
-              2008/01                 assets                                  $1           $1
-              2008/06                 assets                                 $-1            0
-              2008/12                 assets                                 $-1          $-1
-
-       Note  when using report intervals, if you specify start/end dates these
-       will be adjusted outward if necessary to contain a whole number of  in-
-       tervals.   This  ensures  that  the  first  and last intervals are full
-       length and comparable to the others in the report.
-
-   Custom register output
-       register uses the full terminal width by default,  except  on  windows.
-       You  can override this by setting the COLUMNS environment variable (not
-       a bash shell variable) or by using the --width/-w option.
-
-       The description and account columns normally share  the  space  equally
-       (about half of (width - 40) each).  You can adjust this by adding a de-
-       scription width as part of --width's argument, comma-separated: --width
-       W,D .  Here's a diagram (won't display correctly in --help):
-
-              <--------------------------------- width (W) ---------------------------------->
-              date (10)  description (D)       account (W-41-D)     amount (12)   balance (12)
-              DDDDDDDDDD dddddddddddddddddddd  aaaaaaaaaaaaaaaaaaa  AAAAAAAAAAAA  AAAAAAAAAAAA
-
-       and some examples:
-
-              $ hledger reg                     # use terminal width (or 80 on windows)
-              $ hledger reg -w 100              # use width 100
-              $ COLUMNS=100 hledger reg         # set with one-time environment variable
-              $ export COLUMNS=100; hledger reg # set till session end (or window resize)
-              $ hledger reg -w 100,40           # set overall width 100, description width 40
-              $ hledger reg -w $COLUMNS,40      # use terminal width, & description width 40
-
-       This  command also supports output destination and output format selec-
-       tion.
-
-   register-match
-       register-match
-       Print the one posting whose transaction description is closest to DESC,
-       in  the  style  of the register command.  If there are multiple equally
-       good matches, it shows the most recent.  Query  options  (options,  not
-       arguments)  can be used to restrict the search space.  Helps ledger-au-
-       tosync detect already-seen transactions when importing.
-
-   rewrite
-       rewrite
-       Print all transactions, rewriting the postings of matched transactions.
-       For  now  the only rewrite available is adding new postings, like print
-       --auto.
-
-       This is a start at a generic rewriter of transaction entries.  It reads
-       the  default  journal and prints the transactions, like print, but adds
-       one or more specified postings to any transactions matching QUERY.  The
-       posting  amounts can be fixed, or a multiplier of the existing transac-
-       tion's first posting amount.
-
-       Examples:
-
-              $ hledger-rewrite.hs ^income --add-posting '(liabilities:tax)  *.33  ; income tax' --add-posting '(reserve:gifts)  $100'
-              $ hledger-rewrite.hs expenses:gifts --add-posting '(reserve:gifts)  *-1"'
-              $ hledger-rewrite.hs -f rewrites.hledger
-
-       rewrites.hledger may consist of entries like:
-
-              = ^income amt:<0 date:2017
-                (liabilities:tax)  *0.33  ; tax on income
-                (reserve:grocery)  *0.25  ; reserve 25% for grocery
-                (reserve:)  *0.25  ; reserve 25% for grocery
-
-       Note the single quotes to protect the dollar sign from  bash,  and  the
-       two spaces between account and amount.
-
-       More:
-
-              $ hledger rewrite -- [QUERY]        --add-posting "ACCT  AMTEXPR" ...
-              $ hledger rewrite -- ^income        --add-posting '(liabilities:tax)  *.33'
-              $ hledger rewrite -- expenses:gifts --add-posting '(budget:gifts)  *-1"'
-              $ hledger rewrite -- ^income        --add-posting '(budget:foreign currency)  *0.25 JPY; diversify'
-
-       Argument  for  --add-posting  option  is a usual posting of transaction
-       with an exception for amount specification.  More  precisely,  you  can
-       use '*' (star symbol) before the amount to indicate that that this is a
-       factor for an amount of original matched posting.  If  the  amount  in-
-       cludes a commodity name, the new posting amount will be in the new com-
-       modity; otherwise, it will be in the matched posting  amount's  commod-
-       ity.
-
-   Re-write rules in a file
-       During  the  run  this  tool will execute so called "Automated Transac-
-       tions" found in any journal it process.  I.e instead of specifying this
-       operations in command line you can put them in a journal file.
-
-              $ rewrite-rules.journal
-
-       Make contents look like this:
-
-              = ^income
-                  (liabilities:tax)  *.33
-
-              = expenses:gifts
-                  budget:gifts  *-1
-                  assets:budget  *1
-
-       Note  that '=' (equality symbol) that is used instead of date in trans-
-       actions you usually write.  It indicates the query by which you want to
-       match the posting to add new ones.
-
-              $ hledger rewrite -- -f input.journal -f rewrite-rules.journal > rewritten-tidy-output.journal
-
-       This is something similar to the commands pipeline:
-
-              $ hledger rewrite -- -f input.journal '^income' --add-posting '(liabilities:tax)  *.33' \
-                | hledger rewrite -- -f - expenses:gifts      --add-posting 'budget:gifts  *-1'       \
-                                                              --add-posting 'assets:budget  *1'       \
-                > rewritten-tidy-output.journal
-
-       It  is  important  to understand that relative order of such entries in
-       journal is important.  You can re-use result of previously added  post-
-       ings.
-
-   Diff output format
-       To  use  this tool for batch modification of your journal files you may
-       find useful output in form of unified diff.
-
-              $ hledger rewrite -- --diff -f examples/sample.journal '^income' --add-posting '(liabilities:tax)  *.33'
-
-       Output might look like:
-
-              --- /tmp/examples/sample.journal
-              +++ /tmp/examples/sample.journal
-              @@ -18,3 +18,4 @@
-               2008/01/01 income
-              -    assets:bank:checking  $1
-              +    assets:bank:checking            $1
-                   income:salary
-              +    (liabilities:tax)                0
-              @@ -22,3 +23,4 @@
-               2008/06/01 gift
-              -    assets:bank:checking  $1
-              +    assets:bank:checking            $1
-                   income:gifts
-              +    (liabilities:tax)                0
-
-       If you'll pass this through patch tool you'll get transactions contain-
-       ing the posting that matches your query be updated.  Note that multiple
-       files might be update according to list of input  files  specified  via
-       --file options and include directives inside of these files.
-
-       Be  careful.  Whole transaction being re-formatted in a style of output
-       from hledger print.
-
-       See also:
-
-       https://github.com/simonmichael/hledger/issues/99
-
-   rewrite vs. print --auto
-       This command predates print --auto, and currently does  much  the  same
-       thing, but with these differences:
-
-       o with  multiple files, rewrite lets rules in any file affect all other
-         files.  print --auto uses standard directive  scoping;  rules  affect
-         only child files.
-
-       o rewrite's  query  limits which transactions can be rewritten; all are
-         printed.  print --auto's query limits which transactions are printed.
-
-       o rewrite applies rules specified on command line or  in  the  journal.
-         print --auto applies rules specified in the journal.
-
-   roi
-       roi
-       Shows  the  time-weighted (TWR) and money-weighted (IRR) rate of return
-       on your investments.
-
-       This command assumes that you have account(s)  that  hold  nothing  but
-       your investments and whenever you record current appraisal/valuation of
-       these investments you offset unrealized profit and loss into account(s)
-       that, again, hold nothing but unrealized profit and loss.
-
-       Any  transactions  affecting  balance  of investment account(s) and not
-       originating from unrealized profit and loss account(s) are  assumed  to
-       be your investments or withdrawals.
-
-       At  a  minimum,  you need to supply a query (which could be just an ac-
-       count name) to select your investments with --inv, and another query to
-       identify your profit and loss transactions with --pnl.
-
-       It  will  compute and display the internalized rate of return (IRR) and
-       time-weighted rate of return (TWR) for your investments  for  the  time
-       period  requested.  Both rates of return are annualized before display,
-       regardless of the length of reporting interval.
-
-   stats
-       stats
-       Show some journal statistics.
-
-       The stats command displays summary information for the  whole  journal,
-       or  a matched part of it.  With a reporting interval, it shows a report
-       for each report period.
-
-       Example:
-
-              $ hledger stats
-              Main journal file        : /src/hledger/examples/sample.journal
-              Included journal files   :
-              Transactions span        : 2008-01-01 to 2009-01-01 (366 days)
-              Last transaction         : 2008-12-31 (2333 days ago)
-              Transactions             : 5 (0.0 per day)
-              Transactions last 30 days: 0 (0.0 per day)
-              Transactions last 7 days : 0 (0.0 per day)
-              Payees/descriptions      : 5
-              Accounts                 : 8 (depth 3)
-              Commodities              : 1 ($)
-              Market prices            : 12 ($)
-
-       This command also supports output destination and output format  selec-
-       tion.
-
-   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.
-
-   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
-       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
-       as a bug!
-
-       This command also accepts tasty test runner options, written after a --
-       (double hyphen).  Eg to run only the tests in Hledger.Data.Amount, with
-       ANSI colour codes disabled:
-
-              $ hledger test -- -pData.Amount --color=never
-
-       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
-       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-
-       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
-       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
-         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;
-         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
-       options, journal parsing, reporting, etc.
-
-       Here are some hledger add-ons available:
-
-   Official add-ons
-       These are maintained and released along with hledger.
-
-   ui
-       hledger-ui provides an efficient terminal interface.
-
-   web
-       hledger-web provides a simple web interface.
-
-   Third party add-ons
-       These  are  maintained  separately, and usually updated shortly after a
-       hledger release.
-
-   diff
-       hledger-diff shows differences in an account's transactions between one
-       journal file and another.
-
-   iadd
-       hledger-iadd is a more interactive, terminal UI replacement for the add
-       command.
-
-   interest
-       hledger-interest generates interest transactions for an account accord-
-       ing to various schemes.
-
-   irr
-       hledger-irr calculates the internal rate of return of an investment ac-
-       count, but it's superseded now by the built-in roi command.
-
-   Experimental add-ons
-       These are available in source form in the hledger  repo's  bin/  direc-
-       tory.   They  may be less mature and documented than built-in commands.
-       Reading and tweaking these is a good way to start making your own!
-
-   autosync
-       hledger-autosync is a symbolic link for easily running ledger-autosync,
-       if  installed.   ledger-autosync  does  deduplicating conversion of OFX
-       data and some CSV formats, and can also download the data if your  bank
-       offers OFX Direct Connect.
-
-   chart
-       hledger-chart.hs is an old pie chart generator, in need of some love.
-
-   check
-       hledger-check.hs checks more powerful account balance assertions.
-
-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).
-
-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
-       C:/Users/USER/.hledger.journal).
-
-LIMITATIONS
-       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
-       must be configured (or there will be an unhelpful error).  Eg on POSIX,
-       set LANG to something other than C.
-
-       In a Microsoft Windows CMD window, non-ascii characters and colours are
-       not supported.
-
-       On Windows, non-ascii characters may not display correctly when running
-       a hledger built in CMD in MSYS/CYGWIN, or vice-versa.
-
-       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
-       differences.
-
-       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
-       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,
-       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
-       need to use export.  Here's an explanation.
-
-       "Illegal  byte  sequence"  or  "Invalid or incomplete multibyte or wide
-       character" errors
-       In order to handle non-ascii letters and symbols (like ), hledger needs
-       an appropriate locale.  This is usually configured system-wide; you can
-       also configure it temporarily.  The locale may need to be one that sup-
-       ports  UTF-8,  if you built hledger with GHC < 7.2 (or possibly always,
-       I'm not sure yet).
-
-       Here's  an  example  of  setting  the  locale  temporarily,  on  ubuntu
-       gnu/linux:
-
-              $ file my.journal
-              my.journal: UTF-8 Unicode text                 # <- the file is UTF8-encoded
-              $ locale -a
-              C
-              en_US.utf8                             # <- a UTF8-aware locale is available
-              POSIX
-              $ LANG=en_US.utf8 hledger -f my.journal print   # <- use it for this command
-
-       Here's one way to set it permanently, there are probably better ways:
-
-              $ echo "export LANG=en_US.UTF-8" >>~/.bash_profile
-              $ bash --login
-
-       If  we  preferred  to  use eg fr_FR.utf8, we might have to install that
-       first:
-
-              $ apt-get install language-pack-fr
-              $ locale -a
-              C
-              en_US.utf8
-              fr_BE.utf8
-              fr_CA.utf8
-              fr_CH.utf8
-              fr_FR.utf8
-              fr_LU.utf8
-              POSIX
-              $ LANG=fr_FR.utf8 hledger -f my.journal print
-
-       Note some platforms allow variant locale spellings, but not all (ubuntu
-       accepts fr_FR.UTF8, mac osx requires exactly fr_FR.UTF-8).
-
-
-
-REPORTING BUGS
-       Report  bugs at http://bugs.hledger.org (or on the #hledger IRC channel
-       or hledger mail list)
-
-
-AUTHORS
-       Simon Michael <simon@joyful.com> and contributors
-
-
-COPYRIGHT
-       Copyright (C) 2007-2019 Simon Michael.
-       Released under GNU GPL v3 or later.
-
-
-SEE ALSO
-       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)
-
-       http://hledger.org
-
-
-
-hledger 1.16.2                   January 2020                       hledger(1)
+       hledger  is  a  reliable,  cross-platform  set of programs for tracking
+       money, time, or any other commodity, using double-entry accounting  and
+       a  simple,  editable  file  format.  hledger is inspired by and largely
+       compatible with ledger(1).
+
+       This is hledger's command-line interface (there are also  terminal  and
+       web  interfaces).   Its basic function is to read a plain text file de-
+       scribing financial transactions (in accounting terms, a  general  jour-
+       nal)  and  print  useful  reports on standard output, or export them as
+       CSV.  hledger can also read some other file formats such as CSV  files,
+       translating  them to journal format.  Additionally, hledger lists other
+       hledger-* executables found in the user's $PATH and can invoke them  as
+       subcommands.
+
+       hledger  reads  data  from  one or more files in hledger journal, time-
+       clock, timedot, or CSV format specified with -f,  or  $LEDGER_FILE,  or
+       $HOME/.hledger.journal           (on          windows,          perhaps
+       C:/Users/USER/.hledger.journal).  If using $LEDGER_FILE, note this must
+       be  a real environment variable, not a shell variable.  You can specify
+       standard input with -f-.
+
+       Transactions are dated movements of money between two (or  more)  named
+       accounts, and are recorded with journal entries like this:
+
+              2015/10/16 bought food
+               expenses:food          $10
+               assets:cash
+
+       For more about this format, see hledger_journal(5).
+
+       Most  users use a text editor to edit the journal, usually with an edi-
+       tor mode such as ledger-mode for added convenience.  hledger's interac-
+       tive  add  command  is another way to record new transactions.  hledger
+       never changes existing transactions.
+
+       To get started, you can either save some  entries  like  the  above  in
+       ~/.hledger.journal,  or  run  hledger add and follow the prompts.  Then
+       try some commands like hledger print or hledger balance.   Run  hledger
+       with no arguments for a list of commands.
+
+COMMON TASKS
+       Here  are  some  quick  examples  of  how  to  do some basic tasks with
+       hledger.  For more  details,  see  the  reference  section  below,  the
+       hledger_journal(5)    manual,   or   the   more   extensive   docs   at
+       https://hledger.org.
+
+   Getting help
+              $ hledger                 # show available commands
+              $ hledger --help          # show common options
+              $ hledger CMD --help      # show common and command options, and command help
+              $ hledger help            # show available manuals/topics
+              $ hledger help hledger    # show hledger manual as info/man/text (auto-chosen)
+              $ hledger help journal --man  # show the journal manual as a man page
+              $ hledger help --help     # show more detailed help for the help command
+
+       Find   more   docs,   chat,   mail   list,   reddit,   issue   tracker:
+       https://hledger.org#help-feedback
+
+   Constructing command lines
+       hledger  has  an  extensive  and  powerful  command line interface.  We
+       strive to keep it simple and ergonomic, but you may run into one of the
+       confusing real world details described in OPTIONS, below.  If that hap-
+       pens, here are some tips that may help:
+
+       o command-specific options must go after the command (it's fine to  put
+         all options there) (hledger CMD OPTS ARGS)
+
+       o running  add-on  executables directly simplifies command line parsing
+         (hledger-ui OPTS ARGS)
+
+       o enclose "problematic" args in single quotes
+
+       o if needed, also add a backslash to hide regular expression  metachar-
+         acters from the shell
+
+       o to see how a misbehaving command is being parsed, add --debug=2.
+
+   Starting a journal file
+       hledger   looks   for   your   accounting   data  in  a  journal  file,
+       $HOME/.hledger.journal by default:
+
+              $ hledger stats
+              The hledger journal file "/Users/simon/.hledger.journal" was not found.
+              Please create it first, eg with "hledger add" or a text editor.
+              Or, specify an existing journal file with -f or LEDGER_FILE.
+
+       You can override this by setting the LEDGER_FILE environment  variable.
+       It's a good practice to keep this important file under version control,
+       and to start a new file each year.  So  you  could  do  something  like
+       this:
+
+              $ mkdir ~/finance
+              $ cd ~/finance
+              $ git init
+              Initialized empty Git repository in /Users/simon/finance/.git/
+              $ touch 2020.journal
+              $ echo "export LEDGER_FILE=$HOME/finance/2020.journal" >> ~/.bashrc
+              $ source ~/.bashrc
+              $ hledger stats
+              Main file                : /Users/simon/finance/2020.journal
+              Included files           :
+              Transactions span        :  to  (0 days)
+              Last transaction         : none
+              Transactions             : 0 (0.0 per day)
+              Transactions last 30 days: 0 (0.0 per day)
+              Transactions last 7 days : 0 (0.0 per day)
+              Payees/descriptions      : 0
+              Accounts                 : 0 (depth 0)
+              Commodities              : 0 ()
+              Market prices            : 0 ()
+
+   Setting opening balances
+       Pick  a  starting  date  for which you can look up the balances of some
+       real-world assets (bank accounts,  wallet..)  and  liabilities  (credit
+       cards..).
+
+       To  avoid  a  lot of data entry, you may want to start with just one or
+       two accounts, like your checking account or cash wallet; and pick a re-
+       cent  starting  date, like today or the start of the week.  You can al-
+       ways come back later and add more accounts and older  transactions,  eg
+       going back to january 1st.
+
+       Add  an opening balances transaction to the journal, declaring the bal-
+       ances on this date.  Here are two ways to do it:
+
+       o The first way: open the journal in any text editor and save an  entry
+         like this:
+
+                2020-01-01 * opening balances
+                    assets:bank:checking                $1000   = $1000
+                    assets:bank:savings                 $2000   = $2000
+                    assets:cash                          $100   = $100
+                    liabilities:creditcard               $-50   = $-50
+                    equity:opening/closing balances
+
+         These  are  start-of-day  balances, ie whatever was in the account at
+         the end of the previous day.
+
+         The * after the date is an  optional  status  flag.   Here  it  means
+         "cleared & confirmed".
+
+         The  currency symbols are optional, but usually a good idea as you'll
+         be dealing with multiple currencies sooner or later.
+
+         The = amounts are optional balance assertions, providing extra  error
+         checking.
+
+       o The  second  way:  run hledger add and follow the prompts to record a
+         similar transaction:
+
+                $ hledger add
+                Adding transactions to journal file /Users/simon/finance/2020.journal
+                Any command line arguments will be used as defaults.
+                Use tab key to complete, readline keys to edit, enter to accept defaults.
+                An optional (CODE) may follow transaction dates.
+                An optional ; COMMENT may follow descriptions or amounts.
+                If you make a mistake, enter < at any prompt to go one step backward.
+                To end a transaction, enter . when prompted.
+                To quit, enter . at a date prompt or press control-d or control-c.
+                Date [2020-02-07]: 2020-01-01
+                Description: * opening balances
+                Account 1: assets:bank:checking
+                Amount  1: $1000
+                Account 2: assets:bank:savings
+                Amount  2 [$-1000]: $2000
+                Account 3: assets:cash
+                Amount  3 [$-3000]: $100
+                Account 4: liabilities:creditcard
+                Amount  4 [$-3100]: $-50
+                Account 5: equity:opening/closing balances
+                Amount  5 [$-3050]:
+                Account 6 (or . or enter to finish this transaction): .
+                2020-01-01 * opening balances
+                    assets:bank:checking                      $1000
+                    assets:bank:savings                       $2000
+                    assets:cash                                $100
+                    liabilities:creditcard                     $-50
+                    equity:opening/closing balances          $-3050
+
+                Save this transaction to the journal ? [y]:
+                Saved.
+                Starting the next transaction (. or ctrl-D/ctrl-C to quit)
+                Date [2020-01-01]: .
+
+       If you're using version control, this could be a good  time  to  commit
+       the journal.  Eg:
+
+              $ git commit -m 'initial balances' 2020.journal
+
+   Recording transactions
+       As  you spend or receive money, you can record these transactions using
+       one of the methods above (text editor, hledger add)  or  by  using  the
+       hledger-iadd  or hledger-web add-ons, or by using the import command to
+       convert CSV data downloaded from your bank.
+
+       Here are some simple transactions, see  the  hledger_journal(5)  manual
+       and hledger.org for more ideas:
+
+              2020/1/10 * gift received
+                assets:cash   $20
+                income:gifts
+
+              2020.1.12 * farmers market
+                expenses:food    $13
+                assets:cash
+
+              2020-01-15 paycheck
+                income:salary
+                assets:bank:checking    $1000
+
+   Reconciling
+       Periodically  you should reconcile - compare your hledger-reported bal-
+       ances against external sources of truth, like bank statements  or  your
+       bank's  website - to be sure that your ledger accurately represents the
+       real-world balances (and, that the  real-world  institutions  have  not
+       made  a  mistake!).   This gets easy and fast with (1) practice and (2)
+       frequency.  If you do it daily, it can take 2-10 minutes.  If  you  let
+       it  pile  up, expect it to take longer as you hunt down errors and dis-
+       crepancies.
+
+       A typical workflow:
+
+       1. Reconcile cash.  Count what's in your  wallet.   Compare  with  what
+          hledger  reports  (hledger bal cash).  If they are different, try to
+          remember the missing transaction, or look for the error in  the  al-
+          ready-recorded  transactions.   A  register  report  can  be helpful
+          (hledger reg cash).  If you can't find the error, add an  adjustment
+          transaction.  Eg if you have $105 after the above, and can't explain
+          the missing $2, it could be:
+
+                  2020-01-16 * adjust cash
+                      assets:cash    $-2 = $105
+                      expenses:misc
+
+       2. Reconcile checking.  Log in to your bank's website.  Compare today's
+          (cleared) balance with hledger's cleared balance (hledger bal check-
+          ing -C).  If they are different, track down the error or record  the
+          missing  transaction(s) or add an adjustment transaction, similar to
+          the above.  Unlike the cash case, you can usually compare the trans-
+          action  history  and running balance from your bank with the one re-
+          ported by hledger reg checking -C.  This will be easier if you  gen-
+          erally  record transaction dates quite similar to your bank's clear-
+          ing dates.
+
+       3. Repeat for other asset/liability accounts.
+
+       Tip: instead of the register command, use hledger-ui to see a  live-up-
+       dating register while you edit the journal: hledger-ui --watch --regis-
+       ter checking -C
+
+       After reconciling, it could be a  good  time  to  mark  the  reconciled
+       transactions'  status  as "cleared and confirmed", if you want to track
+       that, by adding the * marker.  Eg in the  paycheck  transaction  above,
+       insert * between 2020-01-15 and paycheck
+
+       If  you're using version control, this can be another good time to com-
+       mit:
+
+              $ git commit -m 'txns' 2020.journal
+
+   Reporting
+       Here are some basic reports.
+
+       Show all transactions:
+
+              $ hledger print
+              2020-01-01 * opening balances
+                  assets:bank:checking                      $1000
+                  assets:bank:savings                       $2000
+                  assets:cash                                $100
+                  liabilities:creditcard                     $-50
+                  equity:opening/closing balances          $-3050
+
+              2020-01-10 * gift received
+                  assets:cash              $20
+                  income:gifts
+
+              2020-01-12 * farmers market
+                  expenses:food             $13
+                  assets:cash
+
+              2020-01-15 * paycheck
+                  income:salary
+                  assets:bank:checking           $1000
+
+              2020-01-16 * adjust cash
+                  assets:cash               $-2 = $105
+                  expenses:misc
+
+       Show account names, and their hierarchy:
+
+              $ hledger accounts --tree
+              assets
+                bank
+                  checking
+                  savings
+                cash
+              equity
+                opening/closing balances
+              expenses
+                food
+                misc
+              income
+                gifts
+                salary
+              liabilities
+                creditcard
+
+       Show all account totals:
+
+              $ hledger balance
+                             $4105  assets
+                             $4000    bank
+                             $2000      checking
+                             $2000      savings
+                              $105    cash
+                            $-3050  equity:opening/closing balances
+                               $15  expenses
+                               $13    food
+                                $2    misc
+                            $-1020  income
+                              $-20    gifts
+                            $-1000    salary
+                              $-50  liabilities:creditcard
+              --------------------
+                                 0
+
+       Show only asset and liability balances, as  a  flat  list,  limited  to
+       depth 2:
+
+              $ hledger bal assets liabilities --flat -2
+                             $4000  assets:bank
+                              $105  assets:cash
+                              $-50  liabilities:creditcard
+              --------------------
+                             $4055
+
+       Show  the  same  thing  without negative numbers, formatted as a simple
+       balance sheet:
+
+              $ hledger bs --flat -2
+              Balance Sheet 2020-01-16
+
+                                      || 2020-01-16
+              ========================++============
+               Assets                 ||
+              ------------------------++------------
+               assets:bank            ||      $4000
+               assets:cash            ||       $105
+              ------------------------++------------
+                                      ||      $4105
+              ========================++============
+               Liabilities            ||
+              ------------------------++------------
+               liabilities:creditcard ||        $50
+              ------------------------++------------
+                                      ||        $50
+              ========================++============
+               Net:                   ||      $4055
+
+       The final total is your "net worth" on the end date.  (Or use bse for a
+       full balance sheet with equity.)
+
+       Show income and expense totals, formatted as an income statement:
+
+              hledger is
+              Income Statement 2020-01-01-2020-01-16
+
+                             || 2020-01-01-2020-01-16
+              ===============++=======================
+               Revenues      ||
+              ---------------++-----------------------
+               income:gifts  ||                   $20
+               income:salary ||                 $1000
+              ---------------++-----------------------
+                             ||                 $1020
+              ===============++=======================
+               Expenses      ||
+              ---------------++-----------------------
+               expenses:food ||                   $13
+               expenses:misc ||                    $2
+              ---------------++-----------------------
+                             ||                   $15
+              ===============++=======================
+               Net:          ||                 $1005
+
+       The final total is your net income during this period.
+
+       Show transactions affecting your wallet, with running total:
+
+              $ hledger register cash
+              2020-01-01 opening balances     assets:cash                   $100          $100
+              2020-01-10 gift received        assets:cash                    $20          $120
+              2020-01-12 farmers market       assets:cash                   $-13          $107
+              2020-01-16 adjust cash          assets:cash                    $-2          $105
+
+       Show weekly posting counts as a bar chart:
+
+              $ hledger activity -W
+              2019-12-30 *****
+              2020-01-06 ****
+              2020-01-13 ****
+
+   Migrating to a new file
+       At  the end of the year, you may want to continue your journal in a new
+       file, so that old transactions don't slow down or clutter your reports,
+       and  to  help ensure the integrity of your accounting history.  See the
+       close command.
+
+       If using version control, don't forget to git add the new file.
+
+OPTIONS
+   General options
+       To see general usage help, including general  options  which  are  sup-
+       ported by most hledger commands, run hledger -h.
+
+       General help options:
+
+       -h --help
+              show general usage (or after COMMAND, command usage)
+
+       --version
+              show version
+
+       --debug[=N]
+              show debug output (levels 1-9, default: 1)
+
+       General input options:
+
+       -f FILE --file=FILE
+              use  a  different  input  file.   For  stdin,  use  -  (default:
+              $LEDGER_FILE or $HOME/.hledger.journal)
+
+       --rules-file=RULESFILE
+              Conversion  rules  file  to  use  when  reading  CSV   (default:
+              FILE.rules)
+
+       --separator=CHAR
+              Field separator to expect when reading CSV (default: ',')
+
+       --alias=OLD=NEW
+              rename accounts named OLD to NEW
+
+       --anon anonymize accounts and payees
+
+       --pivot FIELDNAME
+              use some other field or tag for the account name
+
+       -I --ignore-assertions
+              disable balance assertion checks (note: does not disable balance
+              assignments)
+
+       General reporting options:
+
+       -b --begin=DATE
+              include postings/txns on or after this date
+
+       -e --end=DATE
+              include postings/txns before this date
+
+       -D --daily
+              multiperiod/multicolumn report by day
+
+       -W --weekly
+              multiperiod/multicolumn report by week
+
+       -M --monthly
+              multiperiod/multicolumn report by month
+
+       -Q --quarterly
+              multiperiod/multicolumn report by quarter
+
+       -Y --yearly
+              multiperiod/multicolumn report by year
+
+       -p --period=PERIODEXP
+              set start date, end date, and/or reporting interval all at  once
+              using period expressions syntax
+
+       --date2
+              match the secondary date instead (see command help for other ef-
+              fects)
+
+       -U --unmarked
+              include only unmarked postings/txns (can combine with -P or -C)
+
+       -P --pending
+              include only pending postings/txns
+
+       -C --cleared
+              include only cleared postings/txns
+
+       -R --real
+              include only non-virtual postings
+
+       -NUM --depth=NUM
+              hide/aggregate accounts or postings more than NUM levels deep
+
+       -E --empty
+              show items with zero amount, normally hidden (and vice-versa  in
+              hledger-ui/hledger-web)
+
+       -B --cost
+              convert  amounts  to  their  cost at transaction time (using the
+              transaction price, if any)
+
+       -V --value
+              convert amounts to their market value on  the  report  end  date
+              (using the most recent applicable market price, if any)
+
+       --auto apply automated posting rules to modify transactions.
+
+       --forecast
+              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.
+
+       When a reporting option appears more than once in the command line, the
+       last one takes precedence.
+
+       Some reporting options can also be written as query arguments.
+
+   Command options
+       To see options for a particular command, including command-specific op-
+       tions, run: hledger COMMAND -h.
+
+       Command-specific  options  must  be written after the command name, eg:
+       hledger print -x.
+
+       Additionally, if the command is an addon, you may need to put  its  op-
+       tions  after  a  double-hyphen, eg: hledger ui -- --watch.  Or, you can
+       run the addon executable directly: hledger-ui --watch.
+
+   Command arguments
+       Most hledger commands accept arguments after the  command  name,  which
+       are often a query, filtering the data in some way.
+
+       You  can  save  a  set of command line options/arguments in a file, and
+       then reuse them by writing @FILENAME as a command line  argument.   Eg:
+       hledger  bal  @foo.args.   (To prevent this, eg if you have an argument
+       that begins with a literal @, precede it with --, eg:  hledger  bal  --
+       @ARG).
+
+       Inside  the  argument file, each line should contain just one option or
+       argument.  Avoid the use of spaces, except inside quotes (or you'll see
+       a  confusing  error).  Between a flag and its argument, use = (or noth-
+       ing).  Bad:
+
+              assets depth:2
+              -X USD
+
+       Good:
+
+              assets
+              depth:2
+              -X=USD
+
+       For special characters (see below), use one less level of quoting  than
+       you would at the command prompt.  Bad:
+
+              -X"$"
+
+       Good:
+
+              -X$
+
+       See also: Save frequently used options.
+
+   Queries
+       One  of  hledger's strengths is being able to quickly report on precise
+       subsets of your data.  Most commands accept an optional  query  expres-
+       sion,  written  as arguments after the command name, to filter the data
+       by date, account name or other criteria.  The syntax is  similar  to  a
+       web search: one or more space-separated search terms, quotes to enclose
+       whitespace, prefixes to match specific fields, a not: prefix to  negate
+       the match.
+
+       We  do  not yet support arbitrary boolean combinations of search terms;
+       instead most commands show transactions/postings/accounts  which  match
+       (or negatively match):
+
+       o any of the description terms AND
+
+       o any of the account terms AND
+
+       o any of the status terms AND
+
+       o all the other terms.
+
+       The print command instead shows transactions which:
+
+       o match any of the description terms AND
+
+       o have any postings matching any of the positive account terms AND
+
+       o have no postings matching any of the negative account terms AND
+
+       o match all the other terms.
+
+       The  following  kinds  of search terms can be used.  Remember these can
+       also be prefixed with not:, eg to exclude a particular subaccount.
+
+       REGEX, acct:REGEX
+              match account names by this regular expression.  (With  no  pre-
+              fix, acct: is assumed.)  same as above
+
+       amt:N, amt:<N, amt:<=N, amt:>N, amt:>=N
+              match  postings with a single-commodity amount that is equal to,
+              less than, or greater than N.  (Multi-commodity amounts are  not
+              tested, and will always match.) The comparison has two modes: if
+              N is preceded by a + or - sign (or is 0), the two signed numbers
+              are  compared.  Otherwise, the absolute magnitudes are compared,
+              ignoring sign.
+
+       code:REGEX
+              match by transaction code (eg check number)
+
+       cur:REGEX
+              match postings or transactions including any amounts whose  cur-
+              rency/commodity  symbol  is fully matched by REGEX.  (For a par-
+              tial match, use .*REGEX.*).  Note, to match characters which are
+              regex-significant, like the dollar sign ($), you need to prepend
+              \.  And when using the command line you need  to  add  one  more
+              level  of  quoting  to hide it from the shell, so eg do: hledger
+              print cur:'\$' or hledger print cur:\\$.
+
+       desc:REGEX
+              match transaction descriptions.
+
+       date:PERIODEXPR
+              match dates within the specified period.  PERIODEXPR is a period
+              expression  (with  no  report  interval).   Examples: date:2016,
+              date:thismonth,  date:2000/2/1-2/15,  date:lastweek-.   If   the
+              --date2  command  line  flag  is present, this matches secondary
+              dates instead.
+
+       date2:PERIODEXPR
+              match secondary dates within the specified period.
+
+       depth:N
+              match (or display, depending on command) accounts  at  or  above
+              this depth
+
+       note:REGEX
+              match  transaction  notes  (part  of  description right of |, or
+              whole description when there's no |)
+
+       payee:REGEX
+              match transaction payee/payer names (part of description left of
+              |, or whole description when there's no |)
+
+       real:, real:0
+              match real or virtual postings respectively
+
+       status:, status:!, status:*
+              match unmarked, pending, or cleared transactions respectively
+
+       tag:REGEX[=REGEX]
+              match  by  tag  name,  and optionally also by tag value.  Note a
+              tag: query is considered to match a transaction  if  it  matches
+              any  of  the  postings.  Also remember that postings inherit the
+              tags of their parent transaction.
+
+       The following special search term is used automatically in hledger-web,
+       only:
+
+       inacct:ACCTNAME
+              tells  hledger-web to show the transaction register for this ac-
+              count.  Can be filtered further with acct etc.
+
+       Some of these can also be expressed as command-line options (eg depth:2
+       is  equivalent  to --depth 2).  Generally you can mix options and query
+       arguments, and the resulting query will be their intersection  (perhaps
+       excluding the -p/--period option).
+
+   Special characters in arguments and queries
+       In shell command lines, option and argument values which contain "prob-
+       lematic" characters, ie spaces, and also characters significant to your
+       shell  such as <, >, (, ), | and $, should be escaped by enclosing them
+       in quotes or by writing backslashes before the characters.  Eg:
+
+       hledger  register  -p  'last  year'   "accounts   receivable   (receiv-
+       able|payable)" amt:\>100.
+
+   More escaping
+       Characters significant both to the shell and in regular expressions may
+       need one extra level of escaping.  These include parentheses, the  pipe
+       symbol and the dollar sign.  Eg, to match the dollar symbol, bash users
+       should do:
+
+       hledger balance cur:'\$'
+
+       or:
+
+       hledger balance cur:\\$
+
+   Even more escaping
+       When hledger runs an addon executable (eg you type hledger ui,  hledger
+       runs  hledger-ui),  it  de-escapes  command-line  options and arguments
+       once, so you might need to triple-escape.  Eg in bash, running  the  ui
+       command and matching the dollar sign, it's:
+
+       hledger ui cur:'\\$'
+
+       or:
+
+       hledger ui cur:\\\\$
+
+       If you asked why four slashes above, this may help:
+
+       unescaped:        $
+       escaped:          \$
+       double-escaped:   \\$
+       triple-escaped:   \\\\$
+
+       (The number of backslashes in fish shell is left as an exercise for the
+       reader.)
+
+       You can always avoid the extra escaping for addons by running the addon
+       directly:
+
+       hledger-ui cur:\\$
+
+   Less escaping
+       Inside  an  argument  file,  or  in  the  search field of hledger-ui or
+       hledger-web, or at a GHCI prompt, you need one less level  of  escaping
+       than at the command line.  And backslashes may work better than quotes.
+       Eg:
+
+       ghci> :main balance cur:\$
+
+   Unicode characters
+       hledger is expected to handle non-ascii characters correctly:
+
+       o they should be parsed correctly in input files  and  on  the  command
+         line,  by all hledger tools (add, iadd, hledger-web's search/add/edit
+         forms, etc.)
+
+       o they should be displayed correctly by  all  hledger  tools,  and  on-
+         screen alignment should be preserved.
+
+       This requires a well-configured environment.  Here are some tips:
+
+       o A  system  locale must be configured, and it must be one that can de-
+         code the characters being used.  In bash, you can set a  locale  like
+         this:  export LANG=en_US.UTF-8.  There are some more details in Trou-
+         bleshooting.  This step is essential - without it, hledger will  quit
+         on  encountering a non-ascii character (as with all GHC-compiled pro-
+         grams).
+
+       o your terminal software (eg  Terminal.app,  iTerm,  CMD.exe,  xterm..)
+         must support unicode
+
+       o the terminal must be using a font which includes the required unicode
+         glyphs
+
+       o the terminal should be configured to display wide characters as  dou-
+         ble width (for report alignment)
+
+       o on  Windows, for best results you should run hledger in the same kind
+         of environment in which it was built.  Eg hledger built in the  stan-
+         dard  CMD.EXE  environment  (like  the binaries on our download page)
+         might show display problems when run in a cygwin  or  msys  terminal,
+         and vice versa.  (See eg #961).
+
+   Input files
+       hledger reads transactions from a data file (and the add command writes
+       to it).  By default this file is $HOME/.hledger.journal (or on Windows,
+       something  like C:/Users/USER/.hledger.journal).  You can override this
+       with the $LEDGER_FILE environment variable:
+
+              $ setenv LEDGER_FILE ~/finance/2016.journal
+              $ hledger stats
+
+       or with the -f/--file option:
+
+              $ hledger -f /some/file stats
+
+       The file name - (hyphen) means standard input:
+
+              $ 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:
+
+       Reader:    Reads:                            Used for file extensions:
+       -----------------------------------------------------------------------------
+       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)
+
+       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 -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:
+
+       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.
+
+   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:
+
+              $ hledger print > foo.txt
+
+       Some commands (print, register, stats, the balance commands) also  pro-
+       vide  the  -o/--output-file  option,  which does the same thing without
+       needing the shell.  Eg:
+
+              $ hledger print -o foo.txt
+              $ hledger print -o -        # write to stdout (the default)
+
+   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:
+
+              $ hledger print -O csv
+
+       or, by a file extension specified with -o/--output-file:
+
+              $ hledger balancesheet -o foo.html   # write HTML to foo.html
+
+       The -O option can be used to override the file extension if needed:
+
+              $ hledger balancesheet -o foo.txt -O html   # write HTML to foo.txt
+
+       Some notes about JSON output:
+
+       o This  feature  is  marked  experimental,  and  not yet much used; you
+         should expect our JSON to evolve.  Real-world feedback is welcome.
+
+       o Our JSON is rather large and verbose, as it is quite a faithful  rep-
+         resentation  of  hledger's  internal  data  types.  To understand the
+         JSON,  read  the  Haskell  type  definitions,  which  are  mostly  in
+         https://github.com/simonmichael/hledger/blob/master/hledger-
+         lib/Hledger/Data/Types.hs.
+
+       o The JSON output from hledger commands is essentially the same as  the
+         JSON served by hledger-web's JSON API, but pretty printed, using line
+         breaks and indentation.  Our pretty printer has the ability to  elide
+         data  in  certain  cases  -  rendering  non-strings  as  if they were
+         strings, or displaying "FOO.." instead of FOO's full  details.   This
+         should  never  happen in hledger's JSON output; if you see otherwise,
+         please report as a bug.
+
+       o hledger represents quantities as Decimal values  storing  up  to  255
+         significant  digits,  eg  for  repeating  decimals.  Such numbers can
+         arise in practice (from automatically-calculated transaction prices),
+         and  would break most JSON consumers.  So in JSON, we show quantities
+         as simple Numbers with at most 10 decimal places.  We don't limit the
+         number  of  integer  digits, but that part is under your control.  We
+         hope this approach will not cause problems in practice; if  you  find
+         otherwise, please let us know.  (Cf #1195)
+
+   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:
+         REGEX, desc:REGEX, cur:REGEX, tag:...=REGEX
+
+       o CSV rules conditional blocks: if REGEX ...
+
+       o account alias directives and options: alias  /REGEX/  =  REPLACEMENT,
+         --alias /REGEX/=REPLACEMENT
+
+       hledger's  regular  expressions  come  from the regex-tdfa library.  In
+       general they:
+
+       o are case insensitive
+
+       o are infix matching (do not need  to  match  the  entire  thing  being
+         matched)
+
+       o are POSIX extended regular expressions
+
+       o also support GNU word boundaries (\<, \>, \b, \B)
+
+       o and  parenthesised capturing groups and numeric backreferences in re-
+         placement strings
+
+       o do not support mode modifiers like (?s)
+
+       Some things to note:
+
+       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
+         with the dollar sign in hledger-web, write cur:\$.
+
+       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
+       omitted (defaulting to 1).
+
+       Examples:
+
+       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
+       10/1                       month and day in current year
+       21                         day in current month
+       october, oct               start of month in current year
+       yesterday, today, tomor-   -1, 0, 1 days from today
+       row
+       last/this/next             -1, 0, 1 periods from the current period
+       day/week/month/quar-
+       ter/year
+       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-
+       sults:
+
+       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
+                     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
+       journal data, by default.  So, the effective report start and end dates
+       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,
+       -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
+         after the last day you want to include.
+
+       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
+         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
+                         (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
+       date:-12/1
+       date:thismonth-
+       date:thismonth
+
+   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-
+       tervals can not be specified with a query.
+
+   Period expressions
+       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
+       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
+       "-".  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
+       also be written as:
+
+       -p "1/1 4/1"
+       -p "january-apr"
+       -p "this year to 4/1"
+
+       If you specify only one date, the missing start or end date will be the
+       earliest or latest transaction in your journal:
+
+       -p "from 2009/1/1"   everything  after  january
+                            1, 2009
+       -p "from 2009/1"     the same
+       -p "from 2009"       the same
+       -p "to 2009"         everything  before january
+                            1, 2009
+
+       A single date with no "from" or "to" defines both  the  start  and  end
+       date like so:
+
+       -p "2009"       the  year 2009; equivalent
+                       to "2009/1/1 to 2010/1/1"
+       -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
+                       to "2009/1/1 to 2009/1/2"
+
+       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
+       flags.  Between report interval and start/end dates (if any), the  word
+       in is optional.  Examples:
+
+       -p "weekly from 2009/1/1 to 2009/4/1"
+       -p "monthly in 2008"
+       -p "quarterly"
+
+       Note  that  weekly, monthly, quarterly and yearly intervals will always
+       start on the first day on week, month, quarter or year accordingly, and
+       will  end on the last day of same period, even if associated period ex-
+       pression specifies different explicit start and end date.
+
+       For example:
+
+       -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,
+       2009-05-05 to 2009-06-01"   which are first and last days of Q2 2009
+       -p      "yearly      from   starts on 2009/01/01, first day of 2009
+       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.
+
+       All of these will start on the first day of the  requested  period  and
+       end on the last one, as described above.
+
+       Examples:
+
+       -p "bimonthly from 2008"    periods  will have boundaries on 2008/01/01,
+                                   2008/03/01, ...
+       -p "every 2 weeks"          starts on closest preceding Monday
+       -p "every  5  month  from   periods  will have boundaries on 2009/03/01,
+       2009/03"                    2009/08/01, ...
+
+       If you want intervals that start on arbitrary day of your choosing  and
+       span a week, month or year, you need to use any of the following:
+
+       every Nth day of week, every <weekday>, every Nth day [of month], every
+       Nth weekday [of month], every MM/DD [of year], every Nth MMM [of year],
+       every MMM Nth [of year].
+
+       Examples:
+
+       -p  "every  2nd  day  of   periods will go from Tue to Tue
+       week"
+       -p "every Tue"             same
+       -p "every 15th day"        period boundaries will  be  on  15th  of  each
+                                  month
+       -p "every 2nd Monday"      period  boundaries will be on second Monday of
+                                  each month
+       -p "every 11/05"           yearly periods with boundaries on 5th of Nov
+       -p "every 5th Nov"         same
+       -p "every Nov 5th"         same
+
+       Show historical balances at end of 15th each month (N is exclusive  end
+       date):
+
+       hledger balance -H -p "every 16th day"
+
+       Group  postings  from  start  of wednesday to end of next tuesday (N is
+       start date and exclusive end date):
+
+       hledger register checking -p "every 3rd day of week"
+
+   Depth limiting
+       With the --depth N option (short form: -N), commands like account, bal-
+       ance  and register will show only the uppermost accounts in the account
+       tree, down to level N.  Use this when you want a summary with less  de-
+       tail.  This flag has the same effect as a depth: query argument (so -2,
+       --depth=2 or depth:2 are basically equivalent).
+
+   Pivoting
+       Normally hledger sums amounts, and organizes them in a hierarchy, based
+       on  account  name.  The --pivot FIELD option causes it to sum and orga-
+       nize hierarchy based on the value of some other field  instead.   FIELD
+       can be: code, description, payee, note, or the full name (case insensi-
+       tive) of any tag.  As with account names, values containing colon:sepa-
+       rated:parts will be displayed hierarchically in reports.
+
+       --pivot  is  a  general  option affecting all reports; you can think of
+       hledger transforming the journal before any other processing, replacing
+       every  posting's  account name with the value of the specified field on
+       that posting, inheriting it from the transaction or using a blank value
+       if it's not present.
+
+       An example:
+
+              2016/02/16 Member Fee Payment
+                  assets:bank account                    2 EUR
+                  income:member fees                    -2 EUR  ; member: John Doe
+
+       Normal balance report showing account names:
+
+              $ hledger balance
+                             2 EUR  assets:bank account
+                            -2 EUR  income:member fees
+              --------------------
+                                 0
+
+       Pivoted balance report, using member: tag values instead:
+
+              $ hledger balance --pivot member
+                             2 EUR
+                            -2 EUR  John Doe
+              --------------------
+                                 0
+
+       One  way  to show only amounts with a member: value (using a query, de-
+       scribed below):
+
+              $ hledger balance --pivot member tag:member=.
+                            -2 EUR  John Doe
+              --------------------
+                            -2 EUR
+
+       Another way (the acct:  query  matches  against  the  pivoted  "account
+       name"):
+
+              $ hledger balance --pivot member acct:.
+                            -2 EUR  John Doe
+              --------------------
+                            -2 EUR
+
+   Valuation
+   -B: Cost
+       The -B/--cost flag converts amounts to their cost (or selling price) at
+       transaction time, if they have a  transaction  price  specified.   This
+       flag is equivalent to --value=cost, described below.
+
+   -V: Market value
+       The -V/--market flag converts reported amounts to their market value in
+       a default valuation commodity, using the market prices in effect  on  a
+       default  valuation date.  For single period reports, the valuation date
+       is today (equivalent to --value=now); for multiperiod  reports,  it  is
+       the last day of each subperiod (equivalent to --value=end).
+
+       The default valuation commodity is the one referenced in the latest ap-
+       plicable market price dated on or before the valuation date.   If  most
+       of  your  P declarations lead to a single home currency, this will usu-
+       ally be what you want.  (To specify the commodity, see -X below.)
+
+       Note that in hledger, market prices are always declared explicitly with
+       P  directives;  we  do not infer them from transaction prices as Ledger
+       does.
+
+       Here's a quick example of -V:
+
+              ; one euro is worth this many dollars from nov 1
+              P 2016/11/01 EUR $1.10
+
+              ; purchase some euros on nov 3
+              2016/11/3
+                  assets:euros        EUR100
+                  assets:checking
+
+              ; the euro is worth fewer dollars by dec 21
+              P 2016/12/21 EUR $1.03
+
+       How many euros do I have ?
+
+              $ hledger -f t.j bal -N euros
+                              EUR100  assets:euros
+
+       What are they worth at end of nov 3 ?
+
+              $ hledger -f t.j bal -N euros -V -e 2016/11/4
+                           $110.00  assets:euros
+
+       What are they worth after 2016/12/21 ?  (no report end date  specified,
+       defaults to today)
+
+              $ hledger -f t.j bal -N euros -V
+                           $103.00  assets:euros
+
+   -X: Market value in specified commodity
+       The  -X/--exchange  option  is  like -V, except it specifies the target
+       commodity  you  would  like  to  convert  to.   It  is  equivalent   to
+       --value=now,COMM or --value=end,COMM.
+
+   --value: Flexible valuation
+       (experimental, added 201905)
+
+       -B, -V and -X are special cases of the more general --value option:
+
+               --value=TYPE[,COMM]  TYPE is cost, then, end, now or YYYY-MM-DD.
+                                    COMM is an optional commodity symbol.
+                                    Shows amounts converted to:
+                                    - cost commodity using transaction prices (then optionally to COMM using market prices at period end(s))
+                                    - default valuation commodity (or COMM) using market prices at posting dates
+                                    - default valuation commodity (or COMM) using market prices at period end(s)
+                                    - default valuation commodity (or COMM) using current market prices
+                                    - default valuation commodity (or COMM) using market prices at some date
+
+       The TYPE part basically selects either "cost", or "market value" plus a
+       valuation date:
+
+       --value=cost
+              Convert amounts to cost, using the prices recorded  in  transac-
+              tions.
+
+       --value=then
+              Convert amounts to their value in a default valuation commodity,
+              using market prices on each posting's date.  This  is  currently
+              supported only by the print and register commands.
+
+       --value=end
+              Convert amounts to their value in a default valuation commodity,
+              using market prices on the last day of the report period (or  if
+              unspecified, the journal's end date); or in multiperiod reports,
+              market prices on the last day of each subperiod.
+
+       --value=now
+              Convert amounts to their value in  default  valuation  commodity
+              using current market prices (as of when report is generated).
+
+       --value=YYYY-MM-DD
+              Convert  amounts  to  their value in default valuation commodity
+              using market prices on this date.
+
+       The default valuation commodity is the commodity mentioned in the  most
+       recent applicable market price declaration.  When all your price decla-
+       rations lead to a single home currency, this will usually do  what  you
+       want.
+
+       To select a different valuation commodity, add the optional ,COMM part:
+       a comma, then the  target  commodity's  symbol.   Eg:  --value=now,EUR.
+       hledger will do its best to convert amounts to this commodity, using:
+
+       o declared prices (from source commodity to valuation commodity)
+
+       o reverse  prices  (declared prices from valuation to source commodity,
+         inverted)
+
+       o indirect prices (prices calculated from the  shortest  chain  of  de-
+         clared or reverse prices from source to valuation commodity)
+
+       in that order.
+
+       Here  are  some  examples  showing  the  effect of --value as seen with
+       print:
+
+              P 2000-01-01 A  1 B
+              P 2000-02-01 A  2 B
+              P 2000-03-01 A  3 B
+              P 2000-04-01 A  4 B
+
+              2000-01-01
+                (a)      1 A @ 5 B
+
+              2000-02-01
+                (a)      1 A @ 6 B
+
+              2000-03-01
+                (a)      1 A @ 7 B
+
+       Show the cost of each posting:
+
+              $ hledger -f- print --value=cost
+              2000-01-01
+                  (a)             5 B
+
+              2000-02-01
+                  (a)             6 B
+
+              2000-03-01
+                  (a)             7 B
+
+       Show the value as of the last day of the report period (2000-02-29):
+
+              $ hledger -f- print --value=end date:2000/01-2000/03
+              2000-01-01
+                  (a)             2 B
+
+              2000-02-01
+                  (a)             2 B
+
+       With no report period specified, that shows the value as  of  the  last
+       day of the journal (2000-03-01):
+
+              $ hledger -f- print --value=end
+              2000-01-01
+                  (a)             3 B
+
+              2000-02-01
+                  (a)             3 B
+
+              2000-03-01
+                  (a)             3 B
+
+       Show the current value (the 2000-04-01 price is still in effect today):
+
+              $ hledger -f- print --value=now
+              2000-01-01
+                  (a)             4 B
+
+              2000-02-01
+                  (a)             4 B
+
+              2000-03-01
+                  (a)             4 B
+
+       Show the value on 2000/01/15:
+
+              $ hledger -f- print --value=2000-01-15
+              2000-01-01
+                  (a)             1 B
+
+              2000-02-01
+                  (a)             1 B
+
+              2000-03-01
+                  (a)             1 B
+
+       You  may  need  to explicitly set a commodity's display style, when re-
+       verse prices are used.  Eg this output might be surprising:
+
+              P 2000-01-01 A 2B
+
+              2000-01-01
+                a  1B
+                b
+
+              $ hledger print -x -X A
+              2000-01-01
+                  a               0
+                  b               0
+
+       Explanation: because there's no amount or commodity directive  specify-
+       ing  a display style for A, 0.5A gets the default style, which shows no
+       decimal digits.  Because the displayed amount looks like zero, the com-
+       modity  symbol  and minus sign are not displayed either.  Adding a com-
+       modity directive sets a more useful display style for A:
+
+              P 2000-01-01 A 2B
+              commodity 0.00A
+
+              2000-01-01
+                a  1B
+                b
+
+              $ hledger print -X A
+              2000-01-01
+                  a           0.50A
+                  b          -0.50A
+
+   Effect of --value on reports
+       Here is a reference for how --value  currently  affects  each  part  of
+       hledger's  reports.  It's work in progress, but may be useful for trou-
+       bleshooting or reporting bugs.  See also the definitions and notes  be-
+       low.   If  you find problems, please report them, ideally with a repro-
+       ducible example.  Related: #329, #1083.
+
+       Report type    -B,            -V, -X         --value=then    --value=end    --value=DATE,
+                      --value=cost                                                 --value=now
+       ------------------------------------------------------------------------------------------
+
+       print
+       posting        cost           value at re-   value      at   value at re-   value      at
+       amounts                       port end  or   posting date    port      or   DATE/today
+                                     today                          journal end
+       balance  as-   unchanged      unchanged      unchanged       unchanged      unchanged
+       sertions   /
+       assignments
+
+       register
+       starting       cost           value at day   not supported   value at day   value      at
+       balance                       before   re-                   before   re-   DATE/today
+       (with -H)                     port      or                   port      or
+                                     journal                        journal
+                                     start                          start
+       posting        cost           value at re-   value      at   value at re-   value      at
+       amounts  (no                  port end  or   posting date    port      or   DATE/today
+       report   in-                  today                          journal end
+       terval)
+       summary        summarised     value at pe-   sum  of post-   value at pe-   value      at
+       posting        cost           riod ends      ings  in  in-   riod ends      DATE/today
+       amounts                                      terval,  val-
+       (with report                                 ued at inter-
+       interval)                                    val start
+       running  to-   sum/average    sum/average    sum/average     sum/average    sum/average
+       tal/average    of displayed   of displayed   of  displayed   of displayed   of  displayed
+                      values         values         values          values         values
+
+       balance (bs,
+       bse,     cf,
+       is..)
+       balances (no   sums      of   value at re-   not supported   value at re-   value      at
+       report   in-   costs          port end  or                   port      or   DATE/today of
+       terval)                       today     of                   journal  end   sums of post-
+                                     sums      of                   of  sums  of   ings
+                                     postings                       postings
+       balances       sums      of   value at pe-   not supported   value at pe-   value      at
+       (with report   costs          riod ends of                   riod ends of   DATE/today of
+       interval)                     sums      of                   sums      of   sums of post-
+                                     postings                       postings       ings
+       starting       sums      of   sums      of   not supported   sums      of   sums of post-
+       balances       costs     of   postings be-                   postings be-   ings   before
+       (with report   postings be-   fore  report                   fore  report   report start
+       interval and   fore  report   start                          start
+       -H)            start
+       budget         like    bal-   like    bal-   not supported   like    bal-   like balances
+       amounts with   ances          ances                          ances
+       --budget
+       grand  total   sum  of dis-   sum  of dis-   not supported   sum  of dis-   sum  of  dis-
+       (no   report   played  val-   played  val-                   played  val-   played values
+       interval)      ues            ues                            ues
+       row      to-   sums/aver-     sums/aver-     not supported   sums/aver-     sums/averages
+       tals/aver-     ages of dis-   ages of dis-                   ages of dis-   of  displayed
+       ages   (with   played  val-   played  val-                   played  val-   values
+       report   in-   ues            ues                            ues
+       terval)
+       column   to-   sums of dis-   sums of dis-   not supported   sums of dis-   sums of  dis-
+       tals           played  val-   played  val-                   played  val-   played values
+                      ues            ues                            ues
+       grand    to-   sum/average    sum/average    not supported   sum/average    sum/average
+       tal/average    of    column   of    column                   of    column   of column to-
+                      totals         totals                         totals         tals
+
+
+       Additional notes
+
+       cost   calculated using price(s) recorded in the transaction(s).
+
+       value  market value using available market price declarations,  or  the
+              unchanged amount if no conversion rate can be found.
+
+       report start
+              the  first  day  of the report period specified with -b or -p or
+              date:, otherwise today.
+
+       report or journal start
+              the first day of the report period specified with -b  or  -p  or
+              date:,  otherwise  the earliest transaction date in the journal,
+              otherwise today.
+
+       report end
+              the last day of the report period specified with  -e  or  -p  or
+              date:, otherwise today.
+
+       report or journal end
+              the  last  day  of  the report period specified with -e or -p or
+              date:, otherwise the latest transaction  date  in  the  journal,
+              otherwise today.
+
+       report interval
+              a  flag (-D/-W/-M/-Q/-Y) or period expression that activates the
+              report's multi-period mode (whether showing one or many subperi-
+              ods).
+
+   Combining -B, -V, -X, --value
+       The rightmost of these flags wins.
+
+COMMANDS
+       hledger  provides  a  number  of subcommands; hledger with no arguments
+       shows a list.
+
+       If you install additional hledger-* packages, or if you put programs or
+       scripts  named  hledger-NAME in your PATH, these will also be listed as
+       subcommands.
+
+       Run a subcommand by writing its name as first argument (eg hledger  in-
+       comestatement).   You  can also write one of the standard short aliases
+       displayed in parentheses in the command list (hledger b),  or  any  any
+       unambiguous prefix of a command name (hledger inc).
+
+       Here  are  all  the  builtin  commands in alphabetical order.  See also
+       hledger for a more organised command list, and hledger CMD -h  for  de-
+       tailed command help.
+
+   accounts
+       accounts, a
+       Show account names.
+
+       This  command  lists account names, either declared with account direc-
+       tives (--declared), posted to (--used), or both  (the  default).   With
+       query  arguments,  only  matched account names and account names refer-
+       enced by matched postings are shown.  It shows a flat list by  default.
+       With  --tree,  it  uses  indentation to show the account hierarchy.  In
+       flat mode you can add --drop N to omit the first few account name  com-
+       ponents.   Account names can be depth-clipped with depth:N or --depth N
+       or -N.
+
+       Examples:
+
+              $ hledger accounts
+              assets:bank:checking
+              assets:bank:saving
+              assets:cash
+              expenses:food
+              expenses:supplies
+              income:gifts
+              income:salary
+              liabilities:debts
+
+   activity
+       activity
+       Show an ascii barchart of posting counts per interval.
+
+       The activity command displays an ascii  histogram  showing  transaction
+       counts  by  day, week, month or other reporting interval (by day is the
+       default).  With query arguments, it counts only matched transactions.
+
+       Examples:
+
+              $ hledger activity --quarterly
+              2008-01-01 **
+              2008-04-01 *******
+              2008-07-01
+              2008-10-01 **
+
+   add
+       add
+       Prompt for transactions and add them to the journal.
+
+       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.
+
+       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
+       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
+         template.
+
+       o You can also set the initial defaults with command line arguments.
+
+       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
+         empty, it will insert the default value.
+
+       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.
+
+       o Comments and tags may be entered following a description or amount.
+
+       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
+         supports it.
+
+       Example (see the tutorial for a detailed explanation):
+
+              $ hledger add
+              Adding transactions to journal file /src/hledger/examples/sample.journal
+              Any command line arguments will be used as defaults.
+              Use tab key to complete, readline keys to edit, enter to accept defaults.
+              An optional (CODE) may follow transaction dates.
+              An optional ; COMMENT may follow descriptions or amounts.
+              If you make a mistake, enter < at any prompt to go one step backward.
+              To end a transaction, enter . when prompted.
+              To quit, enter . at a date prompt or press control-d or control-c.
+              Date [2015/05/22]:
+              Description: supermarket
+              Account 1: expenses:food
+              Amount  1: $10
+              Account 2: assets:checking
+              Amount  2 [$-10.0]:
+              Account 3 (or . or enter to finish this transaction): .
+              2015/05/22 supermarket
+                  expenses:food             $10
+                  assets:checking        $-10.0
+
+              Save this transaction to the journal ? [y]:
+              Saved.
+              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).
+
+   balance
+       balance, bal, b
+       Show accounts and their balances.
+
+       The balance command is hledger's most versatile command.  Note, despite
+       the  name,  it  is  not always used for showing real-world account bal-
+       ances; the more accounting-aware balancesheet and  incomestatement  may
+       be more convenient for that.
+
+       By default, it displays all accounts, and each account's change in bal-
+       ance during the entire period of the journal.  Balance changes are cal-
+       culated  by  adding up the postings in each account.  You can limit the
+       postings matched, by a query, to see fewer  accounts,  changes  over  a
+       different time period, changes from only cleared transactions, etc.
+
+       If you include an account's complete history of postings in the report,
+       the balance change is equivalent to the account's current  ending  bal-
+       ance.   For a real-world account, typically you won't have all transac-
+       tions in the journal; instead you'll have all transactions after a cer-
+       tain  date,  and  an "opening balances" transaction setting the correct
+       starting balance on that date.  Then  the  balance  command  will  show
+       real-world account balances.  In some cases the -H/--historical flag is
+       used to ensure this (more below).
+
+       The balance command can produce several styles of report:
+
+   Classic balance report
+       This is the original balance report, as found in  Ledger.   It  usually
+       looks like this:
+
+              $ hledger balance
+                               $-1  assets
+                                $1    bank:saving
+                               $-2    cash
+                                $2  expenses
+                                $1    food
+                                $1    supplies
+                               $-2  income
+                               $-1    gifts
+                               $-1    salary
+                                $1  liabilities:debts
+              --------------------
+                                 0
+
+       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.
+
+       "Boring" accounts, which contain a single interesting subaccount and no
+       balance  of their own, are elided into the following line for more com-
+       pact output.  (Eg above, the "liabilities" account.) Use --no-elide  to
+       prevent this.
+
+       Account  balances  are  "inclusive"  - they include the balances of any
+       subaccounts.
+
+       Accounts which have zero balance  (and  no  non-zero  subaccounts)  are
+       omitted.  Use -E/--empty to show them.
+
+       A  final  total  is displayed by default; use -N/--no-total to suppress
+       it, eg:
+
+              $ hledger balance -p 2008/6 expenses --no-total
+                                $2  expenses
+                                $1    food
+                                $1    supplies
+
+   Customising the classic balance report
+       You can customise the layout of classic balance reports  with  --format
+       FMT:
+
+              $ hledger balance --format "%20(account) %12(total)"
+                            assets          $-1
+                       bank:saving           $1
+                              cash          $-2
+                          expenses           $2
+                              food           $1
+                          supplies           $1
+                            income          $-2
+                             gifts          $-1
+                            salary          $-1
+                 liabilities:debts           $1
+              ---------------------------------
+                                              0
+
+       The FMT format string (plus a newline) specifies the formatting applied
+       to each account/balance pair.  It may contain any suitable  text,  with
+       data fields interpolated like so:
+
+       %[MIN][.MAX](FIELDNAME)
+
+       o MIN pads with spaces to at least this width (optional)
+
+       o MAX truncates at this width (optional)
+
+       o FIELDNAME must be enclosed in parentheses, and can be one of:
+
+         o depth_spacer  - a number of spaces equal to the account's depth, or
+           if MIN is specified, MIN * depth spaces.
+
+         o account - the account's name
+
+         o total - the account's balance/posted total, right justified
+
+       Also, FMT can begin with an optional prefix to control  how  multi-com-
+       modity amounts are rendered:
+
+       o %_ - render on multiple lines, bottom-aligned (the default)
+
+       o %^ - render on multiple lines, top-aligned
+
+       o %, - render on one line, comma-separated
+
+       There are some quirks.  Eg in one-line mode, %(depth_spacer) has no ef-
+       fect, instead %(account) has indentation built in.  Experimentation may
+       be needed to get pleasing results.
+
+       Some example formats:
+
+       o %(total) - the account's total
+
+       o %-20.20(account)  -  the account's name, left justified, padded to 20
+         characters and clipped at 20 characters
+
+       o %,%-50(account)  %25(total) - account name padded to  50  characters,
+         total  padded to 20 characters, with multiple commodities rendered on
+         one line
+
+       o %20(total)  %2(depth_spacer)%-(account) - the default format for  the
+         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
+
+   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
+       this mode, you can also use --drop N to omit the first few account name
+       components.
+
+              $ hledger balance -p 2008/6 expenses -N --flat --drop 1
+                                $1  food
+                                $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
+       a complex set of accounts and get an overview.
+
+              $ hledger balance -N -1
+                               $-1  assets
+                                $2  expenses
+                               $-2  income
+                                $1  liabilities
+
+       Flat-mode balance reports, which normally show exclusive balances, show
+       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
+       obtain an overview of expenses:
+
+              $ hledger balance expenses -%
+                           100.0 %  expenses
+                            50.0 %    food
+                            50.0 %    supplies
+              --------------------
+                           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-
+       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
+       (eg hledger balance -B) all percentage values will be zero.
+
+       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-
+       terval.
+
+       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
+          for a monthly income statement:
+
+                  $ hledger balance --quarterly income expenses -E
+                  Balance changes in 2008:
+
+                                     ||  2008q1  2008q2  2008q3  2008q4
+                  ===================++=================================
+                   expenses:food     ||       0      $1       0       0
+                   expenses:supplies ||       0      $1       0       0
+                   income:gifts      ||       0     $-1       0       0
+                   income:salary     ||     $-1       0       0       0
+                  -------------------++---------------------------------
+                                     ||     $-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
+          the report start date:
+
+                  $ hledger balance --quarterly income expenses -E --cumulative
+                  Ending balances (cumulative) in 2008:
+
+                                     ||  2008/03/31  2008/06/30  2008/09/30  2008/12/31
+                  ===================++=================================================
+                   expenses:food     ||           0          $1          $1          $1
+                   expenses:supplies ||           0          $1          $1          $1
+                   income:gifts      ||           0         $-1         $-1         $-1
+                   income:salary     ||         $-1         $-1         $-1         $-1
+                  -------------------++-------------------------------------------------
+                                     ||         $-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
+          useful eg for a multi-period balance sheet, and when you are showing
+          only the data after a certain start date:
+
+                  $ hledger balance ^assets ^liabilities --quarterly --historical --begin 2008/4/1
+                  Ending balances (historical) in 2008/04/01-2008/12/31:
+
+                                        ||  2008/06/30  2008/09/30  2008/12/31
+                  ======================++=====================================
+                   assets:bank:checking ||          $1          $1           0
+                   assets:bank:saving   ||          $1          $1          $1
+                   assets:cash          ||         $-2         $-2         $-2
+                   liabilities:debts    ||           0           0          $1
+                  ----------------------++-------------------------------------
+                                        ||           0           0           0
+
+       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;
+       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
+       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:
+       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
+       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
+       row.
+
+       Here's an example of all three:
+
+              $ hledger balance -Q income expenses --tree -ETA
+              Balance changes in 2008:
+
+                          ||  2008q1  2008q2  2008q3  2008q4    Total  Average
+              ============++===================================================
+               expenses   ||       0      $2       0       0       $2       $1
+                 food     ||       0      $1       0       0       $1        0
+                 supplies ||       0      $1       0       0       $1        0
+               income     ||     $-1     $-1       0       0      $-2      $-1
+                 gifts    ||       0     $-1       0       0      $-1        0
+                 salary   ||     $-1       0       0       0      $-1        0
+              ------------++---------------------------------------------------
+                          ||     $-1      $1       0       0        0        0
+
+              (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.
+
+   Budget report
+       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
+       a report interval.
+
+       For example, you can take average monthly expenses in  the  common  ex-
+       pense categories to construct a minimal monthly budget:
+
+              ;; Budget
+              ~ monthly
+                income  $2000
+                expenses:food    $400
+                expenses:bus     $50
+                expenses:movies  $30
+                assets:bank:checking
+
+              ;; Two months worth of expenses
+              2017-11-01
+                income  $1950
+                expenses:food    $396
+                expenses:bus     $49
+                expenses:movies  $30
+                expenses:supplies  $20
+                assets:bank:checking
+
+              2017-12-01
+                income  $2100
+                expenses:food    $412
+                expenses:bus     $53
+                expenses:gifts   $100
+                assets:bank:checking
+
+       You can now see a monthly budget report:
+
+              $ hledger balance -M --budget
+              Budget performance in 2017/11/01-2017/12/31:
+
+                                    ||                      Nov                       Dec
+              ======================++====================================================
+               assets               || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480]
+               assets:bank          || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480]
+               assets:bank:checking || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480]
+               expenses             ||   $495 [ 103% of   $480]    $565 [ 118% of   $480]
+               expenses:bus         ||    $49 [  98% of    $50]     $53 [ 106% of    $50]
+               expenses:food        ||   $396 [  99% of   $400]    $412 [ 103% of   $400]
+               expenses:movies      ||    $30 [ 100% of    $30]       0 [   0% of    $30]
+               income               ||  $1950 [  98% of  $2000]   $2100 [ 105% of  $2000]
+              ----------------------++----------------------------------------------------
+                                    ||      0 [              0]       0 [              0]
+
+       Note this is different from a normal balance report in several ways:
+
+       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,  budgeted
+         amounts are shown, along with the percentage of budget used.
+
+       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
+         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
+       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
+       ones, giving the full picture.  Eg:
+
+              $ hledger balance -M --budget --empty
+              Budget performance in 2017/11/01-2017/12/31:
+
+                                    ||                      Nov                       Dec
+              ======================++====================================================
+               assets               || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480]
+               assets:bank          || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480]
+               assets:bank:checking || $-2445 [  99% of $-2480]  $-2665 [ 107% of $-2480]
+               expenses             ||   $495 [ 103% of   $480]    $565 [ 118% of   $480]
+               expenses:bus         ||    $49 [  98% of    $50]     $53 [ 106% of    $50]
+               expenses:food        ||   $396 [  99% of   $400]    $412 [ 103% of   $400]
+               expenses:gifts       ||      0                      $100
+               expenses:movies      ||    $30 [ 100% of    $30]       0 [   0% of    $30]
+               expenses:supplies    ||    $20                         0
+               income               ||  $1950 [  98% of  $2000]   $2100 [ 105% of  $2000]
+              ----------------------++----------------------------------------------------
+                                    ||      0 [              0]       0 [              0]
+
+       You can roll over unspent budgets to next period with --cumulative:
+
+              $ hledger balance -M --budget --cumulative
+              Budget performance in 2017/11/01-2017/12/31:
+
+                                    ||                      Nov                       Dec
+              ======================++====================================================
+               assets               || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960]
+               assets:bank          || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960]
+               assets:bank:checking || $-2445 [  99% of $-2480]  $-5110 [ 103% of $-4960]
+               expenses             ||   $495 [ 103% of   $480]   $1060 [ 110% of   $960]
+               expenses:bus         ||    $49 [  98% of    $50]    $102 [ 102% of   $100]
+               expenses:food        ||   $396 [  99% of   $400]    $808 [ 101% of   $800]
+               expenses:movies      ||    $30 [ 100% of    $30]     $30 [  50% of    $60]
+               income               ||  $1950 [  98% of  $2000]   $4050 [ 101% of  $4000]
+              ----------------------++----------------------------------------------------
+                                    ||      0 [              0]       0 [              0]
+
+       For more examples, see Budgeting and Forecasting.
+
+   Nested budgets
+       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
+       parent, much like account balances behave.
+
+       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:
+
+              ~ monthly from 2019/01
+                  expenses:personal             $1,000.00
+                  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
+       means that budget for both expenses:personal and expenses is $1100.
+
+       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
+       only towards the budget of expenses:personal.
+
+       For example, let's consider these transactions:
+
+              ~ monthly from 2019/01
+                  expenses:personal             $1,000.00
+                  expenses:personal:electronics    $100.00
+                  liabilities
+
+              2019/01/01 Google home hub
+                  expenses:personal:electronics          $90.00
+                  liabilities                           $-90.00
+
+              2019/01/02 Phone screen protector
+                  expenses:personal:electronics:upgrades          $10.00
+                  liabilities
+
+              2019/01/02 Weekly train ticket
+                  expenses:personal:train tickets       $153.00
+                  liabilities
+
+              2019/01/03 Flowers
+                  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-
+       tions would be counted towards budgets of expenses:personal:electronics
+       and expenses:personal accordingly:
+
+              $ hledger balance --budget -M
+              Budget performance in 2019/01:
+
+                                             ||                           Jan
+              ===============================++===============================
+               expenses                      ||  $283.00 [  26% of  $1100.00]
+               expenses:personal             ||  $283.00 [  26% of  $1100.00]
+               expenses:personal:electronics ||  $100.00 [ 100% of   $100.00]
+               liabilities                   || $-283.00 [  26% of $-1100.00]
+              -------------------------------++-------------------------------
+                                             ||        0 [                 0]
+
+       And  with --empty, we can get a better picture of budget allocation and
+       consumption:
+
+              $ hledger balance --budget -M --empty
+              Budget performance in 2019/01:
+
+                                                      ||                           Jan
+              ========================================++===============================
+               expenses                               ||  $283.00 [  26% of  $1100.00]
+               expenses:personal                      ||  $283.00 [  26% of  $1100.00]
+               expenses:personal:electronics          ||  $100.00 [ 100% of   $100.00]
+               expenses:personal:electronics:upgrades ||   $10.00
+               expenses:personal:train tickets        ||  $153.00
+               liabilities                            || $-283.00 [  26% of $-1100.00]
+              ----------------------------------------++-------------------------------
+                                                      ||        0 [                 0]
+
+   Output format
+       This command also supports the output destination and output format op-
+       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).
+
+       Note  this  report shows all account balances with normal positive sign
+       (like conventional financial statements, unlike balance/print/register)
+       (experimental).
+
+       Example:
+
+              $ hledger balancesheet
+              Balance Sheet
+
+              Assets:
+                               $-1  assets
+                                $1    bank:saving
+                               $-2    cash
+              --------------------
+                               $-1
+
+              Liabilities:
+                                $1  liabilities:debts
+              --------------------
+                                $1
+
+              Total:
+              --------------------
+                                 0
+
+       With a reporting interval, multiple columns will be shown, one for each
+       report period.  As with multicolumn balance reports, you can alter  the
+       report  mode  with  --change/--cumulative/--historical.   Normally bal-
+       ancesheet shows historical ending balances, which is what you need  for
+       a  balance  sheet;  note  this means it ignores report begin dates (and
+       -T/--row-total, since summing end  balances  generally  does  not  make
+       sense).   Instead  of absolute 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-
+       tal) json.
+
+   balancesheetequity
+       balancesheetequity, bse
+       Just like balancesheet, but also reports Equity (which  it  assumes  is
+       under a top-level equity account).
+
+       Example:
+
+              $ hledger balancesheetequity
+              Balance Sheet With Equity
+
+              Assets:
+                               $-2  assets
+                                $1    bank:saving
+                               $-3    cash
+              --------------------
+                               $-2
+
+              Liabilities:
+                                $1  liabilities:debts
+              --------------------
+                                $1
+
+              Equity:
+                        $1  equity:owner
+              --------------------
+                        $1
+
+              Total:
+              --------------------
+                                 0
+
+       This command also supports the output destination and output format op-
+       tions The output formats supported are txt, csv, html, and  (experimen-
+       tal) json.
+
+   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).
+
+       Example:
+
+              $ hledger cashflow
+              Cashflow Statement
+
+              Cash flows:
+                               $-1  assets
+                                $1    bank:saving
+                               $-2    cash
+              --------------------
+                               $-1
+
+              Total:
+              --------------------
+                               $-1
+
+       With a reporting interval, multiple columns will be shown, one for each
+       report  period.   Normally cashflow shows changes in assets per period,
+       though as with multicolumn balance reports you  can  alter  the  report
+       mode with --change/--cumulative/--historical.  Instead of absolute val-
+       ues 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-
+       tal) json.
+
+   check-dates
+       check-dates
+       Check that transactions are sorted by increasing date.   With  --date2,
+       checks  secondary  dates  instead.   With  --strict, dates must also be
+       unique.  With a query, only matched transactions'  dates  are  checked.
+       Reads the default journal file, or another specified with -f.
+
+   check-dupes
+       check-dupes
+       Reports  account names having the same leaf but different prefixes.  In
+       other words, two or  more  leaves  that  are  categorized  differently.
+       Reads the default journal file, or another specified as an argument.
+
+       An example: http://stefanorodighiero.net/software/hledger-dupes.html
+
+   close
+       close, equity
+       Prints  a  "closing  balances"  transaction  and  an "opening balances"
+       transaction that bring account balances to and from zero, respectively.
+       These can be added to your journal file(s), eg to bring asset/liability
+       balances forward into a new journal file, or to close out  revenues/ex-
+       penses to retained earnings at the end of a period.
+
+       You  can  print  just one of these transactions by using the --close or
+       --open flag.  You can customise their descriptions  with  the  --close-
+       desc and --open-desc options.
+
+       One amountless posting to "equity:opening/closing balances" is added to
+       balance the transactions, by default.  You can customise  this  account
+       name  with  --close-acct  and  --open-acct;  if you specify only one of
+       these, it will be used for both.
+
+       With --x/--explicit, the equity posting's amount will be shown.  And if
+       it  involves multiple commodities, a posting for each commodity will be
+       shown, as with the print command.
+
+       With --interleaved, the equity postings are shown next to the  postings
+       they balance, which makes troubleshooting easier.
+
+       By default, transaction prices in the journal are ignored when generat-
+       ing the closing/opening transactions.  With --show-costs, this cost in-
+       formation  is preserved (balance -B reports will be unchanged after the
+       transition).  Separate postings are generated for  each  cost  in  each
+       commodity.   Note  this can generate very large journal entries, if you
+       have many foreign currency or investment transactions.
+
+   close usage
+       If you split your journal files by time (eg yearly), you will typically
+       run  this command at the end of the year, and save the closing transac-
+       tion as last entry of the old file, and the opening transaction as  the
+       first  entry  of the new file.  This makes the files self contained, so
+       that correct balances are reported no matter which of them are  loaded.
+       Ie,  if you load just one file, the balances are initialised correctly;
+       or if you load several files, the  redundant  closing/opening  transac-
+       tions  cancel  each other out.  (They will show up in print or register
+       reports; you can  exclude  them  with  a  query  like  not:desc:'(open-
+       ing|closing) balances'.)
+
+       If you're running a business, you might also use this command to "close
+       the books" at the end of  an  accounting  period,  transferring  income
+       statement  account  balances  to  retained  earnings.  (You may want to
+       change the equity account name to something like "equity:retained earn-
+       ings".)
+
+       By  default,  the  closing transaction is dated yesterday, the balances
+       are calculated as of end of yesterday, and the opening  transaction  is
+       dated  today.  To close on some other date, use: hledger close -e OPEN-
+       INGDATE.  Eg, to close/open on the 2018/2019  boundary,  use  -e  2019.
+       You can also use -p or date:PERIOD (any starting date is ignored).
+
+       Both  transactions  will  include balance assertions for the closed/re-
+       opened accounts.  You probably shouldn't use status or realness filters
+       (like  -C or -R or status:) with this command, or the generated balance
+       assertions will depend on these flags.  Likewise, if you run this  com-
+       mand  with  --auto, the balance assertions will probably always require
+       --auto.
+
+       Examples:
+
+       Carrying asset/liability balances into a new file for 2019:
+
+              $ hledger close -f 2018.journal -e 2019 assets liabilities --open
+                  # (copy/paste the output to the start of your 2019 journal file)
+              $ hledger close -f 2018.journal -e 2019 assets liabilities --close
+                  # (copy/paste the output to the end of your 2018 journal file)
+
+       Now:
+
+              $ hledger bs -f 2019.journal                   # one file - balances are correct
+              $ hledger bs -f 2018.journal -f 2019.journal   # two files - balances still correct
+              $ hledger bs -f 2018.journal not:desc:closing  # to see year-end balances, must exclude closing txn
+
+       Transactions spanning the closing date can complicate matters, breaking
+       balance assertions:
+
+              2018/12/30 a purchase made in 2018, clearing the following year
+                  expenses:food          5
+                  assets:bank:checking  -5  ; [2019/1/2]
+
+       Here's one way to resolve that:
+
+              ; in 2018.journal:
+              2018/12/30 a purchase made in 2018, clearing the following year
+                  expenses:food          5
+                  liabilities:pending
+
+              ; in 2019.journal:
+              2019/1/2 clearance of last year's pending transactions
+                  liabilities:pending    5 = 0
+                  assets:checking
+
+   commodities
+       commodities
+       List all commodity/currency symbols used or declared in the journal.
+
+   descriptions
+       descriptions Show descriptions.
+
+       This command lists all descriptions that appear in transactions.
+
+       Examples:
+
+              $ hledger descriptions
+              Store Name
+              Gas Station | Petrol
+              Person A
+
+   diff
+       diff
+       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.)
+       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
+       the account balance, you can compare the bank data with your journal to
+       find out the cause.
+
+       Examples:
+
+              $ hledger diff -f $LEDGER_FILE -f bank.csv assets:bank:giro
+              These transactions are in the first file only:
+
+              2014/01/01 Opening Balances
+                  assets:bank:giro              EUR ...
+                  ...
+                  equity:opening balances       EUR -...
+
+              These transactions are in the second file only:
+
+   files
+       files
+       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
+       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
+       force a particular viewer with the --info, --man, --pager, --cat flags.
+
+       Examples:
+
+              $ hledger help
+              Please choose a manual by typing "hledger help MANUAL" (a substring is ok).
+              Manuals: hledger hledger-ui hledger-web journal csv timeclock timedot
+
+              $ hledger help h --man
+
+              hledger(1)                    hledger User Manuals                    hledger(1)
+
+              NAME
+                     hledger - a command-line accounting tool
+
+              SYNOPSIS
+                     hledger [-f FILE] COMMAND [OPTIONS] [ARGS]
+                     hledger [-f FILE] ADDONCMD -- [OPTIONS] [ARGS]
+                     hledger
+
+              DESCRIPTION
+                     hledger  is  a  cross-platform  program  for tracking money, time, or any
+              ...
+
+   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
+       FILEs' transactions as imported, without actually importing any.
+
+       The input files are specified as arguments - no need to write -f before
+       each one.  So eg to add new transactions from all CSV files to the main
+       journal, it's just: hledger import *.csv
+
+       New transactions are detected in the same way as print --new: by assum-
+       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
+       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
+       balance assignments (eg from an institution that provides only balances
+       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,
+       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 a simple income statement.  It currently  assumes
+       that  you have top-level accounts named income (or revenue) and expense
+       (plural forms also allowed.)
+
+              $ hledger incomestatement
+              Income Statement
+
+              Revenues:
+                               $-2  income
+                               $-1    gifts
+                               $-1    salary
+              --------------------
+                               $-2
+
+              Expenses:
+                                $2  expenses
+                                $1    food
+                                $1    supplies
+              --------------------
+                                $2
+
+              Total:
+              --------------------
+                                 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-
+       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-
+       tal) json.
+
+   notes
+       notes Show notes.
+
+       This command lists all notes that appear in transactions.
+
+       Examples:
+
+              $ hledger notes
+              Petrol
+              Snacks
+
+   payees
+       payees Show payee names.
+
+       This command lists all payee names that appear in transactions.
+
+       Examples:
+
+              $ hledger payees
+              Store Name
+              Gas Station
+              Person A
+
+   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.
+       Price amounts are always displayed with their full precision.
+
+   print
+       print, txns, p
+       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-
+       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-
+       rectives or inter-transaction comments
+
+              $ hledger print
+              2008/01/01 income
+                  assets:bank:checking            $1
+                  income:salary                  $-1
+
+              2008/06/01 gift
+                  assets:bank:checking            $1
+                  income:gifts                   $-1
+
+              2008/06/02 save
+                  assets:bank:saving              $1
+                  assets:bank:checking           $-1
+
+              2008/06/03 * eat & shop
+                  expenses:food                $1
+                  expenses:supplies            $1
+                  assets:cash                 $-2
+
+              2008/12/31 * pay off
+                  liabilities:debts               $1
+                  assets:bank:checking           $-1
+
+       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
+       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
+       the output parseable.
+
+       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
+       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
+       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-
+       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.
+
+       Here's an example of print's CSV output:
+
+              $ hledger print -Ocsv
+              "txnidx","date","date2","status","code","description","comment","account","amount","commodity","credit","debit","posting-status","posting-comment"
+              "1","2008/01/01","","","","income","","assets:bank:checking","1","$","","1","",""
+              "1","2008/01/01","","","","income","","income:salary","-1","$","1","","",""
+              "2","2008/06/01","","","","gift","","assets:bank:checking","1","$","","1","",""
+              "2","2008/06/01","","","","gift","","income:gifts","-1","$","1","","",""
+              "3","2008/06/02","","","","save","","assets:bank:saving","1","$","","1","",""
+              "3","2008/06/02","","","","save","","assets:bank:checking","-1","$","1","","",""
+              "4","2008/06/03","","*","","eat & shop","","expenses:food","1","$","","1","",""
+              "4","2008/06/03","","*","","eat & shop","","expenses:supplies","1","$","","1","",""
+              "4","2008/06/03","","*","","eat & shop","","assets:cash","-2","$","2","","",""
+              "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
+         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
+         order, etc.)
+
+       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
+         greater amounts under debit.)
+
+   print-unique
+       print-unique
+       Print transactions which do not reuse an already-seen description.
+
+       Example:
+
+              $ cat unique.journal
+              1/1 test
+               (acct:one)  1
+              2/2 test
+               (acct:two)  2
+              $ LEDGER_FILE=unique.journal hledger print-unique
+              (-f option not supported)
+              2015/01/01 test
+                  (acct:one)             1
+
+   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:
+
+              $ hledger register checking
+              2008/01/01 income               assets:bank:checking            $1           $1
+              2008/06/01 gift                 assets:bank:checking            $1           $2
+              2008/06/02 save                 assets:bank:checking           $-1           $1
+              2008/12/31 pay off              assets:bank:checking           $-1            0
+
+       With --date2, it shows and sorts by secondary date instead.
+
+       The  --historical/-H  flag  adds the balance from any undisplayed prior
+       postings to the running total.  This is useful when  you  want  to  see
+       only recent activity, with a historically accurate running balance:
+
+              $ hledger register checking -b 2008/6 --historical
+              2008/06/01 gift                 assets:bank:checking            $1           $2
+              2008/06/02 save                 assets:bank:checking           $-1           $1
+              2008/12/31 pay off              assets:bank:checking           $-1            0
+
+       The --depth option limits the amount of sub-account detail displayed.
+
+       The  --average/-A flag shows the running average posting amount instead
+       of the running total (so, the final number displayed is the average for
+       the  whole  report period).  This flag implies --empty (see below).  It
+       is affected by --historical.  It works best when showing just  one  ac-
+       count and one commodity.
+
+       The  --related/-r  flag shows the other postings in the transactions of
+       the postings which would normally be shown.
+
+       The --invert flag negates all amounts.  For example, it can be used  on
+       an income account where amounts are normally displayed as negative num-
+       bers.  It's also useful to show postings on the  checking  account  to-
+       gether with the related account:
+
+              $ hledger register --related --invert assets:checking
+
+       With a reporting interval, register shows summary postings, one per in-
+       terval, aggregating the postings to each account:
+
+              $ hledger register --monthly income
+              2008/01                 income:salary                          $-1          $-1
+              2008/06                 income:gifts                           $-1          $-2
+
+       Periods with no activity, and summary postings with a zero amount,  are
+       not shown by default; use the --empty/-E flag to see them:
+
+              $ hledger register --monthly income -E
+              2008/01                 income:salary                          $-1          $-1
+              2008/02                                                          0          $-1
+              2008/03                                                          0          $-1
+              2008/04                                                          0          $-1
+              2008/05                                                          0          $-1
+              2008/06                 income:gifts                           $-1          $-2
+              2008/07                                                          0          $-2
+              2008/08                                                          0          $-2
+              2008/09                                                          0          $-2
+              2008/10                                                          0          $-2
+              2008/11                                                          0          $-2
+              2008/12                                                          0          $-2
+
+       Often,  you'll want to see just one line per interval.  The --depth op-
+       tion helps with this, causing subaccounts to be aggregated:
+
+              $ hledger register --monthly assets --depth 1h
+              2008/01                 assets                                  $1           $1
+              2008/06                 assets                                 $-1            0
+              2008/12                 assets                                 $-1          $-1
+
+       Note when using report intervals, if you specify start/end dates  these
+       will  be adjusted outward if necessary to contain a whole number of in-
+       tervals.  This ensures that the  first  and  last  intervals  are  full
+       length and comparable to the others in the report.
+
+   Custom register output
+       register  uses  the  full terminal width by default, except on windows.
+       You can override this by setting the COLUMNS environment variable  (not
+       a bash shell variable) or by using the --width/-w option.
+
+       The  description  and  account columns normally share the space equally
+       (about half of (width - 40) each).  You can adjust this by adding a de-
+       scription width as part of --width's argument, comma-separated: --width
+       W,D .  Here's a diagram (won't display correctly in --help):
+
+              <--------------------------------- width (W) ---------------------------------->
+              date (10)  description (D)       account (W-41-D)     amount (12)   balance (12)
+              DDDDDDDDDD dddddddddddddddddddd  aaaaaaaaaaaaaaaaaaa  AAAAAAAAAAAA  AAAAAAAAAAAA
+
+       and some examples:
+
+              $ hledger reg                     # use terminal width (or 80 on windows)
+              $ hledger reg -w 100              # use width 100
+              $ COLUMNS=100 hledger reg         # set with one-time environment variable
+              $ export COLUMNS=100; hledger reg # set till session end (or window resize)
+              $ hledger reg -w 100,40           # set overall width 100, description width 40
+              $ hledger reg -w $COLUMNS,40      # use terminal width, & description width 40
+
+       This command also supports the output destination and output format op-
+       tions  The  output  formats  supported are txt, csv, and (experimental)
+       json.
+
+   register-match
+       register-match
+       Print the one posting whose transaction description is closest to DESC,
+       in  the  style  of the register command.  If there are multiple equally
+       good matches, it shows the most recent.  Query  options  (options,  not
+       arguments)  can be used to restrict the search space.  Helps ledger-au-
+       tosync detect already-seen transactions when importing.
+
+   rewrite
+       rewrite
+       Print all transactions, rewriting the postings of matched transactions.
+       For  now  the only rewrite available is adding new postings, like print
+       --auto.
+
+       This is a start at a generic rewriter of transaction entries.  It reads
+       the  default  journal and prints the transactions, like print, but adds
+       one or more specified postings to any transactions matching QUERY.  The
+       posting  amounts can be fixed, or a multiplier of the existing transac-
+       tion's first posting amount.
+
+       Examples:
+
+              $ hledger-rewrite.hs ^income --add-posting '(liabilities:tax)  *.33  ; income tax' --add-posting '(reserve:gifts)  $100'
+              $ hledger-rewrite.hs expenses:gifts --add-posting '(reserve:gifts)  *-1"'
+              $ hledger-rewrite.hs -f rewrites.hledger
+
+       rewrites.hledger may consist of entries like:
+
+              = ^income amt:<0 date:2017
+                (liabilities:tax)  *0.33  ; tax on income
+                (reserve:grocery)  *0.25  ; reserve 25% for grocery
+                (reserve:)  *0.25  ; reserve 25% for grocery
+
+       Note the single quotes to protect the dollar sign from  bash,  and  the
+       two spaces between account and amount.
+
+       More:
+
+              $ hledger rewrite -- [QUERY]        --add-posting "ACCT  AMTEXPR" ...
+              $ hledger rewrite -- ^income        --add-posting '(liabilities:tax)  *.33'
+              $ hledger rewrite -- expenses:gifts --add-posting '(budget:gifts)  *-1"'
+              $ hledger rewrite -- ^income        --add-posting '(budget:foreign currency)  *0.25 JPY; diversify'
+
+       Argument  for  --add-posting  option  is a usual posting of transaction
+       with an exception for amount specification.  More  precisely,  you  can
+       use '*' (star symbol) before the amount to indicate that that this is a
+       factor for an amount of original matched posting.  If  the  amount  in-
+       cludes a commodity name, the new posting amount will be in the new com-
+       modity; otherwise, it will be in the matched posting  amount's  commod-
+       ity.
+
+   Re-write rules in a file
+       During  the  run  this  tool will execute so called "Automated Transac-
+       tions" found in any journal it process.  I.e instead of specifying this
+       operations in command line you can put them in a journal file.
+
+              $ rewrite-rules.journal
+
+       Make contents look like this:
+
+              = ^income
+                  (liabilities:tax)  *.33
+
+              = expenses:gifts
+                  budget:gifts  *-1
+                  assets:budget  *1
+
+       Note  that '=' (equality symbol) that is used instead of date in trans-
+       actions you usually write.  It indicates the query by which you want to
+       match the posting to add new ones.
+
+              $ hledger rewrite -- -f input.journal -f rewrite-rules.journal > rewritten-tidy-output.journal
+
+       This is something similar to the commands pipeline:
+
+              $ hledger rewrite -- -f input.journal '^income' --add-posting '(liabilities:tax)  *.33' \
+                | hledger rewrite -- -f - expenses:gifts      --add-posting 'budget:gifts  *-1'       \
+                                                              --add-posting 'assets:budget  *1'       \
+                > rewritten-tidy-output.journal
+
+       It  is  important  to understand that relative order of such entries in
+       journal is important.  You can re-use result of previously added  post-
+       ings.
+
+   Diff output format
+       To  use  this tool for batch modification of your journal files you may
+       find useful output in form of unified diff.
+
+              $ hledger rewrite -- --diff -f examples/sample.journal '^income' --add-posting '(liabilities:tax)  *.33'
+
+       Output might look like:
+
+              --- /tmp/examples/sample.journal
+              +++ /tmp/examples/sample.journal
+              @@ -18,3 +18,4 @@
+               2008/01/01 income
+              -    assets:bank:checking  $1
+              +    assets:bank:checking            $1
+                   income:salary
+              +    (liabilities:tax)                0
+              @@ -22,3 +23,4 @@
+               2008/06/01 gift
+              -    assets:bank:checking  $1
+              +    assets:bank:checking            $1
+                   income:gifts
+              +    (liabilities:tax)                0
+
+       If you'll pass this through patch tool you'll get transactions contain-
+       ing the posting that matches your query be updated.  Note that multiple
+       files might be update according to list of input  files  specified  via
+       --file options and include directives inside of these files.
+
+       Be  careful.  Whole transaction being re-formatted in a style of output
+       from hledger print.
+
+       See also:
+
+       https://github.com/simonmichael/hledger/issues/99
+
+   rewrite vs. print --auto
+       This command predates print --auto, and currently does  much  the  same
+       thing, but with these differences:
+
+       o with  multiple files, rewrite lets rules in any file affect all other
+         files.  print --auto uses standard directive  scoping;  rules  affect
+         only child files.
+
+       o rewrite's  query  limits which transactions can be rewritten; all are
+         printed.  print --auto's query limits which transactions are printed.
+
+       o rewrite applies rules specified on command line or  in  the  journal.
+         print --auto applies rules specified in the journal.
+
+   roi
+       roi
+       Shows  the  time-weighted (TWR) and money-weighted (IRR) rate of return
+       on your investments.
+
+       This command assumes that you have account(s)  that  hold  nothing  but
+       your investments and whenever you record current appraisal/valuation of
+       these investments you offset unrealized profit and loss into account(s)
+       that, again, hold nothing but unrealized profit and loss.
+
+       Any  transactions  affecting  balance  of investment account(s) and not
+       originating from unrealized profit and loss account(s) are  assumed  to
+       be your investments or withdrawals.
+
+       At  a  minimum,  you need to supply a query (which could be just an ac-
+       count name) to select your investments with --inv, and another query to
+       identify your profit and loss transactions with --pnl.
+
+       It  will  compute and display the internalized rate of return (IRR) and
+       time-weighted rate of return (TWR) for your investments  for  the  time
+       period  requested.  Both rates of return are annualized before display,
+       regardless of the length of reporting interval.
+
+   stats
+       stats
+       Show some journal statistics.
+
+       The stats command displays summary information for the  whole  journal,
+       or  a matched part of it.  With a reporting interval, it shows a report
+       for each report period.
+
+       Example:
+
+              $ hledger stats
+              Main journal file        : /src/hledger/examples/sample.journal
+              Included journal files   :
+              Transactions span        : 2008-01-01 to 2009-01-01 (366 days)
+              Last transaction         : 2008-12-31 (2333 days ago)
+              Transactions             : 5 (0.0 per day)
+              Transactions last 30 days: 0 (0.0 per day)
+              Transactions last 7 days : 0 (0.0 per day)
+              Payees/descriptions      : 5
+              Accounts                 : 8 (depth 3)
+              Commodities              : 1 ($)
+              Market prices            : 12 ($)
+
+       This command also supports output destination and output format  selec-
+       tion.
+
+   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.
+
+   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
+       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
+       as a bug!
+
+       This command also accepts tasty test runner options, written after a --
+       (double hyphen).  Eg to run only the tests in Hledger.Data.Amount, with
+       ANSI colour codes disabled:
+
+              $ hledger test -- -pData.Amount --color=never
+
+       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
+       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-
+       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
+       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
+         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;
+         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
+       options, journal parsing, reporting, etc.
+
+       Two  important  add-ons  are the hledger-ui and hledger-web user inter-
+       faces.  These are maintained and released along with hledger:
+
+   ui
+       hledger-ui provides an efficient terminal interface.
+
+   web
+       hledger-web provides a simple web interface.
+
+       Third party add-ons, maintained separately from hledger, include:
+
+   iadd
+       hledger-iadd is a more interactive, terminal UI replacement for the add
+       command.
+
+   interest
+       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/
+       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).
+
+       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
+       (say, an Emacs dock icon).  Eg on MacOS Catalina I have a ~/.MacOSX/en-
+       vironment.plist file containing
+
+              {
+                "LEDGER_FILE" : "~/finance/current.journal"
+              }
+
+       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
+       C:/Users/USER/.hledger.journal).
+
+LIMITATIONS
+       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
+       must be configured (or there will be an unhelpful error).  Eg on POSIX,
+       set LANG to something other than C.
+
+       In a Microsoft Windows CMD window, non-ascii characters and colours are
+       not supported.
+
+       On Windows, non-ascii characters may not display correctly when running
+       a hledger built in CMD in MSYS/CYGWIN, or vice-versa.
+
+       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
+       differences.
+
+       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
+       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,
+       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
+       need to use export.  Here's an explanation.
+
+       "Illegal byte sequence" or "Invalid or  incomplete  multibyte  or  wide
+       character" errors
+       In order to handle non-ascii letters and symbols (like ), hledger needs
+       an appropriate locale.  This is usually configured system-wide; you can
+       also configure it temporarily.  The locale may need to be one that sup-
+       ports UTF-8, if you built hledger with GHC < 7.2 (or  possibly  always,
+       I'm not sure yet).
+
+       Here's  an  example  of  setting  the  locale  temporarily,  on  ubuntu
+       gnu/linux:
+
+              $ file my.journal
+              my.journal: UTF-8 Unicode text                 # <- the file is UTF8-encoded
+              $ locale -a
+              C
+              en_US.utf8                             # <- a UTF8-aware locale is available
+              POSIX
+              $ LANG=en_US.utf8 hledger -f my.journal print   # <- use it for this command
+
+       Here's one way to set it permanently, there are probably better ways:
+
+              $ echo "export LANG=en_US.UTF-8" >>~/.bash_profile
+              $ bash --login
+
+       If we preferred to use eg fr_FR.utf8, we might  have  to  install  that
+       first:
+
+              $ apt-get install language-pack-fr
+              $ locale -a
+              C
+              en_US.utf8
+              fr_BE.utf8
+              fr_CA.utf8
+              fr_CH.utf8
+              fr_FR.utf8
+              fr_LU.utf8
+              POSIX
+              $ LANG=fr_FR.utf8 hledger -f my.journal print
+
+       Note some platforms allow variant locale spellings, but not all (ubuntu
+       accepts fr_FR.UTF8, mac osx requires exactly fr_FR.UTF-8).
+
+
+
+REPORTING BUGS
+       Report bugs at http://bugs.hledger.org (or on the #hledger IRC  channel
+       or hledger mail list)
+
+
+AUTHORS
+       Simon Michael <simon@joyful.com> and contributors
+
+
+COPYRIGHT
+       Copyright (C) 2007-2019 Simon Michael.
+       Released under GNU GPL v3 or later.
+
+
+SEE ALSO
+       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)
+
+       http://hledger.org
+
+
+
+hledger 1.17                      March 2020                        hledger(1)
