hledger 1.1 → 1.2
raw patch · 39 files changed
+8754/−8397 lines, 39 filesdep +heredep ~hledgerdep ~hledger-libdep ~megaparsecPVP ok
version bump matches the API change (PVP)
Dependencies added: here
Dependency ranges changed: hledger, hledger-lib, megaparsec
API changes (from Hackage documentation)
- Hledger.Cli.Balance: cumulativeChangeReportAsText :: ReportOpts -> MultiBalanceReport -> String
- Hledger.Cli.Balance: historicalBalanceReportAsText :: ReportOpts -> MultiBalanceReport -> String
- Hledger.Cli.Balance: periodChangeReportAsText :: ReportOpts -> MultiBalanceReport -> String
- Hledger.Cli.CliOptions: defAddonCommandMode :: Name -> Mode RawOpts
- Hledger.Cli.CliOptions: getCliOpts :: Mode RawOpts -> IO CliOpts
+ Hledger.Cli.Balance: balanceReportAsTable :: ReportOpts -> MultiBalanceReport -> Table String String MixedAmount
+ Hledger.Cli.Balance: multiBalanceReportAsText :: ReportOpts -> MultiBalanceReport -> String
+ Hledger.Cli.Balance: renderBalanceReportTable :: ReportOpts -> Table String String MixedAmount -> String
+ Hledger.Cli.BalanceView: BalanceView :: String -> [String] -> String -> String -> [(String, Journal -> Query)] -> BalanceType -> BalanceView
+ Hledger.Cli.BalanceView: [bvaliases] :: BalanceView -> [String]
+ Hledger.Cli.BalanceView: [bvhelp] :: BalanceView -> String
+ Hledger.Cli.BalanceView: [bvmode] :: BalanceView -> String
+ Hledger.Cli.BalanceView: [bvqueries] :: BalanceView -> [(String, Journal -> Query)]
+ Hledger.Cli.BalanceView: [bvtitle] :: BalanceView -> String
+ Hledger.Cli.BalanceView: [bvtype] :: BalanceView -> BalanceType
+ Hledger.Cli.BalanceView: balanceviewReport :: BalanceView -> CliOpts -> Journal -> IO ()
+ Hledger.Cli.BalanceView: balanceviewmode :: BalanceView -> Mode RawOpts
+ Hledger.Cli.BalanceView: data BalanceView
+ Hledger.Cli.CliOptions: getHledgerCliOpts :: Mode RawOpts -> IO CliOpts
+ Hledger.Cli.CliOptions: hledgerCommandMode :: HelpTemplate -> [Flag RawOpts] -> [(Help, [Flag RawOpts])] -> [Flag RawOpts] -> ([Arg RawOpts], Maybe (Arg RawOpts)) -> Mode RawOpts
+ Hledger.Cli.CliOptions: quickAddonCommandMode :: Name -> Mode RawOpts
+ Hledger.Cli.Main: commandsFromCommandsList :: String -> [String]
+ Hledger.Cli.Main: commandsListTemplate :: String
+ Hledger.Cli.Main: knownCommands :: [String]
+ Hledger.Cli.Main: printCommandsList :: [String] -> IO ()
+ Hledger.Cli.Print: originalTransaction :: Transaction -> Transaction
+ Text.Tabular.AsciiWide: cross :: Bool -> Char
+ Text.Tabular.AsciiWide: doubleCross :: Bool -> String
+ Text.Tabular.AsciiWide: doubleHorizontalBar :: Bool -> Char
+ Text.Tabular.AsciiWide: doubleMidBar :: Bool -> String
+ Text.Tabular.AsciiWide: doubleVerticalCross :: Bool -> String
+ Text.Tabular.AsciiWide: horizontalBar :: Bool -> Char
+ Text.Tabular.AsciiWide: leftBar :: Bool -> String
+ Text.Tabular.AsciiWide: midBar :: Bool -> String
+ Text.Tabular.AsciiWide: rightBar :: Bool -> String
+ Text.Tabular.AsciiWide: verticalBar :: Bool -> Char
- Hledger.Cli.CliOptions: hledgerAddons :: IO ([String], [String])
+ Hledger.Cli.CliOptions: hledgerAddons :: IO [String]
- Text.Tabular.AsciiWide: render :: (rh -> String) -> (ch -> String) -> (a -> String) -> Table rh ch a -> String
+ Text.Tabular.AsciiWide: render :: Bool -> (rh -> String) -> (ch -> String) -> (a -> String) -> Table rh ch a -> String
- Text.Tabular.AsciiWide: renderColumns :: [Int] -> Header String -> String
+ Text.Tabular.AsciiWide: renderColumns :: Bool -> [Int] -> Header String -> String
- Text.Tabular.AsciiWide: renderHLine :: [Int] -> Header String -> Properties -> [String]
+ Text.Tabular.AsciiWide: renderHLine :: Bool -> [Int] -> Header String -> Properties -> [String]
- Text.Tabular.AsciiWide: renderHLine' :: [Int] -> Char -> Header String -> String
+ Text.Tabular.AsciiWide: renderHLine' :: Bool -> Properties -> [Int] -> Char -> Header String -> String
Files
- CHANGES +124/−0
- Hledger/Cli/Balance.hs +43/−95
- Hledger/Cli/BalanceView.hs +184/−0
- Hledger/Cli/Balancesheet.hs +18/−38
- Hledger/Cli/Cashflow.hs +16/−32
- Hledger/Cli/CliOptions.hs +170/−80
- Hledger/Cli/Incomestatement.hs +19/−32
- Hledger/Cli/Main.hs +148/−55
- Hledger/Cli/Print.hs +22/−5
- Hledger/Cli/Register.hs +2/−2
- Hledger/Cli/Utils.hs +21/−4
- README.md +85/−5
- Text/Tabular/AsciiWide.hs +54/−18
- bench/bench.hs +0/−14
- doc/hledger.1 +2573/−2584
- doc/hledger.1.info +2212/−2327
- doc/hledger.1.txt +1859/−1904
- doc/other/hledger-api.1 +21/−42
- doc/other/hledger-api.1.info +37/−50
- doc/other/hledger-api.1.txt +20/−33
- doc/other/hledger-ui.1 +49/−53
- doc/other/hledger-ui.1.info +158/−162
- doc/other/hledger-ui.1.txt +114/−117
- doc/other/hledger-web.1 +59/−65
- doc/other/hledger-web.1.info +103/−106
- doc/other/hledger-web.1.txt +51/−57
- doc/other/hledger_csv.5 +1/−1
- doc/other/hledger_csv.5.info +57/−73
- doc/other/hledger_csv.5.txt +1/−1
- doc/other/hledger_journal.5 +70/−16
- doc/other/hledger_journal.5.info +299/−292
- doc/other/hledger_journal.5.txt +97/−58
- doc/other/hledger_timeclock.5 +1/−1
- doc/other/hledger_timeclock.5.info +11/−16
- doc/other/hledger_timeclock.5.txt +1/−1
- doc/other/hledger_timedot.5 +1/−1
- doc/other/hledger_timedot.5.info +23/−32
- doc/other/hledger_timedot.5.txt +1/−1
- hledger.cabal +29/−24
CHANGES view
@@ -2,6 +2,130 @@ See also the project change log. +# 1.2 (2016/3/31)++## CLI++"hledger" and "hledger -h" now print a better organised commands list+and general usage message respectively (#297).++The common reporting flags can now be used anywhere on the command line.++Fixed deduplication of addons in commands list.++Fixed ugly stack traces in command line parse error messages.++The -V/--value flag is now a global report flag, so it works with+balance, print, register, balancesheet, incomestatement, cashflow,+etc. (Justin Le)++The `--pivot` global reporting option replaces all account names with+the value of some other field or tag. It has been improved, eg:++- we don't add the field/tag name name as a prefix+- when pivoting on a tag, if the tag is missing we show a blank + (rather than showing mixed tag values and account names)+- a pipe character delimiter may be used in descriptions to get a more accurate+ and useful payee report (`hledger balance --pivot payee`)++options cleanups++## Addons++Easier installation:+move add-ons and example scripts to bin/, +convert to stack scripts,+add a build script to install all deps,+add some functional tests,+test add-ons with Travis CI,+add installation docs to download page.++Improved docs: +all addons now contain their own documentation. Most of them (all but+hledger-budget) use a new reduced-boilerplate declaration format+and can show short (-h) and long (--help) command line help.+(Long help is declared with pre and postambles to the generated+options help, short help is that truncated at the start of the hledger+common flags.)++`hledger` now shows a cleaner list of addon commands, showing only the+compiled version of an addon when both source and compiled versions+are in $PATH. (Addons with .exe extension or no extension are+considered compiled. Modification time is not checked, ie, an old+compiled addon will override a newer source version. If there are+three or more versions of an addon, all are shown. )++New addons added/included:++- autosync - example symlink to ledger-autosync+- budget - experimental budget reporting command supporting Ledger-like periodic transactions and automated transactions (Mykola Orliuk)+- chart - pie-chart-generating prototype, a repackaging of the old hledger-chart tool+- check - more powerful balance assertions (Michael Walker)+- check-dupes - find accounts sharing the same leaf name (Stefano Rodighiero)+- prices - show all market price records (Mykola Orliuk)+- register-match - a helper for ledger-autosync's deduplication, finds best match for a transaction description++The equity command now always generates a valid journal transaction,+handles prices better, and adds balance assertions (Mykola Orliuk).++The rewrite command is more robust and powerful (Mykola Orliuk):++- in addition to command-line rewrite options, it understands rewrite rules+ defined in the journal, similar to Ledger's automated transactions (#99).+ Eg:+ ```journal+ = ^income+ (liabilities:tax) *.33++ = expenses:gifts+ budget:gifts *-1+ assets:budget *1+ ```++- it can generate diff output, allowing easier review of the proposed+ changes, and safe modification of original journal files (preserving+ file-level comments and directives). Eg:+ ```+ hledger-rewrite --diff Agency --add-posting 'Expenses:Taxes *0.17' | patch+ ```++- rewrites can affect multiple postings in a transaction, not just one.++- posting-specific dates are handled better++## balance++A new --pretty-tables option uses unicode characters for rendering+table borders in multicolumn reports (#522) (Moritz Kiefer)++## balancesheet/cashflow/incomestatement++These commands are now more powerful, able to show multicolumn reports+and generally having the same features as the balance command. (Justin Le)++balancesheet has always ignored a begin date specified with a `-b` or+`-p` option; now it also ignores a begin date specified with a `date:`+query. (Related discussion at #531)++## print++The output of print is now always a valid journal (fixes #465) (Mykola Orliuk).++print now tries to preserves the format of implicit/explicit balancing+amounts and prices, by default. To print with all amounts explicit,+use the new `--explicit/-x` flag (fixes #442). (Mykola Orliuk)+ +Don't lose the commodity of zero amounts/zero balance assertions (fixes #475) (Mykola Orliuk)++## Misc++Fix a regression in the readability of option parsing errors (#478) (Hans-Peter Deifel)++Fix an example in Cli/Main.hs (Steven R. Baker)++Allow megaparsec 5.2 (#503)++ # 1.1 (2016/12/31) ## balance
Hledger/Cli/Balance.hs view
@@ -13,7 +13,7 @@ command emulates ledger's, showing accounts indented according to hierarchy, along with their total amount posted (including subaccounts). -Here's an example. With @data/sample.journal@, which defines the following account tree:+Here's an example. With @examples/sample.journal@, which defines the following account tree: @ assets@@ -239,16 +239,15 @@ ,balance ,balanceReportAsText ,balanceReportItemAsText- ,periodChangeReportAsText- ,cumulativeChangeReportAsText- ,historicalBalanceReportAsText+ ,multiBalanceReportAsText+ ,renderBalanceReportTable+ ,balanceReportAsTable ,tests_Hledger_Cli_Balance ) where import Data.List (intercalate) import Data.Maybe-import Data.Monoid--- import Data.Text (Text)+-- import Data.Monoid import qualified Data.Text as T import System.Console.CmdArgs.Explicit as C import Text.CSV@@ -275,13 +274,13 @@ "show historical ending balance in each period (includes postings before report start date)\n " ,flagNone ["tree"] (\opts -> setboolopt "tree" opts) "show accounts as a tree; amounts include subaccounts (default in simple reports)" ,flagNone ["flat"] (\opts -> setboolopt "flat" opts) "show accounts as a list; amounts exclude subaccounts except when account is depth-clipped (default in multicolumn reports)\n "- ,flagNone ["value","V"] (setboolopt "value") "convert amounts to their market value on the report end date (using the most recent applicable market price, if any)" ,flagNone ["average","A"] (\opts -> setboolopt "average" opts) "show a row average column (in multicolumn reports)" ,flagNone ["row-total","T"] (\opts -> setboolopt "row-total" opts) "show a row total column (in multicolumn reports)" ,flagNone ["no-total","N"] (\opts -> setboolopt "no-total" opts) "omit the final total row" ,flagReq ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "omit N leading account name parts (in flat mode)" ,flagNone ["no-elide"] (\opts -> setboolopt "no-elide" opts) "don't squash boring parent accounts (in tree mode)" ,flagReq ["format"] (\s opts -> Right $ setopt "format" s opts) "FORMATSTR" "use this custom line format (in simple reports)"+ ,flagNone ["pretty-tables"] (\opts -> setboolopt "pretty-tables" opts) "use unicode when displaying tables" ] ++ outputflags ,groupHidden = []@@ -299,8 +298,6 @@ Right _ -> do let format = outputFormatFromOpts opts interval = interval_ ropts- baltype = balancetype_ ropts- mvaluedate <- reportEndDate j ropts -- shenanigans: use single/multiBalanceReport when we must, -- ie when there's a report interval, or --historical or -- cumulative. -- Otherwise prefer the older balanceReport since it can elide boring parents.@@ -314,23 +311,16 @@ | otherwise = ropts{accountlistmode_=ALTree} in singleBalanceReport ropts' (queryFromOpts d ropts) j | otherwise = balanceReport ropts (queryFromOpts d ropts) j- convert | value_ ropts = maybe id (balanceReportValue j) mvaluedate- | otherwise = id render = case format of "csv" -> \ropts r -> (++ "\n") $ printCSV $ balanceReportAsCsv ropts r _ -> balanceReportAsText- writeOutput opts $ render ropts $ convert report+ writeOutput opts $ render ropts report _ -> do let report = multiBalanceReport ropts (queryFromOpts d ropts) j- convert | value_ ropts = maybe id (multiBalanceReportValue j) mvaluedate- | otherwise = id render = case format of "csv" -> \ropts r -> (++ "\n") $ printCSV $ multiBalanceReportAsCsv ropts r- _ -> case baltype of- PeriodChange -> periodChangeReportAsText- CumulativeChange -> cumulativeChangeReportAsText- HistoricalBalance -> historicalBalanceReportAsText- writeOutput opts $ render ropts $ convert report+ _ -> multiBalanceReportAsText+ writeOutput opts $ render ropts report -- single-column balance reports @@ -481,94 +471,52 @@ ++ (if average_ opts then [avg] else []) )] --- | Render a multi-column period balance report as plain text suitable for console output.-periodChangeReportAsText :: ReportOpts -> MultiBalanceReport -> String-periodChangeReportAsText opts r@(MultiBalanceReport (colspans, items, (coltotals,tot,avg))) =- unlines $- ([printf "Balance changes in %s:" (showDateSpan $ multiBalanceReportSpan r)] ++) $- trimborder $ lines $- render id (" "++) showMixedAmountOneLineWithoutPrice $- addtotalrow $- Table- (T.Group NoLine $ map (Header . padRightWide acctswidth . T.unpack) accts)- (T.Group NoLine $ map Header colheadings)- (map rowvals items')+-- | Render a multi-column balance report as plain text suitable for console output.+multiBalanceReportAsText :: ReportOpts -> MultiBalanceReport -> String+multiBalanceReportAsText opts r =+ printf "%s in %s:" typeStr (showDateSpan $ multiBalanceReportSpan r)+ ++ "\n"+ ++ renderBalanceReportTable opts tabl where- trimborder = ("":) . (++[""]) . drop 1 . init . map (drop 1 . init)- colheadings = map showDateSpan colspans- ++ (if row_total_ opts then [" Total"] else [])- ++ (if average_ opts then ["Average"] else [])- items' | empty_ opts = items- | otherwise = items -- dbg1 "2" $ filter (any (not . isZeroMixedAmount) . snd) $ dbg1 "1" items- accts = map renderacct items'- renderacct (a,a',i,_,_,_)- | tree_ opts = T.replicate ((i-1)*2) " " <> a'- | otherwise = maybeAccountNameDrop opts a- acctswidth = maximum' $ map textWidth accts- rowvals (_,_,_,as,rowtot,rowavg) = as- ++ (if row_total_ opts then [rowtot] else [])- ++ (if average_ opts then [rowavg] else [])- addtotalrow | no_total_ opts = id- | otherwise = (+----+ (row "" $- coltotals- ++ (if row_total_ opts then [tot] else [])- ++ (if average_ opts then [avg] else [])- ))+ tabl = balanceReportAsTable opts r+ typeStr :: String+ typeStr = case balancetype_ opts of+ PeriodChange -> "Balance changes"+ CumulativeChange -> "Ending balances (cumulative)"+ HistoricalBalance -> "Ending balances (historical)" --- | Render a multi-column cumulative balance report as plain text suitable for console output.-cumulativeChangeReportAsText :: ReportOpts -> MultiBalanceReport -> String-cumulativeChangeReportAsText opts r@(MultiBalanceReport (colspans, items, (coltotals,tot,avg))) =- unlines $- ([printf "Ending balances (cumulative) in %s:" (showDateSpan $ multiBalanceReportSpan r)] ++) $- trimborder $ lines $- render id (" "++) showMixedAmountOneLineWithoutPrice $- addtotalrow $- Table- (T.Group NoLine $ map (Header . padRightWide acctswidth) accts)- (T.Group NoLine $ map Header colheadings)- (map rowvals items)+-- | Given a table representing a multi-column balance report (for example,+-- made using 'balanceReportAsTable'), render it in a format suitable for+-- console output.+renderBalanceReportTable :: ReportOpts -> Table String String MixedAmount -> String+renderBalanceReportTable (ReportOpts { pretty_tables_ = pretty }) = unlines . trimborder . lines+ . render pretty id (" " ++) showMixedAmountOneLineWithoutPrice+ . align where trimborder = ("":) . (++[""]) . drop 1 . init . map (drop 1 . init)- colheadings = map (maybe "" (showDate . prevday) . spanEnd) colspans- ++ (if row_total_ opts then [" Total"] else [])- ++ (if average_ opts then ["Average"] else [])- accts = map renderacct items- renderacct (a,a',i,_,_,_)- | tree_ opts = replicate ((i-1)*2) ' ' ++ T.unpack a'- | otherwise = T.unpack $ maybeAccountNameDrop opts a- acctswidth = maximum' $ map strWidth accts- rowvals (_,_,_,as,rowtot,rowavg) = as- ++ (if row_total_ opts then [rowtot] else [])- ++ (if average_ opts then [rowavg] else [])- addtotalrow | no_total_ opts = id- | otherwise = (+----+ (row "" $- coltotals- ++ (if row_total_ opts then [tot] else [])- ++ (if average_ opts then [avg] else [])- ))+ align (Table l t d) = Table l' t d+ where+ acctswidth = maximum' $ map strWidth (headerContents l)+ l' = padRightWide acctswidth <$> l --- | Render a multi-column historical balance report as plain text suitable for console output.-historicalBalanceReportAsText :: ReportOpts -> MultiBalanceReport -> String-historicalBalanceReportAsText opts r@(MultiBalanceReport (colspans, items, (coltotals,tot,avg))) =- unlines $- ([printf "Ending balances (historical) in %s:" (showDateSpan $ multiBalanceReportSpan r)] ++) $- trimborder $ lines $- render id (" "++) showMixedAmountOneLineWithoutPrice $- addtotalrow $- Table- (T.Group NoLine $ map (Header . padRightWide acctswidth) accts)- (T.Group NoLine $ map Header colheadings)- (map rowvals items)+-- | Build a 'Table' from a multi-column balance report.+balanceReportAsTable :: ReportOpts -> MultiBalanceReport -> Table String String MixedAmount+balanceReportAsTable opts (MultiBalanceReport (colspans, items, (coltotals,tot,avg))) =+ addtotalrow $ Table+ (T.Group NoLine $ map Header accts)+ (T.Group NoLine $ map Header colheadings)+ (map rowvals items) where- trimborder = ("":) . (++[""]) . drop 1 . init . map (drop 1 . init)- colheadings = map (maybe "" (showDate . prevday) . spanEnd) colspans+ mkDate = case balancetype_ opts of+ PeriodChange -> showDateSpan+ _ -> maybe "" (showDate . prevday) . spanEnd+ colheadings = map mkDate colspans ++ (if row_total_ opts then [" Total"] else []) ++ (if average_ opts then ["Average"] else []) accts = map renderacct items renderacct (a,a',i,_,_,_) | tree_ opts = replicate ((i-1)*2) ' ' ++ T.unpack a' | otherwise = T.unpack $ maybeAccountNameDrop opts a- acctswidth = maximum' $ map strWidth accts rowvals (_,_,_,as,rowtot,rowavg) = as ++ (if row_total_ opts then [rowtot] else []) ++ (if average_ opts then [rowavg] else [])
+ Hledger/Cli/BalanceView.hs view
@@ -0,0 +1,184 @@+{-# LANGUAGE OverloadedStrings, RecordWildCards #-}+{-|++This module is used by the 'balancesheet', 'incomestatement', and+'cashflow' commands to print out acocunt balances based on a specific+"view", which consists of a title and multiple named queries that are+aggregated and totaled.++-}++module Hledger.Cli.BalanceView (+ BalanceView(..)+ ,balanceviewmode+ ,balanceviewReport+) where++import Control.Monad (unless)+import Data.List (intercalate, foldl', isPrefixOf)+import Data.Maybe (fromMaybe)+import Data.Monoid (Sum(..), (<>))+import System.Console.CmdArgs.Explicit as C+import Text.Tabular as T++import Hledger+import Hledger.Cli.Balance+import Hledger.Cli.CliOptions++-- | Describes a view for the balance, which can consist of multiple+-- separate named queries that are aggregated and totaled.+data BalanceView = BalanceView {+ bvmode :: String, -- ^ command line mode of the view+ bvaliases :: [String], -- ^ command line aliases+ bvhelp :: String, -- ^ command line help message+ bvtitle :: String, -- ^ title of the view+ bvqueries :: [(String, Journal -> Query)], -- ^ named queries that make up the view+ bvtype :: BalanceType -- ^ the type of balance this view shows.+ -- This overrides user input.+}++balanceviewmode :: BalanceView -> Mode RawOpts+balanceviewmode BalanceView{..} = (defCommandMode $ bvmode : bvaliases) {+ modeHelp = bvhelp `withAliases` bvaliases+ ,modeGroupFlags = C.Group {+ groupUnnamed = [+ flagNone ["change"] (\opts -> setboolopt "change" opts)+ ("show balance change in each period" ++ defType PeriodChange)+ ,flagNone ["cumulative"] (\opts -> setboolopt "cumulative" opts)+ ("show balance change accumulated across periods (in multicolumn reports)"+ ++ defType CumulativeChange+ )+ ,flagNone ["historical","H"] (\opts -> setboolopt "historical" opts)+ ("show historical ending balance in each period (includes postings before report start date)"+ ++ defType HistoricalBalance+ )+ ,flagNone ["flat"] (\opts -> setboolopt "flat" opts) "show accounts as a list"+ ,flagReq ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "flat mode: omit N leading account name parts"+ ,flagNone ["no-total","N"] (\opts -> setboolopt "no-total" opts) "omit the final total row"+ ,flagNone ["tree"] (\opts -> setboolopt "tree" opts) "show accounts as a tree; amounts include subaccounts (default in simple reports)"+ ,flagNone ["average","A"] (\opts -> setboolopt "average" opts) "show a row average column (in multicolumn reports)"+ ,flagNone ["row-total","T"] (\opts -> setboolopt "row-total" opts) "show a row total column (in multicolumn reports)"+ ,flagNone ["no-elide"] (\opts -> setboolopt "no-elide" opts) "don't squash boring parent accounts (in tree mode)"+ ,flagReq ["format"] (\s opts -> Right $ setopt "format" s opts) "FORMATSTR" "use this custom line format (in simple reports)"+ ,flagNone ["pretty-tables"] (\opts -> setboolopt "pretty-tables" opts) "use unicode when displaying tables"+ ]+ ,groupHidden = []+ ,groupNamed = [generalflagsgroup1]+ }+ }+ where+ defType :: BalanceType -> String+ defType bt | bt == bvtype = " (default)"+ | otherwise = ""++balanceviewQueryReport+ :: ReportOpts+ -> Query+ -> Journal+ -> String+ -> (Journal -> Query)+ -> ([String], Sum MixedAmount)+balanceviewQueryReport ropts q0 j t q = ([view], Sum amt)+ where+ q' = And [q0, q j]+ rep@(_ , amt)+ -- For --historical/--cumulative, we must use multiBalanceReport.+ -- (This forces --no-elide.)+ -- See Balance.hs's implementation of 'balance' for more information+ | balancetype_ ropts `elem` [HistoricalBalance, CumulativeChange]+ = singleBalanceReport ropts q' j+ | otherwise+ = balanceReport ropts q' j+ view = intercalate "\n" [t <> ":", balanceReportAsText ropts rep]++multiBalanceviewQueryReport+ :: ReportOpts+ -> Query+ -> Journal+ -> String+ -> (Journal -> Query)+ -> ([Table String String MixedAmount], [[MixedAmount]], Sum MixedAmount)+multiBalanceviewQueryReport ropts q0 j t q = ([tabl], [coltotals], Sum tot)+ where+ singlesection = "Cash" `isPrefixOf` t -- TODO temp + ropts' = ropts { no_total_ = singlesection && no_total_ ropts, empty_ = True }+ q' = And [q0, q j]+ MultiBalanceReport (dates, rows, (coltotals,tot,avg)) =+ multiBalanceReport ropts' q' j+ rows' | empty_ ropts = rows+ | otherwise = filter (not . emptyRow) rows+ where+ emptyRow (_,_,_,amts,_,_) = all isZeroMixedAmount amts+ r = MultiBalanceReport (dates, rows', (coltotals, tot, avg))+ Table hLeft hTop dat = balanceReportAsTable ropts' r+ tabl = Table (T.Group SingleLine [Header t, hLeft]) hTop ([]:dat)++-- | Prints out a balance report according to a given view+balanceviewReport :: BalanceView -> CliOpts -> Journal -> IO ()+balanceviewReport BalanceView{..} CliOpts{command_=cmd, reportopts_=ropts, rawopts_=raw} j = do+ currDay <- getCurrentDay+ let q0 = queryFromOpts currDay ropts'+ let title = bvtitle ++ maybe "" (' ':) balanceclarification+ case interval_ ropts' of+ NoInterval -> do+ let (views, amt) =+ foldMap (uncurry (balanceviewQueryReport ropts' q0 j))+ bvqueries+ mapM_ putStrLn (title : "" : views)++ unless (no_total_ ropts' || cmd=="cashflow") . mapM_ putStrLn $ -- TODO temp+ [ "Total:"+ , "--------------------"+ , padleft 20 $ showMixedAmountWithoutPrice (getSum amt)+ ]+ _ -> do+ let (tabls, amts, Sum totsum)+ = foldMap (uncurry (multiBalanceviewQueryReport ropts' q0 j)) bvqueries+ sumAmts = case amts of+ a1:as -> foldl' (zipWith (+)) a1 as+ [] -> []+ totavg = totsum `divideMixedAmount`+ fromIntegral (length sumAmts)+ mergedTabl = case tabls of+ t1:ts -> foldl' merging t1 ts+ [] -> T.empty+ totTabl+ | no_total_ ropts' || length bvqueries == 1 =+ mergedTabl+ | otherwise =+ mergedTabl+ +====++ row "Total"+ (sumAmts ++ (if row_total_ ropts' then [totsum] else [])+ ++ (if average_ ropts' then [totavg] else [])+ )+ putStrLn title+ putStrLn $ renderBalanceReportTable ropts totTabl+ where+ overwriteBalanceType =+ case reverse $ filter (`elem` ["change","cumulative","historical"]) $ map fst raw of+ "historical":_ -> Just HistoricalBalance+ "cumulative":_ -> Just CumulativeChange+ "change":_ -> Just PeriodChange+ _ -> Nothing+ balancetype = fromMaybe bvtype overwriteBalanceType+ -- we must clarify that the statements aren't actual income statements,+ -- etc. if the user overrides the balance type+ balanceclarification = flip fmap overwriteBalanceType $ \t ->+ case t of+ PeriodChange -> "(Balance Changes)"+ CumulativeChange -> "(Cumulative Ending Balances)"+ HistoricalBalance -> "(Historical Ending Balances)"+ ropts' = treeIfNotPeriod $+ ropts { balancetype_ = balancetype }+ treeIfNotPeriod = case (balancetype, interval_ ropts) of+ -- For --historical/--cumulative, we must use multiBalanceReport.+ -- (This forces --no-elide.)+ -- These settings format the output in a way that we can convert to+ -- a normal balance report using singleBalanceReport. See+ -- Balance.hs for more information.+ (HistoricalBalance, NoInterval) -> \o -> o { accountlistmode_ = ALTree }+ (CumulativeChange , NoInterval) -> \o -> o { accountlistmode_ = ALTree }+ _ -> id+ merging (Table hLeft hTop dat) (Table hLeft' _ dat') =+ Table (T.Group DoubleLine [hLeft, hLeft']) hTop (dat ++ dat')
Hledger/Cli/Balancesheet.hs view
@@ -11,54 +11,34 @@ ,tests_Hledger_Cli_Balancesheet ) where -import qualified Data.Text.Lazy.IO as LT+import Data.String.Here import System.Console.CmdArgs.Explicit import Test.HUnit-import Text.Shakespeare.Text import Hledger import Hledger.Cli.CliOptions-import Hledger.Cli.Balance+import Hledger.Cli.BalanceView +bsBV = BalanceView {+ bvmode = "balancesheet",+ bvaliases = ["bs"],+ bvhelp = [here|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 (plural forms also allowed).+ |],+ bvtitle = "Balance Sheet",+ bvqueries = [ ("Assets" , journalAssetAccountQuery),+ ("Liabilities", journalLiabilityAccountQuery)+ ],+ bvtype = HistoricalBalance+ } balancesheetmode :: Mode RawOpts-balancesheetmode = (defCommandMode $ ["balancesheet"]++aliases) {- modeHelp = "show a balance sheet" `withAliases` aliases- ,modeGroupFlags = Group {- groupUnnamed = [- flagNone ["flat"] (\opts -> setboolopt "flat" opts) "show accounts as a list"- ,flagReq ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "flat mode: omit N leading account name parts"- ]- ,groupHidden = []- ,groupNamed = [generalflagsgroup1]- }- }- where aliases = ["bs"]+balancesheetmode = balanceviewmode bsBV --- | Print a simple balance sheet. balancesheet :: CliOpts -> Journal -> IO ()-balancesheet CliOpts{reportopts_=ropts} j = do- -- let lines = case lineFormatFromOpts ropts of Left err, Right ...- d <- getCurrentDay- let q = queryFromOpts d (withoutBeginDate ropts)- assetreport@(_,assets) = balanceReport ropts (And [q, journalAssetAccountQuery j]) j- liabilityreport@(_,liabilities) = balanceReport ropts (And [q, journalLiabilityAccountQuery j]) j- total = assets + liabilities- LT.putStr $ [lt|Balance Sheet--Assets:-#{balanceReportAsText ropts assetreport}-Liabilities:-#{balanceReportAsText ropts liabilityreport}-Total:----------------------#{padleft 20 $ showMixedAmountWithoutPrice total}-|]--withoutBeginDate :: ReportOpts -> ReportOpts-withoutBeginDate ropts@ReportOpts{..} = ropts{period_=p}- where- p = dateSpanAsPeriod $ DateSpan Nothing (periodEnd period_)+balancesheet = balanceviewReport bsBV tests_Hledger_Cli_Balancesheet :: Test tests_Hledger_Cli_Balancesheet = TestList
Hledger/Cli/Cashflow.hs view
@@ -14,48 +14,32 @@ ,tests_Hledger_Cli_Cashflow ) where -import qualified Data.Text.Lazy.IO as LT+import Data.String.Here import System.Console.CmdArgs.Explicit import Test.HUnit-import Text.Shakespeare.Text import Hledger import Hledger.Cli.CliOptions-import Hledger.Cli.Balance+import Hledger.Cli.BalanceView +cfBV = BalanceView {+ bvmode = "cashflow",+ bvaliases = ["cf"],+ bvhelp = [here|This command displays a simple cashflow statement, showing changes+in "cash" accounts. It assumes that these accounts are under a top-level +`asset` account and do not contain `receivable` or `A/R` in their name +(plural forms also allowed). + |],+ bvtitle = "Cashflow Statement",+ bvqueries = [("Cash flows", journalCashAccountQuery)],+ bvtype = PeriodChange+ } cashflowmode :: Mode RawOpts-cashflowmode = (defCommandMode ["cashflow","cf"]) {- modeHelp = "show a cashflow statement" `withAliases` ["cf"]- ,modeGroupFlags = Group {- groupUnnamed = [- flagNone ["flat"] (\opts -> setboolopt "flat" opts) "show accounts as a list"- ,flagReq ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "flat mode: omit N leading account name parts"- ]- ,groupHidden = []- ,groupNamed = [generalflagsgroup1]- }- }+cashflowmode = balanceviewmode cfBV --- | Print a simple cashflow statement. cashflow :: CliOpts -> Journal -> IO ()-cashflow CliOpts{reportopts_=ropts} j = do- -- let lines = case lineFormatFromOpts ropts of Left err, Right ...- d <- getCurrentDay- let q = queryFromOpts d ropts- cashreport@(_,total) = balanceReport ropts (And [q, journalCashAccountQuery j]) j- -- operatingreport@(_,operating) = balanceReport ropts (And [q, journalOperatingAccountMatcher j]) j- -- investingreport@(_,investing) = balanceReport ropts (And [q, journalInvestingAccountMatcher j]) j- -- financingreport@(_,financing) = balanceReport ropts (And [q, journalFinancingAccountMatcher j]) j- -- total = operating + investing + financing- LT.putStr $ [lt|Cashflow Statement--Cash flows:-#{balanceReportAsText ropts cashreport}-Total:----------------------#{padleft 20 $ showMixedAmountWithoutPrice total}-|]+cashflow = balanceviewReport cfBV tests_Hledger_Cli_Cashflow :: Test tests_Hledger_Cli_Cashflow = TestList
Hledger/Cli/CliOptions.hs view
@@ -20,7 +20,8 @@ generalflagsgroup3, defMode, defCommandMode,- defAddonCommandMode,+ quickAddonCommandMode,+ hledgerCommandMode, argsFlag, showModeUsage, withAliases,@@ -28,7 +29,7 @@ -- * CLI options CliOpts(..), defcliopts,- getCliOpts,+ getHledgerCliOpts, decodeRawOpts, rawOptsToCliOpts, checkCliOpts,@@ -73,6 +74,7 @@ import Data.Functor.Identity (Identity) import Data.List.Compat import Data.List.Split (splitOneOf)+import Data.Ord import Data.Maybe -- import Data.Text (Text) import qualified Data.Text as T@@ -100,10 +102,10 @@ -- | Common help flags: --help, --debug, --version... helpflags :: [Flag RawOpts] helpflags = [- flagNone ["h"] (setboolopt "h") "show general usage or (after COMMAND, the command's usage"- ,flagNone ["help"] (setboolopt "help") "show the current program's manual as plain text (or after an add-on COMMAND, the add-on's manual)"- ,flagNone ["man"] (setboolopt "man") "show the current program's manual with man"- ,flagNone ["info"] (setboolopt "info") "show the current program's manual with info"+ flagNone ["h"] (setboolopt "h") "show general usage (or after CMD, command usage)"+ ,flagNone ["help"] (setboolopt "help") "show this program's manual as plain text (or after an addon CMD, the add-on's manual)"+ ,flagNone ["man"] (setboolopt "man") "show this program's manual with man"+ ,flagNone ["info"] (setboolopt "info") "show this program's manual with info" -- ,flagNone ["browse-args"] (setboolopt "browse-args") "use a web UI to select options and build up a command line" ,flagReq ["debug"] (\s opts -> Right $ setopt "debug" s opts) "[N]" "show debug output (levels 1-9, default: 1)" ,flagNone ["version"] (setboolopt "version") "show version information"@@ -116,11 +118,12 @@ -- | Common input-related flags: --file, --rules-file, --alias... inputflags :: [Flag RawOpts] inputflags = [- flagReq ["file","f"] (\s opts -> Right $ setopt "file" s opts) "FILE" "use a different input file. For stdin, use -"- ,flagReq ["rules-file"] (\s opts -> Right $ setopt "rules-file" s opts) "RFILE" "CSV conversion rules file (default: FILE.rules)"- ,flagReq ["alias"] (\s opts -> Right $ setopt "alias" s opts) "OLD=NEW" "display accounts named OLD as NEW"- ,flagNone ["ignore-assertions","I"] (setboolopt "ignore-assertions") "ignore any balance assertions in the journal"- ,flagReq ["pivot"] (\s opts -> Right $ setopt "pivot" s opts) "TAG" "Replace the accounts of postings with TAG by TAG:<value>"+ 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 ["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"+ ,flagNone ["ignore-assertions","I"] (setboolopt "ignore-assertions") "ignore any balance assertions" ] -- | Common report-related flags: --period, --cost, etc.@@ -143,7 +146,7 @@ ,flagReq ["depth"] (\s opts -> Right $ setopt "depth" s opts) "N" "hide accounts/postings deeper than N" ,flagNone ["empty","E"] (setboolopt "empty") "show items with zero amount, normally hidden" ,flagNone ["cost","B"] (setboolopt "cost") "convert amounts to their cost at transaction time (using the transaction price, if any)"- ,flagNone ["anon"] (setboolopt "anon") "output ledger with anonymized accounts and payees."+ ,flagNone ["value","V"] (setboolopt "value") "convert amounts to their market value on the report end date (using the most recent applicable market price, if any)" ] -- | Common output-related flags: --output-file, --output-format...@@ -165,51 +168,107 @@ -- cmdargs mode constructors --- | A basic mode template.+-- | An empty cmdargs mode to use as a template.+-- Modes describe the top-level command, ie the program, or a subcommand,+-- telling cmdargs how to parse a command line and how to+-- generate the command's usage text. defMode :: Mode RawOpts-defMode = Mode {- modeNames = []- ,modeHelp = ""- ,modeHelpSuffix = []- ,modeValue = []- ,modeCheck = Right- ,modeReform = const Nothing- ,modeExpandAt = True- ,modeGroupFlags = Group {- groupNamed = []- ,groupUnnamed = [- flagNone ["h"] (setboolopt "h") "Show command usage."- ]- ,groupHidden = []- }- ,modeArgs = ([], Nothing)- ,modeGroupModes = toGroup []+defMode = Mode {+ modeNames = [] -- program/command name(s)+ ,modeHelp = "" -- short help for this command+ ,modeHelpSuffix = [] -- text displayed after the usage+ ,modeGroupFlags = Group { -- description of flags accepted by the command+ groupNamed = [] -- named groups of flags+ ,groupUnnamed = [] -- ungrouped flags+ ,groupHidden = [] -- flags not displayed in the usage+ }+ ,modeArgs = ([], Nothing) -- description of arguments accepted by the command+ ,modeValue = [] -- value returned when this mode is used to parse a command line+ ,modeCheck = Right -- whether the mode's value is correct+ ,modeReform = const Nothing -- function to convert the value back to a command line arguments+ ,modeExpandAt = True -- expand @ arguments for program ?+ ,modeGroupModes = toGroup [] -- sub-modes } --- | A basic subcommand mode with the given command name(s).+-- | A cmdargs mode suitable for a hledger built-in command+-- with the given names (primary name + optional aliases).+-- The default flags are short and long help (-h and --help).+-- The usage message shows [QUERY] as argument. defCommandMode :: [Name] -> Mode RawOpts defCommandMode names = defMode { modeNames=names+ ,modeGroupFlags = Group {+ groupNamed = []+ ,groupUnnamed = [+ flagNone ["h"] (setboolopt "h") "Show usage."+ -- ,flagNone ["help"] (setboolopt "help") "Show long help."+ ]+ ,groupHidden = [] -- flags not displayed in the usage+ }+ ,modeArgs = ([], Just $ argsFlag "[QUERY]") ,modeValue=[("command", headDef "" names)]- ,modeArgs = ([], Just $ argsFlag "[PATTERNS]") } --- | A basic subcommand mode suitable for an add-on command.-defAddonCommandMode :: Name -> Mode RawOpts-defAddonCommandMode addon = defMode {- modeNames = [addon]- ,modeHelp = fromMaybe "" $ lookup (stripAddonExtension addon) standardAddonsHelp- ,modeValue=[("command",addon)]+-- | A cmdargs mode representing the hledger add-on command with the given name.+-- Like defCommandMode, but adds a appropriate short help message if the addon name+-- is recognised, and includes hledger's common input/reporting/help flags as default.+-- Just used by hledger for generating the commands list I think (or possibly for+-- invoking the addons as well ?)+quickAddonCommandMode :: Name -> Mode RawOpts+quickAddonCommandMode name = (defCommandMode [name]) {+ modeHelp = fromMaybe "" $ lookup (stripAddonExtension name) standardAddonsHelp ,modeGroupFlags = Group { groupUnnamed = [] ,groupHidden = [] ,groupNamed = [generalflagsgroup1] }- ,modeArgs = ([], Just $ argsFlag "[ARGS]") } --- | Built-in descriptions for some of the known external addons,--- since we don't currently have any way to ask them.+-- | A template for a command's CLI help, influencing the content and layout+-- of the usage text generated by a cmdargs mode. +-- It is a multiline string structured like so:+-- The first line defines the command name (first word) and aliases (any other words). +-- From the second line up to a line containing just "FLAGS", or the end, is the preamble,+-- displayed above the flags list generated by cmdargs. Short help goes here.+-- Any lines after the FLAGS line are the postamble, displayed below the flags list.+-- Long help/full manual goes here.+type HelpTemplate = String++-- | Parse a help template into command names, help preamble, and help postamble lines.+parseHelpTemplate :: HelpTemplate -> Maybe ([Name], String, [String])+parseHelpTemplate t =+ case lines t of+ [] -> Nothing+ (l:ls) -> Just (names, preamble, postamblelines)+ where+ names = words l+ (preamblels, postamblels) = break (== "FLAGS") ls+ preamble = unlines $ reverse $ dropWhile null $ reverse preamblels+ postamblelines = dropWhile null $ drop 1 postamblels++-- | Build a cmdarg mode suitable for a hledger add-on command,+-- from a help template and flag/argument specifications.+-- Reduces boilerplate a little, though the complicated cmdargs+-- flag and argument specs are still required.+-- See the addons in bin/ for examples of usage.+hledgerCommandMode :: HelpTemplate -> [Flag RawOpts] -> [(Help, [Flag RawOpts])] + -> [Flag RawOpts] -> ([Arg RawOpts], Maybe (Arg RawOpts)) -> Mode RawOpts+hledgerCommandMode tmpl ungroupedflags groupedflags hiddenflags args =+ case parseHelpTemplate tmpl of+ Nothing -> error' $ "Could not parse help template:\n"++tmpl++"\n"+ Just (names, preamble, postamblelines) ->+ (defCommandMode names) {+ modeHelp = preamble+ ,modeHelpSuffix = postamblelines+ ,modeGroupFlags = Group {+ groupUnnamed = ungroupedflags+ ,groupNamed = groupedflags+ ,groupHidden = hiddenflags+ }+ ,modeArgs = args+ }++-- | Built-in descriptions for some of the known addons. standardAddonsHelp :: [(String,String)] standardAddonsHelp = [ ("chart", "generate simple balance pie charts")@@ -353,28 +412,53 @@ -- | Do final validation of processed opts, raising an error if there is trouble. checkCliOpts :: CliOpts -> CliOpts checkCliOpts opts =- either optserror (const opts) $ do+ either usageError (const opts) $ do -- XXX move to checkReportOpts or move _format to CliOpts case lineFormatFromOpts $ reportopts_ opts of Left err -> Left $ "could not parse format option: "++err Right _ -> Right () -- XXX check registerWidthsFromOpts opts --- Currently only used by some extras/ scripts:--- | Parse hledger CLI options from the command line using the given--- cmdargs mode, and either return them or, if a help flag is present,--- print the mode help and exit the program.-getCliOpts :: Mode RawOpts -> IO CliOpts-getCliOpts mode' = do+-- | A helper for addon commands: this parses options and arguments from +-- the current command line using the given hledger-style cmdargs mode, +-- and returns a CliOpts. Or, with --help or -h present, it prints +-- long or short help, and exits the program. +-- When --debug is present, also prints some debug output.+--+-- The help texts are generated from the mode.+-- Long help includes the full usage description generated by cmdargs+-- (including all supported options), framed by whatever pre- and postamble+-- text the mode specifies. It's intended that this forms a complete+-- help document or manual.+--+-- Short help is a truncated version of the above: the preamble and+-- the first part of the usage, up to the first line containing "flags:"+-- (normally this marks the start of the common hledger flags);+-- plus a mention of --help and the (presumed supported) common+-- hledger options not displayed.+--+-- Tips:+-- Empty lines in the pre/postamble are removed by cmdargs; +-- add a space character to preserve them.+--+getHledgerCliOpts :: Mode RawOpts -> IO CliOpts+getHledgerCliOpts mode' = do args' <- getArgs- let rawopts = decodeRawOpts $ processValue mode' args'+ let rawopts = either usageError decodeRawOpts $ process mode' args' opts <- rawOptsToCliOpts rawopts debugArgs args' opts- -- if any (`elem` args) ["--help","-h","-?"]- when ("h" `inRawOpts` rawopts_ opts) $ putStr (showModeUsage mode') >> exitSuccess- when ("help" `inRawOpts` rawopts_ opts) $ printHelpForTopic (topicForMode mode') >> exitSuccess+ when ("help" `inRawOpts` rawopts_ opts) $ putStr longhelp >> exitSuccess+ when ("h" `inRawOpts` rawopts_ opts) $ putStr shorthelp >> exitSuccess return opts where+ longhelp = showModeUsage mode'+ shorthelp =+ unlines $+ (reverse $ dropWhile null $ reverse $ takeWhile (not . ("flags:" `isInfixOf`)) $ lines longhelp)+ +++ [""+ ," See --help for full detail, including common hledger options."+ ] -- | Print debug info about arguments and options if --debug is present. debugArgs :: [String] -> CliOpts -> IO () debugArgs args' opts =@@ -465,7 +549,7 @@ widthFromOpts CliOpts{width_=Nothing, available_width_=w} = w widthFromOpts CliOpts{width_=Just s} = case runParser (read `fmap` some digitChar <* eof :: ParsecT Dec String Identity Int) "(unknown)" s of- Left e -> optserror $ "could not parse width option: "++show e+ Left e -> usageError $ "could not parse width option: "++show e Right w -> w -- for register:@@ -483,7 +567,7 @@ registerWidthsFromOpts CliOpts{width_=Nothing, available_width_=w} = (w, Nothing) registerWidthsFromOpts CliOpts{width_=Just s} = case runParser registerwidthp "(unknown)" s of- Left e -> optserror $ "could not parse width option: "++show e+ Left e -> usageError $ "could not parse width option: "++show e Right ws -> ws where registerwidthp :: (Stream s, Char ~ Token s) => ParsecT Dec s m (Int, Maybe Int)@@ -516,35 +600,41 @@ -- Other utils --- | Get the sorted unique precise names and display names of hledger--- add-ons found in the current user's PATH. The precise names are the--- add-on's filename with the "hledger-" prefix removed. The display--- names have the file extension removed also, except when it's needed--- for disambiguation.------ -- Also when there are exactly two similar names, one with the .hs or--- -- .lhs extension and the other with the .exe extension or no--- -- extension - presumably source and compiled versions of a haskell--- -- script - we exclude the source version.+-- | Get the sorted unique canonical names of hledger addon commands+-- found in the current user's PATH. These are used in command line+-- parsing and to display the commands list. ----- This function can return add-on names which shadow built-in command--- names, but hledger will ignore these.+-- Canonical addon names are the filenames of hledger-* executables in+-- PATH, without the "hledger-" prefix, and without the file extension+-- except when it's needed for disambiguation (see below). ---hledgerAddons :: IO ([String],[String])+-- When there are exactly two versions of an executable (same base+-- name, different extensions) that look like a source and compiled+-- pair (one has .exe, .com, or no extension), the source version will+-- be excluded (even if it happens to be newer). When there are three+-- or more versions (or two versions that don't look like a+-- source/compiled pair), they are all included, with file extensions+-- intact.+-- +hledgerAddons :: IO [String] hledgerAddons = do- exes <- hledgerExecutablesInPath- let precisenames = -- concatMap dropRedundant $- -- groupBy (\a b -> dropExtension a == dropExtension b) $- map stripprefix exes- let displaynames = concatMap stripext $- groupBy (\a b -> dropExtension a == dropExtension b) precisenames- return (precisenames, displaynames)- where- stripprefix = drop (length progname + 1)- -- dropRedundant [f,f2] | takeExtension f `elem` ["",".exe"] && takeExtension f2 `elem` [".hs",".lhs"] = [f]- -- dropRedundant fs = fs- stripext [f] = [dropExtension f]- stripext fs = fs+ -- past bug generator+ as1 <- hledgerExecutablesInPath -- ["hledger-check","hledger-check-dates","hledger-check-dates.hs","hledger-check.hs","hledger-check.py"]+ let as2 = map stripPrognamePrefix as1 -- ["check","check-dates","check-dates.hs","check.hs","check.py"]+ let as3 = sortBy (comparing takeBaseName) as2 -- ["check","check.hs","check.py","check-dates","check-dates.hs"]+ let as4 = groupBy (\a b -> takeBaseName a == takeBaseName b) as3 -- [["check","check.hs","check.py"],["check-dates","check-dates.hs"]]+ let as5 = concatMap dropRedundantSourceVersion as4 -- ["check","check.hs","check.py","check-dates"]+ return as5++stripPrognamePrefix = drop (length progname + 1)++dropRedundantSourceVersion [f,g]+ | takeExtension f `elem` compiledExts = [f]+ | takeExtension g `elem` compiledExts = [g]+dropRedundantSourceVersion fs = fs++compiledExts = ["",".com",".exe"] + -- | Get the sorted unique filenames of all hledger-* executables in -- the current user's PATH. Currently these are: files in any of the
Hledger/Cli/Incomestatement.hs view
@@ -11,48 +11,35 @@ ,tests_Hledger_Cli_Incomestatement ) where -import qualified Data.Text.Lazy.IO as LT+import Data.String.Here import System.Console.CmdArgs.Explicit import Test.HUnit-import Text.Shakespeare.Text import Hledger import Hledger.Cli.CliOptions-import Hledger.Cli.Balance+import Hledger.Cli.BalanceView +isBV = BalanceView {+ bvmode = "incomestatement",+ bvaliases = ["is"],+ bvhelp = [here|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 (plural forms +also allowed). + |],+ bvtitle = "Income Statement",+ bvqueries = [ ("Revenues", journalIncomeAccountQuery),+ ("Expenses", journalExpenseAccountQuery)+ ],+ bvtype = PeriodChange+ }+ incomestatementmode :: Mode RawOpts-incomestatementmode = (defCommandMode $ ["incomestatement"]++aliases) {- modeHelp = "show an income statement" `withAliases` aliases- ,modeGroupFlags = Group {- groupUnnamed = [- flagNone ["flat"] (\opts -> setboolopt "flat" opts) "show accounts as a list"- ,flagReq ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "flat mode: omit N leading account name parts"- ]- ,groupHidden = []- ,groupNamed = [generalflagsgroup1]- }- }- where aliases = ["is"]+incomestatementmode = balanceviewmode isBV --- | Print a simple income statement. incomestatement :: CliOpts -> Journal -> IO ()-incomestatement CliOpts{reportopts_=ropts} j = do- d <- getCurrentDay- let q = queryFromOpts d ropts- incomereport@(_,income) = balanceReport ropts (And [q, journalIncomeAccountQuery j]) j- expensereport@(_,expenses) = balanceReport ropts (And [q, journalExpenseAccountQuery j]) j- total = income + expenses- LT.putStr $ [lt|Income Statement--Revenues:-#{balanceReportAsText ropts incomereport}-Expenses:-#{balanceReportAsText ropts expensereport}-Total:----------------------#{padleft 20 $ showMixedAmountWithoutPrice total}-|]+incomestatement = balanceviewReport isBV tests_Hledger_Cli_Incomestatement :: Test tests_Hledger_Cli_Incomestatement = TestList
Hledger/Cli/Main.hs view
@@ -19,7 +19,7 @@ or ghci: > $ ghci hledger-> > j <- readJournalFile Nothing Nothing "data/sample.journal"+> > j <- readJournalFile Nothing Nothing True "examples/sample.journal" > > register [] ["income","expenses"] j > 2008/01/01 income income:salary $-1 $-1 > 2008/06/01 gift income:gifts $-1 $-2@@ -36,11 +36,15 @@ -} +{-# LANGUAGE QuasiQuotes #-}+ module Hledger.Cli.Main where -- import Control.Monad import Data.Char (isDigit)+import Data.String.Here import Data.List+import Data.List.Split (splitOn) import Safe import System.Console.CmdArgs.Explicit as C import System.Environment@@ -69,59 +73,70 @@ import Hledger.Cli.Utils import Hledger.Cli.Version import Hledger.Data.Dates (getCurrentDay)-import Hledger.Data.RawOptions (RawOpts, optserror)+import Hledger.Data.RawOptions (RawOpts) import Hledger.Reports.ReportOptions (period_, interval_, queryFromOpts) import Hledger.Utils -- | The overall cmdargs mode describing command-line options for hledger. mainmode addons = defMode {- modeNames = [progname]- ,modeHelp = unlines []- ,modeHelpSuffix = [""]+ modeNames = [progname ++ " [CMD]"] ,modeArgs = ([], Just $ argsFlag "[ARGS]")+ ,modeHelp = unlines ["hledger's command line interface"] ,modeGroupModes = Group {- -- modes (commands) in named groups:- groupNamed = [- ("Data entry commands", [- addmode- ])- ,("\nReporting commands", [- printmode- ,accountsmode- ,balancemode- ,registermode- ,incomestatementmode- ,balancesheetmode- ,cashflowmode- ,activitymode- ,statsmode- ])+ -- subcommands in the unnamed group, shown first:+ groupUnnamed = [ ]- ++ case addons of [] -> []- cs -> [("\nAdd-on commands", map defAddonCommandMode cs)]- -- modes in the unnamed group, shown first without a heading:- ,groupUnnamed = [- helpmode- ,manmode- ,infomode+ -- subcommands in named groups:+ ,groupNamed = [ ]- -- modes handled but not shown+ -- subcommands handled but not shown in the help: ,groupHidden = [- testmode- ,oldconvertmode- ]+ oldconvertmode+ ,accountsmode+ ,activitymode+ ,addmode+ ,balancemode+ ,balancesheetmode+ ,cashflowmode+ ,helpmode+ ,incomestatementmode+ ,infomode+ ,manmode+ ,printmode+ ,registermode+ ,statsmode+ ,testmode+ ] ++ map quickAddonCommandMode addons } ,modeGroupFlags = Group { -- flags in named groups:- groupNamed = [generalflagsgroup3]- -- flags in the unnamed group, shown last without a heading:+ groupNamed = [+ ( "General input flags", inputflags)+ ,("\nGeneral reporting flags", reportflags)+ ,("\nGeneral help flags", helpflags)+ ]+ -- flags in the unnamed group, shown last: ,groupUnnamed = []- -- flags accepted but not shown in the help:+ -- flags handled but not shown in the help: ,groupHidden =- detailedversionflag :- inputflags -- included here so they'll not raise a confusing error if present with no COMMAND+ [detailedversionflag]+ -- ++ inputflags -- included here so they'll not raise a confusing error if present with no COMMAND }+ ,modeHelpSuffix = lines $ regexReplace "PROGNAME" progname [here|Examples:+PROGNAME list commands+PROGNAME CMD [--] [OPTS] [ARGS] run a command (use -- with addon commands)+PROGNAME-CMD [OPTS] [ARGS] or run addon commands directly+PROGNAME -h general usage+PROGNAME CMD -h command usage+PROGNAME --help PROGNAME manual+PROGNAME --man PROGNAME manual as man page+PROGNAME --info PROGNAME manual as info manual+PROGNAME help list help topics+PROGNAME help TOPIC TOPIC manual+PROGNAME man TOPIC TOPIC manual as man page+PROGNAME info TOPIC TOPIC manual as info manual+|] } oldconvertmode = (defCommandMode ["convert"]) {@@ -149,7 +164,7 @@ argsToCliOpts args addons = do let args' = moveFlagsAfterCommand args- cmdargsopts = processValue (mainmode addons) args'+ cmdargsopts = either usageError id $ process (mainmode addons) args' cmdargsopts' = decodeRawOpts cmdargsopts rawOptsToCliOpts cmdargsopts' @@ -160,8 +175,8 @@ -- -- Since we're not parsing flags as precisely as cmdargs here, this is -- imperfect. We make a decent effort to:--- - move all no-argument help and input flags--- - move all required-argument help and input flags along with their values, space-separated or not+-- - move all no-argument help/input/report flags+-- - move all required-argument help/input/report flags along with their values, space-separated or not -- - not confuse things further or cause misleading errors. moveFlagsAfterCommand :: [String] -> [String] moveFlagsAfterCommand args = moveArgs $ ensureDebugHasArg args@@ -197,11 +212,92 @@ isValue ('-':_) = False isValue _ = True -flagstomove = inputflags ++ helpflags+flagstomove = inputflags ++ reportflags ++ helpflags noargflagstomove = concatMap flagNames $ filter ((==FlagNone).flagInfo) flagstomove reqargflagstomove = -- filter (/= "debug") $ concatMap flagNames $ filter ((==FlagReq ).flagInfo) flagstomove +-- | Template for the commands list. Includes an entry for known (or+-- hypothetical) builtin and addon commands; these will be filtered+-- based on the commands found at runtime. COUNT is replaced with the+-- number of commands found. OTHERCMDS is replaced with an entry for+-- each unknown addon command found. The command descriptions here+-- should be synced with the commands' builtin help and the command+-- list in the hledger manual.+commandsListTemplate :: String+commandsListTemplate = [here|Commands available (COUNT):++Standard reports:+ accounts show chart of accounts+ balancesheet (bs) show a balance sheet+ cashflow (cf) show a cashflow statement+ incomestatement (is) show an income statement+ transactions (txns) show transactions in some account++General reporting:+ activity show a bar chart of posting counts per interval+ balance (bal) show accounts and balances+ budget add automated postings/txns/bucket accts (experimental)+ chart generate simple balance pie charts (experimental)+ check check more powerful balance assertions+ check-dates check transactions are ordered by date+ check-dupes check for accounts with the same leaf name+ irr calculate internal rate of return of an investment+ prices show market price records+ print show transaction journal entries+ print-unique show only transactions with unique descriptions+ register (reg) show postings and running total+ register-match show best matching transaction for a description+ stats show some journal statistics++Interfaces:+ add console ui for adding transactions+ api web api server+ iadd curses ui for adding transactions+ ui curses ui+ web web ui++Misc:+ autosync download/deduplicate/convert OFX data+ equity generate transactions to zero & restore account balances+ interest generate interest transactions+ rewrite add automated postings to certain transactions+ test run some self tests+OTHERCMDS+Help: (see also -h, CMD -h, --help|---man|--info)+ help|man|info show any of the hledger manuals in text/man/info format+|]++knownCommands :: [String]+knownCommands = sort $ commandsFromCommandsList commandsListTemplate++-- | Extract the command names from a commands list like the above:+-- the first word (or words separated by |) of lines beginning with a space.+commandsFromCommandsList :: String -> [String]+commandsFromCommandsList s = concatMap (splitOn "|") [w | ' ':l <- lines s, let w:_ = words l]++-- | Print the commands list, modifying the template above based on+-- the currently available addons. Missing addons will be removed, and+-- extra addons will be added under Misc.+printCommandsList :: [String] -> IO ()+printCommandsList addonsFound = putStr commandsList+ where+ commandsFound = builtinCommandNames ++ addonsFound+ unknownCommandsFound = addonsFound \\ knownCommands++ adjustline (' ':l) | not $ w `elem` commandsFound = []+ where w = takeWhile (not . (`elem` "| ")) l+ adjustline l = [l]++ commandsList1 =+ regexReplace "OTHERCMDS" (unlines [' ':w | w <- unknownCommandsFound]) $+ unlines $ concatMap adjustline $ lines commandsListTemplate++ commandsList =+ regexReplace "COUNT" (show $ length $ commandsFromCommandsList commandsList1)+ commandsList1++ -- | Let's go. main :: IO () main = do@@ -233,25 +329,22 @@ dbgIO "raw args before command" argsbeforecmd dbgIO "raw args after command" argsaftercmd - -- Search PATH for add-ons, excluding any that match built-in names.- -- The precise addon names (including file extension) are used for command- -- parsing, and the display names are used for displaying the commands list.- (addonPreciseNames', addonDisplayNames') <- hledgerAddons- let addonPreciseNames = filter (not . (`elem` builtinCommandNames) . dropExtension) addonPreciseNames'- let addonDisplayNames = filter (not . (`elem` builtinCommandNames)) addonDisplayNames'+ -- Search PATH for add-ons, excluding any that match built-in command names+ addons' <- hledgerAddons+ let addons = filter (not . (`elem` builtinCommandNames) . dropExtension) addons' -- parse arguments with cmdargs- opts <- argsToCliOpts args addonPreciseNames+ opts <- argsToCliOpts args addons -- select an action and run it. let cmd = command_ opts -- the full matched internal or external command name, if any isInternalCommand = cmd `elem` builtinCommandNames -- not (null cmd) && not (cmd `elem` addons)- isExternalCommand = not (null cmd) && cmd `elem` addonPreciseNames -- probably+ isExternalCommand = not (null cmd) && cmd `elem` addons -- probably isBadCommand = not (null rawcmd) && null cmd hasVersion = ("--version" `elem`) hasDetailedVersion = ("--version+" `elem`)- printUsage = putStr $ showModeUsage $ mainmode addonDisplayNames+ printUsage = putStr $ showModeUsage $ mainmode addons badCommandError = error' ("command "++rawcmd++" is not recognized, run with no command to see a list") >> exitFailure hasShortHelpFlag args = any (`elem` args) ["-h"] hasLongHelpFlag args = any (`elem` args) ["--help"]@@ -279,16 +372,16 @@ runHledgerCommand -- high priority flags and situations. -h, then --help, then --info are highest priority. | hasShortHelpFlag argsbeforecmd = dbgIO "" "-h before command, showing general usage" >> printUsage- | hasLongHelpFlag argsbeforecmd = dbgIO "" "--help before command, showing general manual" >> printHelpForTopic (topicForMode $ mainmode addonDisplayNames)- | hasManFlag argsbeforecmd = dbgIO "" "--man before command, showing general manual with man" >> runManForTopic (topicForMode $ mainmode addonDisplayNames)- | hasInfoFlag argsbeforecmd = dbgIO "" "--info before command, showing general manual with info" >> runInfoForTopic (topicForMode $ mainmode addonDisplayNames)+ | hasLongHelpFlag argsbeforecmd = dbgIO "" "--help before command, showing general manual" >> printHelpForTopic (topicForMode $ mainmode addons)+ | hasManFlag argsbeforecmd = dbgIO "" "--man before command, showing general manual with man" >> runManForTopic (topicForMode $ mainmode addons)+ | hasInfoFlag argsbeforecmd = dbgIO "" "--info before command, showing general manual with info" >> runInfoForTopic (topicForMode $ mainmode addons) | not (hasSomeHelpFlag argsaftercmd) && (hasVersion argsbeforecmd || (hasVersion argsaftercmd && isInternalCommand)) = putStrLn prognameandversion | not (hasSomeHelpFlag argsaftercmd) && (hasDetailedVersion argsbeforecmd || (hasDetailedVersion argsaftercmd && isInternalCommand)) = putStrLn prognameanddetailedversion -- \| (null externalcmd) && "binary-filename" `inRawOpts` rawopts = putStrLn $ binaryfilename progname -- \| "--browse-args" `elem` args = System.Console.CmdArgs.Helper.execute "cmdargs-browser" mainmode' args >>= (putStr . show)- | isNullCommand = dbgIO "" "no command, showing general usage" >> printUsage+ | isNullCommand = dbgIO "" "no command, showing commands list" >> printCommandsList addons | isBadCommand = badCommandError -- internal commands@@ -320,7 +413,7 @@ | cmd == "convert" = error' (modeHelp oldconvertmode) >> exitFailure -- shouldn't reach here- | otherwise = optserror ("could not understand the arguments "++show args) >> exitFailure+ | otherwise = usageError ("could not understand the arguments "++show args) >> exitFailure runHledgerCommand
Hledger/Cli/Print.hs view
@@ -10,6 +10,7 @@ printmode ,print' ,entriesReportAsText+ ,originalTransaction ,tests_Hledger_Cli_Print ) where@@ -27,14 +28,16 @@ printmode = (defCommandMode $ ["print"] ++ aliases) {- modeHelp = "show transaction entries" `withAliases` aliases+ modeHelp = "show transaction journal entries" `withAliases` aliases ,modeGroupFlags = Group { groupUnnamed = [ let matcharg = "STR" in flagReq ["match","m"] (\s opts -> Right $ setopt "match" s opts) matcharg ("show the transaction whose description is most similar to "++matcharg- ++ ", and is most recent")+ ++ ", and is most recent"),+ flagNone ["explicit","x"] (setboolopt "explicit")+ "show all amounts explicitly" ] ++ outputflags ,groupHidden = []@@ -43,6 +46,17 @@ } where aliases = [] +showTransaction' :: CliOpts -> Transaction -> String+showTransaction' opts+ | boolopt "explicit" $ rawopts_ opts = showTransactionUnelided+ | otherwise = showTransactionUnelided . originalTransaction++originalTransaction :: Transaction -> Transaction+originalTransaction t = t { tpostings = map originalPosting' $ tpostings t } where+ -- We don't want plain original postings because print wouldn't issue alias+ -- directives. Thus we are going to print effective account name.+ originalPosting' p = (originalPosting p) { paccount = paccount p }+ -- | Print journal transactions in standard format. print' :: CliOpts -> Journal -> IO () print' opts j = do@@ -57,12 +71,15 @@ fmt = outputFormatFromOpts opts (render, ropts') = case fmt of "csv" -> ((++"\n") . printCSV . entriesReportAsCsv, ropts{accountlistmode_=ALFlat})- _ -> (entriesReportAsText, ropts)+ _ -> (entriesReportAsText' opts, ropts) writeOutput opts $ render $ entriesReport ropts' q j entriesReportAsText :: EntriesReport -> String entriesReportAsText items = concatMap showTransactionUnelided items +entriesReportAsText' :: CliOpts -> EntriesReport -> String+entriesReportAsText' = concatMap . showTransaction'+ -- XXX -- tests_showTransactions = [ -- "showTransactions" ~: do@@ -106,7 +123,7 @@ entriesReportAsCsv :: EntriesReport -> CSV entriesReportAsCsv txns =- ["txnidx","date","date2","status","code","description","comment","account","amount","commodity","credit","debit","status","posting-comment"] :+ ["txnidx","date","date2","status","code","description","comment","account","amount","commodity","credit","debit","posting-status","posting-comment"] : concatMap transactionToCSV txns -- | Generate one CSV record per posting, duplicating the common transaction fields.@@ -131,7 +148,7 @@ let amount = showAmount a_ in let commodity = T.unpack c in let credit = if q < 0 then showAmount $ negate a_ else "" in- let debit = if q > 0 then showAmount a_ else "" in+ let debit = if q >= 0 then showAmount a_ else "" in account:amount:commodity:credit:debit:status:comment:[]) amounts where
Hledger/Cli/Register.hs view
@@ -90,8 +90,8 @@ postingsReportAsText :: CliOpts -> PostingsReport -> String postingsReportAsText opts (_,items) = unlines $ map (postingsReportItemAsText opts amtwidth balwidth) items where- amtwidth = maximum $ 12 : map (strWidth . showMixedAmount . itemamt) items- balwidth = maximum $ 12 : map (strWidth . showMixedAmount . itembal) items+ amtwidth = maximumStrict $ 12 : map (strWidth . showMixedAmount . itemamt) items+ balwidth = maximumStrict $ 12 : map (strWidth . showMixedAmount . itembal) items itemamt (_,_,_,Posting{pamount=a},_) = a itembal (_,_,_,_,a) = a
Hledger/Cli/Utils.hs view
@@ -23,6 +23,7 @@ ) where import Control.Exception as C+import Control.Monad ((<=<)) import Data.Hashable (hash) import Data.List import Data.Maybe@@ -63,6 +64,7 @@ import Hledger.Cli.CliOptions import Hledger.Data import Hledger.Read+import Hledger.Reports import Hledger.Utils @@ -76,7 +78,12 @@ rulespath <- rulesFilePathFromOpts opts journalpaths <- journalFilePathFromOpts opts ej <- readJournalFiles Nothing rulespath (not $ ignore_assertions_ opts) journalpaths- either error' (cmd opts . pivotByOpts opts . anonymiseByOpts opts . journalApplyAliases (aliasesFromOpts opts)) ej+ let f = cmd opts+ . pivotByOpts opts+ . anonymiseByOpts opts+ . journalApplyAliases (aliasesFromOpts opts)+ <=< journalApplyValue (reportopts_ opts)+ either error' f ej -- | Apply the pivot transformation on a journal, if option is present. pivotByOpts :: CliOpts -> Journal -> Journal@@ -91,9 +98,9 @@ where pivotTrans t = t{tpostings = map pivotPosting . tpostings $ t} pivotPosting p- | Just (_ , value) <- tagTuple = p{paccount = joinAccountNames tag value}- | _ <- tagTuple = p- where tagTuple = find ((tag ==) . fst) . ptags $ p+ | Just (_ , value) <- tagTuple = p{paccount = value, porigin = Just $ originalPosting p}+ | _ <- tagTuple = p{paccount = T.pack "", porigin = Just $ originalPosting p}+ where tagTuple = find ((tag ==) . fst) . postingAllImplicitTags $ p -- | Apply the anonymisation transformation on a journal, if option is present anonymiseByOpts :: CliOpts -> Journal -> Journal@@ -118,6 +125,16 @@ j { jtxns = map tAnons . jtxns $ j } where anon = T.pack . flip showHex "" . (fromIntegral :: Int -> Word32) . hash++journalApplyValue :: ReportOpts -> Journal -> IO Journal+journalApplyValue ropts j = do+ mvaluedate <- reportEndDate j ropts+ let convert | value_ ropts+ , Just d <- mvaluedate+ = overJournalAmounts (amountValue j d)+ | otherwise+ = id+ return $ convert j -- | Write some output to stdout or to a file selected by --output-file. writeOutput :: CliOpts -> String -> IO ()
README.md view
@@ -27,9 +27,87 @@ For more, see http://hledger.org. +##Support++### Backers+Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/hledger#backer)]++<a href="https://opencollective.com/hledger/backer/0/website" target="_blank"><img src="https://opencollective.com/hledger/backer/0/avatar.svg"></a>+<a href="https://opencollective.com/hledger/backer/1/website" target="_blank"><img src="https://opencollective.com/hledger/backer/1/avatar.svg"></a>+<a href="https://opencollective.com/hledger/backer/2/website" target="_blank"><img src="https://opencollective.com/hledger/backer/2/avatar.svg"></a>+<a href="https://opencollective.com/hledger/backer/3/website" target="_blank"><img src="https://opencollective.com/hledger/backer/3/avatar.svg"></a>+<a href="https://opencollective.com/hledger/backer/4/website" target="_blank"><img src="https://opencollective.com/hledger/backer/4/avatar.svg"></a>+<a href="https://opencollective.com/hledger/backer/5/website" target="_blank"><img src="https://opencollective.com/hledger/backer/5/avatar.svg"></a>+<a href="https://opencollective.com/hledger/backer/6/website" target="_blank"><img src="https://opencollective.com/hledger/backer/6/avatar.svg"></a>+<a href="https://opencollective.com/hledger/backer/7/website" target="_blank"><img src="https://opencollective.com/hledger/backer/7/avatar.svg"></a>+<a href="https://opencollective.com/hledger/backer/8/website" target="_blank"><img src="https://opencollective.com/hledger/backer/8/avatar.svg"></a>+<a href="https://opencollective.com/hledger/backer/9/website" target="_blank"><img src="https://opencollective.com/hledger/backer/9/avatar.svg"></a>+<a href="https://opencollective.com/hledger/backer/10/website" target="_blank"><img src="https://opencollective.com/hledger/backer/10/avatar.svg"></a>+<a href="https://opencollective.com/hledger/backer/11/website" target="_blank"><img src="https://opencollective.com/hledger/backer/11/avatar.svg"></a>+<a href="https://opencollective.com/hledger/backer/12/website" target="_blank"><img src="https://opencollective.com/hledger/backer/12/avatar.svg"></a>+<a href="https://opencollective.com/hledger/backer/13/website" target="_blank"><img src="https://opencollective.com/hledger/backer/13/avatar.svg"></a>+<a href="https://opencollective.com/hledger/backer/14/website" target="_blank"><img src="https://opencollective.com/hledger/backer/14/avatar.svg"></a>+<a href="https://opencollective.com/hledger/backer/15/website" target="_blank"><img src="https://opencollective.com/hledger/backer/15/avatar.svg"></a>+<a href="https://opencollective.com/hledger/backer/16/website" target="_blank"><img src="https://opencollective.com/hledger/backer/16/avatar.svg"></a>+<a href="https://opencollective.com/hledger/backer/17/website" target="_blank"><img src="https://opencollective.com/hledger/backer/17/avatar.svg"></a>+<a href="https://opencollective.com/hledger/backer/18/website" target="_blank"><img src="https://opencollective.com/hledger/backer/18/avatar.svg"></a>+<a href="https://opencollective.com/hledger/backer/19/website" target="_blank"><img src="https://opencollective.com/hledger/backer/19/avatar.svg"></a>+<a href="https://opencollective.com/hledger/backer/20/website" target="_blank"><img src="https://opencollective.com/hledger/backer/20/avatar.svg"></a>+<a href="https://opencollective.com/hledger/backer/21/website" target="_blank"><img src="https://opencollective.com/hledger/backer/21/avatar.svg"></a>+<a href="https://opencollective.com/hledger/backer/22/website" target="_blank"><img src="https://opencollective.com/hledger/backer/22/avatar.svg"></a>+<a href="https://opencollective.com/hledger/backer/23/website" target="_blank"><img src="https://opencollective.com/hledger/backer/23/avatar.svg"></a>+<a href="https://opencollective.com/hledger/backer/24/website" target="_blank"><img src="https://opencollective.com/hledger/backer/24/avatar.svg"></a>+<a href="https://opencollective.com/hledger/backer/25/website" target="_blank"><img src="https://opencollective.com/hledger/backer/25/avatar.svg"></a>+<a href="https://opencollective.com/hledger/backer/26/website" target="_blank"><img src="https://opencollective.com/hledger/backer/26/avatar.svg"></a>+<a href="https://opencollective.com/hledger/backer/27/website" target="_blank"><img src="https://opencollective.com/hledger/backer/27/avatar.svg"></a>+<a href="https://opencollective.com/hledger/backer/28/website" target="_blank"><img src="https://opencollective.com/hledger/backer/28/avatar.svg"></a>+<a href="https://opencollective.com/hledger/backer/29/website" target="_blank"><img src="https://opencollective.com/hledger/backer/29/avatar.svg"></a>++### Sponsors+Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/hledger#sponsor)]++<a href="https://opencollective.com/hledger/sponsor/0/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/0/avatar.svg"></a>+<a href="https://opencollective.com/hledger/sponsor/1/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/1/avatar.svg"></a>+<a href="https://opencollective.com/hledger/sponsor/2/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/2/avatar.svg"></a>+<a href="https://opencollective.com/hledger/sponsor/3/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/3/avatar.svg"></a>+<a href="https://opencollective.com/hledger/sponsor/4/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/4/avatar.svg"></a>+<a href="https://opencollective.com/hledger/sponsor/5/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/5/avatar.svg"></a>+<a href="https://opencollective.com/hledger/sponsor/6/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/6/avatar.svg"></a>+<a href="https://opencollective.com/hledger/sponsor/7/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/7/avatar.svg"></a>+<a href="https://opencollective.com/hledger/sponsor/8/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/8/avatar.svg"></a>+<a href="https://opencollective.com/hledger/sponsor/9/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/9/avatar.svg"></a>+<a href="https://opencollective.com/hledger/sponsor/10/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/10/avatar.svg"></a>+<a href="https://opencollective.com/hledger/sponsor/11/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/11/avatar.svg"></a>+<a href="https://opencollective.com/hledger/sponsor/12/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/12/avatar.svg"></a>+<a href="https://opencollective.com/hledger/sponsor/13/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/13/avatar.svg"></a>+<a href="https://opencollective.com/hledger/sponsor/14/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/14/avatar.svg"></a>+<a href="https://opencollective.com/hledger/sponsor/15/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/15/avatar.svg"></a>+<a href="https://opencollective.com/hledger/sponsor/16/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/16/avatar.svg"></a>+<a href="https://opencollective.com/hledger/sponsor/17/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/17/avatar.svg"></a>+<a href="https://opencollective.com/hledger/sponsor/18/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/18/avatar.svg"></a>+<a href="https://opencollective.com/hledger/sponsor/19/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/19/avatar.svg"></a>+<a href="https://opencollective.com/hledger/sponsor/20/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/20/avatar.svg"></a>+<a href="https://opencollective.com/hledger/sponsor/21/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/21/avatar.svg"></a>+<a href="https://opencollective.com/hledger/sponsor/22/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/22/avatar.svg"></a>+<a href="https://opencollective.com/hledger/sponsor/23/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/23/avatar.svg"></a>+<a href="https://opencollective.com/hledger/sponsor/24/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/24/avatar.svg"></a>+<a href="https://opencollective.com/hledger/sponsor/25/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/25/avatar.svg"></a>+<a href="https://opencollective.com/hledger/sponsor/26/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/26/avatar.svg"></a>+<a href="https://opencollective.com/hledger/sponsor/27/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/27/avatar.svg"></a>+<a href="https://opencollective.com/hledger/sponsor/28/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/28/avatar.svg"></a>+<a href="https://opencollective.com/hledger/sponsor/29/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/29/avatar.svg"></a>+ [](http://www.gnu.org/licenses/gpl.html)-[](http://hackage.haskell.org/package/hledger)-[](http://stackage.org/lts/package/hledger)++[](#backers) +[](#sponsors)+[](https://github.com/simonmichael/hledger/issues?q=label:bounty)+[](http://bugs.hledger.org)++[](http://hackage.haskell.org/package/hledger)+[](http://stackage.org/nightly/package/hledger)+[](http://stackage.org/lts/package/hledger)+[](http://stackage.org/lts-7/package/hledger) <!-- [](https://github.com/simonmichael/hledger/releases) --> <!-- [](https://travis-ci.org/simonmichael/hledger)-[](http://packdeps.haskellers.com/feed?needle=hledger)-[](http://bugs.hledger.org)-[](https://github.com/simonmichael/hledger/issues?q=label:bounty)+[](http://packdeps.haskellers.com/feed?needle=hledger-lib)+[](http://packdeps.haskellers.com/feed?needle=hledger)+[](http://packdeps.haskellers.com/feed?needle=hledger-ui)+[](http://packdeps.haskellers.com/feed?needle=hledger-web)+[](http://packdeps.haskellers.com/feed?needle=hledger-api)
Text/Tabular/AsciiWide.hs view
@@ -9,26 +9,27 @@ -- | for simplicity, we assume that each cell is rendered -- on a single line-render :: (rh -> String)+render :: Bool -- ^ pretty tables+ -> (rh -> String) -> (ch -> String) -> (a -> String) -> Table rh ch a -> String-render fr fc f (Table rh ch cells) =+render pretty fr fc f (Table rh ch cells) = unlines $ [ bar SingleLine -- +--------------------------------------+- , renderColumns sizes ch2+ , renderColumns pretty sizes ch2 , bar DoubleLine -- +======================================+ ] ++ (renderRs $ fmap renderR $ zipHeader [] cells $ fmap fr rh) ++ [ bar SingleLine ] -- +--------------------------------------+ where- bar = concat . renderHLine sizes ch2+ bar = concat . renderHLine pretty sizes ch2 -- ch2 and cell2 include the row and column labels ch2 = Group DoubleLine [Header "", fmap fc ch] cells2 = headerContents ch2 : zipWith (\h cs -> h : map f cs) rhStrings cells --- renderR (cs,h) = renderColumns sizes $ Group DoubleLine+ renderR (cs,h) = renderColumns pretty sizes $ Group DoubleLine [ Header h , fmap fst $ zipHeader "" (map f cs) ch] rhStrings = map fr $ headerContents rh@@ -36,38 +37,73 @@ sizes = map (maximum . map strWidth) . transpose $ cells2 renderRs (Header s) = [s] renderRs (Group p hs) = concat . intersperse sep . map renderRs $ hs- where sep = renderHLine sizes ch2 p+ where sep = renderHLine pretty sizes ch2 p +verticalBar :: Bool -> Char+verticalBar pretty = if pretty then '│' else '|'++leftBar :: Bool -> String+leftBar pretty = verticalBar pretty : " "++rightBar :: Bool -> String+rightBar pretty = " " ++ [verticalBar pretty]++midBar :: Bool -> String+midBar pretty = " " ++ verticalBar pretty : " "++doubleMidBar :: Bool -> String+doubleMidBar pretty = if pretty then " ║ " else " || "++horizontalBar :: Bool -> Char+horizontalBar pretty = if pretty then '─' else '-'++doubleHorizontalBar :: Bool -> Char+doubleHorizontalBar pretty = if pretty then '═' else '='+ -- | We stop rendering on the shortest list!-renderColumns :: [Int] -- ^ max width for each column+renderColumns :: Bool -- ^ pretty+ -> [Int] -- ^ max width for each column -> Header String -> String-renderColumns is h = "| " ++ coreLine ++ " |"+renderColumns pretty is h = leftBar pretty ++ coreLine ++ rightBar pretty where coreLine = concatMap helper $ flattenHeader $ zipHeader 0 is h helper = either hsep (uncurry padLeftWide) hsep :: Properties -> String hsep NoLine = " "- hsep SingleLine = " | "- hsep DoubleLine = " || "+ hsep SingleLine = midBar pretty+ hsep DoubleLine = doubleMidBar pretty -renderHLine :: [Int] -- ^ width specifications+renderHLine :: Bool -- ^ pretty+ -> [Int] -- ^ width specifications -> Header String -> Properties -> [String]-renderHLine _ _ NoLine = []-renderHLine w h SingleLine = [renderHLine' w '-' h]-renderHLine w h DoubleLine = [renderHLine' w '=' h]+renderHLine _ _ _ NoLine = []+renderHLine pretty w h SingleLine = [renderHLine' pretty SingleLine w (horizontalBar pretty) h]+renderHLine pretty w h DoubleLine = [renderHLine' pretty DoubleLine w (doubleHorizontalBar pretty) h] -renderHLine' :: [Int] -> Char -> Header String -> String-renderHLine' is sep h = [ '+', sep ] ++ coreLine ++ [sep, '+']+doubleCross :: Bool -> String+doubleCross pretty = if pretty then "╬" else "++"++doubleVerticalCross :: Bool -> String+doubleVerticalCross pretty = if pretty then "╫" else "++"++cross :: Bool -> Char+cross pretty = if pretty then '┼' else '+'++renderHLine' :: Bool -> Properties -> [Int] -> Char -> Header String -> String+renderHLine' pretty prop is sep h = [ cross pretty, sep ] ++ coreLine ++ [sep, cross pretty] where coreLine = concatMap helper $ flattenHeader $ zipHeader 0 is h helper = either vsep dashes dashes (i,_) = replicate i sep vsep NoLine = [sep]- vsep SingleLine = sep : "+" ++ [sep]- vsep DoubleLine = sep : "++" ++ [sep]+ vsep SingleLine = sep : cross pretty : [sep]+ vsep DoubleLine = sep : cross' ++ [sep]+ cross' = case prop of+ DoubleLine -> doubleCross pretty+ _ -> doubleVerticalCross pretty -- padLeft :: Int -> String -> String -- padLeft l s = padding ++ s
bench/bench.hs view
@@ -1,14 +1,11 @@ -- bench -- By default, show approximate times for some standard hledger operations on a sample journal. -- With --criterion, show accurate times (slow).--- TODO With --quickbench, show approximate times for the commands in default.bench, using the first hledger executable on $PATH. import Criterion.Main (defaultMainWith, defaultConfig, bench, nfIO) -- import QuickBench (defaultMain) import System.Directory (getCurrentDirectory) import System.Environment (getArgs, withArgs)-import System.Info (os)-import System.Process (readProcess) import System.TimeIt (timeItT) import Text.Printf import Hledger.Cli@@ -60,14 +57,3 @@ bench ("balance") $ nfIO $ balance opts j, bench ("stats") $ nfIO $ stats opts j ]---- benchWithQuickbench = do--- let whichcmd = if os == "mingw32" then "where" else "which"--- exe <- init <$> readProcess whichcmd ["hledger"] ""--- pwd <- getCurrentDirectory--- printf "Benchmarking %s in %s with quickbench and shell\n" exe pwd--- flip withArgs QuickBench.defaultMain [--- "-fbench/default.bench"--- ,"-v"--- ,"hledger"--- ]
doc/hledger.1 view
@@ -1,2589 +1,2578 @@ .\"t -.TH "hledger" "1" "December 2016" "hledger 1.1" "hledger User Manuals"----.SH NAME-.PP-hledger \- a command\-line accounting tool-.SH SYNOPSIS-.PP-\f[C]hledger\ [\-f\ FILE]\ COMMAND\ [OPTIONS]\ [CMDARGS]\f[]-.PD 0-.P-.PD-\f[C]hledger\ [\-f\ FILE]\ ADDONCMD\ \-\-\ [OPTIONS]\ [CMDARGS]\f[]-.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's command\-line interface (there are also curses 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.-.PP-hledger reads data from one or more files in hledger journal, timeclock,-timedot, or CSV format specified with \f[C]\-f\f[], or-\f[C]$LEDGER_FILE\f[], or \f[C]$HOME/.hledger.journal\f[] (on windows,-perhaps \f[C]C:/Users/USER/.hledger.journal\f[]).-If using \f[C]$LEDGER_FILE\f[], note this must be a real environment-variable, not a shell variable.-You can specify standard input with \f[C]\-f\-\f[].-.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[]-.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'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]~/.hledger.journal\f[], or run \f[C]hledger\ add\f[] and follow the-prompts.-Then try some commands like \f[C]hledger\ print\f[] or-\f[C]hledger\ balance\f[].-See COMMANDS and EXAMPLES below.-.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[]-.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[]-.fi-.IP-.nf-\f[C]-$\ hledger\ accounts\ \-\-tree-assets-\ \ cash-expenses-\ \ food-income-\ \ gifts-\f[]-.fi-.IP-.nf-\f[C]-$\ hledger\ balance-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $10\ \ assets:cash-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $10\ \ expenses:food-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-20\ \ income:gifts-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0-\f[]-.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[]-.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[]-.fi-.PP-With the journal-.IP-.nf-\f[C]-2016/02/16\ Member\ Fee\ Payment\ John\ Doe-\ \ \ \ assets:bank\ account\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 2\ EUR-\ \ \ \ income:member\ fees\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \-2\ EUR-\ \ \ \ \ \ ;\ member:\ John\ Doe-\f[]-.fi-.PP-the \-\-pivot comand will output the following:-.IP-.nf-\f[C]-$\ hledger\ bal\ \-\-pivot\ member-\ \ \ \ 2\ EUR\ \ assets:bank\ account-\ \ \ \-2\ EUR\ \ member:John\ Doe-\f[]-.fi-.SH OPTIONS-.PP-To see general usage and the command list: \f[C]hledger\ \-h\f[] or just-\f[C]hledger\f[].-To see usage for a specific command: \f[C]hledger\ COMMAND\ \-h\f[].-.PP-hledger has several kinds of options:-.IP \[bu] 2-General options are always available and can appear anywhere on the-command line.-\f[C]hledger\ \-h\f[] shows these.-Eg: \f[C]hledger\ \-\-version\f[].-.IP \[bu] 2-Common reporting options are available with most commands.-These and all other non\-general options must be written after COMMAND.-\f[C]hledger\ COMMAND\ \-h\f[] shows these.-Eg: \f[C]hledger\ register\ \-\-cleared\f[].-.IP \[bu] 2-Command\-specific options are also provided by some commands.-\f[C]hledger\ COMMAND\ \-h\f[] shows these too.-Eg: \f[C]hledger\ register\ \-\-average\f[].-.IP \[bu] 2-Some hledger commands come from separate add\-on executables, which have-their own options.-\f[C]hledger\ COMMAND\ \-h\f[] shows these, as usual.-Such options, if not also supported by hledger, should be written-following a double hyphen argument (\f[C]\-\-\f[]) so that hledger\[aq]s-option parser does not complain.-Eg: \f[C]hledger\ ui\ \-\-\ \-\-register=checking\f[].-Or, you can just run the add\-on directly:-\f[C]hledger\-ui\ \-\-register=checking\f[].-.PP-Command arguments may also follow the command name.-In most cases these specify a query which filters the data.-Command options and arguments can be intermixed.-.PP-Option and argument values containing problematic characters should be-escaped with double quotes, backslashes, or (best) single quotes.-This means spaces, but also characters which are significant to your-command shell, such as less\-than/greater\-than.-Eg:-\f[C]hledger\ register\ \-p\ \[aq]last\ year\[aq]\ "accounts\ receivable\ (receivable|payable)"\ amt:\\>100\f[].-.PP-Characters which are significant to the shell and also in regular-expressions, like parentheses, the pipe symbol and the dollar sign, must-sometimes be double\-escaped.-Eg, to match the dollar symbol:-\f[C]hledger\ balance\ cur:\[aq]\\$\[aq]\f[] or-\f[C]hledger\ balance\ cur:\\\\$\f[].-.PP-There\[aq]s more..-options and arguments being passed by hledger to an add\-on executable-get de\-escaped once in the process.-In this case you might need triple\-escaping.-Eg: \f[C]hledger\ ui\ cur:\[aq]\\\\$\[aq]\f[] or-\f[C]hledger\ ui\ cur:\\\\\\\\$\f[].-.PP-If in doubt, keep things simple:-.IP \[bu] 2-write options after the command-.IP \[bu] 2-enclose problematic args in single quotes-.IP \[bu] 2-if needed, also add a backslash to escape regexp metacharacters-.IP \[bu] 2-run add\-on executables directly-.PP-If you\[aq]re really curious, add \f[C]\-\-debug=2\f[] for-troubleshooting.-.SS General options-.PP-Always available, can be written before or after COMMAND.-.TP-.B \f[C]\-h\f[]-show general usage (or after COMMAND, the command\[aq]s usage)-.RS-.RE-.TP-.B \f[C]\-\-help\f[]-show the current program\[aq]s manual as plain text (or after an add\-on-COMMAND, the add\-on\[aq]s manual)-.RS-.RE-.TP-.B \f[C]\-\-man\f[]-show the current program\[aq]s manual with man-.RS-.RE-.TP-.B \f[C]\-\-info\f[]-show the current program\[aq]s manual with info-.RS-.RE-.TP-.B \f[C]\-\-version\f[]-show version-.RS-.RE-.TP-.B \f[C]\-\-debug[=N]\f[]-show debug output (levels 1\-9, default: 1)-.RS-.RE-.TP-.B \f[C]\-f\ FILE\ \-\-file=FILE\f[]-use a different input file.-For stdin, use \--.RS-.RE-.TP-.B \f[C]\-\-rules\-file=RULESFILE\f[]-Conversion rules file to use when reading CSV (default: FILE.rules)-.RS-.RE-.TP-.B \f[C]\-\-alias=OLD=NEW\f[]-display accounts named OLD as NEW-.RS-.RE-.TP-.B \f[C]\-I\ \-\-ignore\-assertions\f[]-ignore any failing balance assertions in the journal-.RS-.RE-.SS Reporting options-.PP-Common reporting options, must be written after COMMAND.-.TP-.B \f[C]\-b\ \-\-begin=DATE\f[]-include postings/txns on or after this date-.RS-.RE-.TP-.B \f[C]\-e\ \-\-end=DATE\f[]-include postings/txns before this date-.RS-.RE-.TP-.B \f[C]\-D\ \-\-daily\f[]-multiperiod/multicolumn report by day-.RS-.RE-.TP-.B \f[C]\-W\ \-\-weekly\f[]-multiperiod/multicolumn report by week-.RS-.RE-.TP-.B \f[C]\-M\ \-\-monthly\f[]-multiperiod/multicolumn report by month-.RS-.RE-.TP-.B \f[C]\-Q\ \-\-quarterly\f[]-multiperiod/multicolumn report by quarter-.RS-.RE-.TP-.B \f[C]\-Y\ \-\-yearly\f[]-multiperiod/multicolumn report by year-.RS-.RE-.TP-.B \f[C]\-p\ \-\-period=PERIODEXP\f[]-set start date, end date, and/or reporting interval all at once-(overrides the flags above)-.RS-.RE-.TP-.B \f[C]\-\-date2\f[]-show, and match with \-b/\-e/\-p/date:, secondary dates instead-.RS-.RE-.TP-.B \f[C]\-C\ \-\-cleared\f[]-include only cleared postings/txns-.RS-.RE-.TP-.B \f[C]\-\-pending\f[]-include only pending postings/txns-.RS-.RE-.TP-.B \f[C]\-U\ \-\-uncleared\f[]-include only uncleared (and pending) postings/txns-.RS-.RE-.TP-.B \f[C]\-R\ \-\-real\f[]-include only non\-virtual postings-.RS-.RE-.TP-.B \f[C]\-\-depth=N\f[]-hide accounts/postings deeper than N-.RS-.RE-.TP-.B \f[C]\-E\ \-\-empty\f[]-show items with zero amount, normally hidden-.RS-.RE-.TP-.B \f[C]\-B\ \-\-cost\f[]-convert amounts to their cost at transaction time (using the transaction-price, if any)-.RS-.RE-.TP-.B \f[C]\-\-pivot\ TAG\f[]-will transform the journal before any other processing by replacing the-account name of every posting having the tag TAG with content VALUE by-the account name "TAG:VALUE".-The TAG will only match if it is a full\-length match.-The pivot will only happen if the TAG is on a posting, not if it is on-the transaction.-If the tag value is a multi:level:account:name the new account name will-be "TAG:multi:level:account:name".-.RS-.RE-.TP-.B \f[C]\-\-anon\f[]-show anonymized accounts and payees-.RS-.RE-.PP-If a reporting option occurs more than once on the command line, the-last one takes precedence.-Eg \-p jan \-p feb is equivalent to \-p feb.-.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[] (or on Windows,-something like \f[C]C:/Users/USER/.hledger.journal\f[]).-You can override this with the \f[C]$LEDGER_FILE\f[] environment-variable:-.IP-.nf-\f[C]-$\ setenv\ LEDGER_FILE\ ~/finance/2016.journal-$\ hledger\ stats-\f[]-.fi-.PP-or with the \f[C]\-f/\-\-file\f[] option:-.IP-.nf-\f[C]-$\ hledger\ \-f\ /some/file\ stats-\f[]-.fi-.PP-The file name \f[C]\-\f[] (hyphen) means standard input:-.IP-.nf-\f[C]-$\ cat\ some.journal\ |\ hledger\ \-f\--\f[]-.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 "reader" in turn:-.PP-.TS-tab(@);-lw(10.7n) lw(33.2n) lw(26.1n).-T{-Reader:-T}@T{-Reads:-T}@T{-Used for file extensions:-T}-_-T{-\f[C]journal\f[]-T}@T{-hledger\[aq]s journal format, also some Ledger journals-T}@T{-\f[C]\&.journal\f[] \f[C]\&.j\f[] \f[C]\&.hledger\f[] \f[C]\&.ledger\f[]-T}-T{-\f[C]timeclock\f[]-T}@T{-timeclock files (precise time logging)-T}@T{-\f[C]\&.timeclock\f[]-T}-T{-\f[C]timedot\f[]-T}@T{-timedot files (approximate time logging)-T}@T{-\f[C]\&.timedot\f[]-T}-T{-\f[C]csv\f[]-T}@T{-comma\-separated values (data interchange)-T}@T{-\f[C]\&.csv\f[]-T}-.TE-.PP-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:-.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[]-.fi-.PP-You can also specify multiple \f[C]\-f\f[] options, to read multiple-files as one big journal.-(Directives in one file will not affect the other files.-If you need that, use the include directive instead.)-.SS Depth limiting-.PP-With the \f[C]\-\-depth\ N\f[] option, 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.-.SS Smart dates-.PP-hledger\[aq]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\[aq]s-date, and can have less\-significant date parts omitted (defaulting to-1).-.PP-Examples:-.PP-.TS-tab(@);-l l.-T{-\f[C]2009/1/1\f[], \f[C]2009/01/01\f[], \f[C]2009\-1\-1\f[],-\f[C]2009.1.1\f[]-T}@T{-simple dates, several separators allowed-T}-T{-\f[C]2009/1\f[], \f[C]2009\f[]-T}@T{-same as above \- a missing day or month defaults to 1-T}-T{-\f[C]1/1\f[], \f[C]january\f[], \f[C]jan\f[], \f[C]this\ year\f[]-T}@T{-relative dates, meaning january 1 of the current year-T}-T{-\f[C]next\ year\f[]-T}@T{-january 1 of next year-T}-T{-\f[C]this\ month\f[]-T}@T{-the 1st of the current month-T}-T{-\f[C]this\ week\f[]-T}@T{-the most recent monday-T}-T{-\f[C]last\ week\f[]-T}@T{-the monday of the week before this one-T}-T{-\f[C]lastweek\f[]-T}@T{-spaces are optional-T}-T{-\f[C]today\f[], \f[C]yesterday\f[], \f[C]tomorrow\f[]-T}@T{-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[],-\f[C]\-e/\-\-end\f[], \f[C]\-p/\-\-period\f[] or a \f[C]date:\f[] query-(described below).-All of these accept the smart date syntax.-One important thing to be aware of when specifying end dates: as in-Ledger, end dates are exclusive, so you need to write the date-\f[I]after\f[] the last day you want to include.-.PP-Examples:-.PP-.TS-tab(@);-l l.-T{-\f[C]\-b\ 2016/3/17\f[]-T}@T{-begin on St.-Patrick\[aq]s day 2016-T}-T{-\f[C]\-e\ 12/1\f[]-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[]-T}@T{-all transactions on or after the 1st of the current month-T}-T{-\f[C]\-p\ thismonth\f[]-T}@T{-all transactions in the current month-T}-T{-\f[C]date:2016/3/17\-\f[]-T}@T{-the above written as queries instead-T}-T{-\f[C]date:\-12/1\f[]-T}@T{-T}-T{-\f[C]date:thismonth\-\f[]-T}@T{-T}-T{-\f[C]date:thismonth\f[]-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[],-\f[C]\-W/\-\-weekly\f[], \f[C]\-M/\-\-monthly\f[],-\f[C]\-Q/\-\-quarterly\f[], or \f[C]\-Y/\-\-yearly\f[].-More complex intervals may be specified with a period expression.-Report intervals can not be specified with a query, currently.-.SS Period expressions-.PP-The \f[C]\-p/\-\-period\f[] 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\ "from\ 2009/1/1\ to\ 2009/4/1"\f[]-.PP-Keywords like "from" and "to" are optional, and so are the spaces, as-long as you don\[aq]t run two dates together.-"to" can also be written as "\-".-These are equivalent to the above:-.PP-.TS-tab(@);-l.-T{-\f[C]\-p\ "2009/1/1\ 2009/4/1"\f[]-T}-T{-\f[C]\-p2009/1/1to2009/4/1\f[]-T}-T{-\f[C]\-p2009/1/1\-2009/4/1\f[]-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\ "1/1\ 4/1"\f[]-T}-T{-\f[C]\-p\ "january\-apr"\f[]-T}-T{-\f[C]\-p\ "this\ year\ to\ 4/1"\f[]-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\ "from\ 2009/1/1"\f[]-T}@T{-everything after january 1, 2009-T}-T{-\f[C]\-p\ "from\ 2009/1"\f[]-T}@T{-the same-T}-T{-\f[C]\-p\ "from\ 2009"\f[]-T}@T{-the same-T}-T{-\f[C]\-p\ "to\ 2009"\f[]-T}@T{-everything before january 1, 2009-T}-.TE-.PP-A single date with no "from" or "to" defines both the start and end date-like so:-.PP-.TS-tab(@);-l l.-T{-\f[C]\-p\ "2009"\f[]-T}@T{-the year 2009; equivalent to "2009/1/1 to 2010/1/1"-T}-T{-\f[C]\-p\ "2009/1"\f[]-T}@T{-the month of jan; equivalent to "2009/1/1 to 2009/2/1"-T}-T{-\f[C]\-p\ "2009/1/1"\f[]-T}@T{-just that day; equivalent to "2009/1/1 to 2009/1/2"-T}-.TE-.PP-The argument of \f[C]\-p\f[] can also begin with, or be, a report-interval expression.-The basic report intervals are \f[C]daily\f[], \f[C]weekly\f[],-\f[C]monthly\f[], \f[C]quarterly\f[], or \f[C]yearly\f[], which have the-same effect as the \f[C]\-D\f[],\f[C]\-W\f[],\f[C]\-M\f[],\f[C]\-Q\f[],-or \f[C]\-Y\f[] flags.-Between report interval and start/end dates (if any), the word-\f[C]in\f[] is optional.-Examples:-.PP-.TS-tab(@);-l.-T{-\f[C]\-p\ "weekly\ from\ 2009/1/1\ to\ 2009/4/1"\f[]-T}-T{-\f[C]\-p\ "monthly\ in\ 2008"\f[]-T}-T{-\f[C]\-p\ "quarterly"\f[]-T}-.TE-.PP-The following more complex report intervals are also supported:-\f[C]biweekly\f[], \f[C]bimonthly\f[],-\f[C]every\ N\ days|weeks|months|quarters|years\f[],-\f[C]every\ Nth\ day\ [of\ month]\f[],-\f[C]every\ Nth\ day\ of\ week\f[].-.PP-Examples:-.PP-.TS-tab(@);-l.-T{-\f[C]\-p\ "bimonthly\ from\ 2008"\f[]-T}-T{-\f[C]\-p\ "every\ 2\ weeks"\f[]-T}-T{-\f[C]\-p\ "every\ 5\ days\ from\ 1/3"\f[]-T}-.TE-.PP-Show historical balances at end of 15th each month (N is exclusive end-date):-.PP-\f[C]hledger\ balance\ \-H\ \-p\ "every\ 16th\ day"\f[]-.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\ "every\ 3rd\ day\ of\ week"\f[]-.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[], \f[C]desc:REGEX\f[], \f[C]cur:REGEX\f[],-\f[C]tag:...=REGEX\f[]-.IP \[bu] 2-CSV rules conditional blocks: \f[C]if\ REGEX\ ...\f[]-.IP \[bu] 2-account alias directives and options:-\f[C]alias\ /REGEX/\ =\ REPLACEMENT\f[],-\f[C]\-\-alias\ /REGEX/=REPLACEMENT\f[]-.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 (\\<, \\>, \\b, \\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[] directive and \f[C]\-\-alias\f[] option, regular-expressions must be enclosed in forward slashes (\f[C]/REGEX/\f[]).-Elsewhere in hledger, these are not required.-.IP \[bu] 2-To match a regular expression metacharacter like \f[C]$\f[] as a literal-character, prepend a backslash.-Eg to search for amounts with the dollar sign in hledger\-web, write-\f[C]cur:\\$\f[].-.IP \[bu] 2-On the command line, some metacharacters like \f[C]$\f[] have a special-meaning to the shell and so must be escaped a second time, with single-or double quotes or another backslash.-Eg, to match amounts with the dollar sign from the command line, write-\f[C]cur:\[aq]\\$\[aq]\f[] or \f[C]cur:\\\\$\f[].-.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, optional prefixes to match-specific fields.-Multiple search terms are combined as follows:-.PP-All commands except print: 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-all the other terms.-.PP-The print command: show 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:-.TP-.B \f[B]\f[C]REGEX\f[]\f[]-match account names by this regular expression-.RS-.RE-.TP-.B \f[B]\f[C]acct:REGEX\f[]\f[]-same as above-.RS-.RE-.TP-.B \f[B]\f[C]amt:N,\ amt:<N,\ amt:<=N,\ amt:>N,\ amt:>=N\f[]\f[]-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.-.RS-.RE-.TP-.B \f[B]\f[C]code:REGEX\f[]\f[]-match by transaction code (eg check number)-.RS-.RE-.TP-.B \f[B]\f[C]cur:REGEX\f[]\f[]-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[]).-Note, to match characters which are regex\-significant, like the dollar-sign (\f[C]$\f[]), you need to prepend \f[C]\\\f[].-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]\\$\[aq]\f[] or-\f[C]hledger\ print\ cur:\\\\$\f[].-.RS-.RE-.TP-.B \f[B]\f[C]desc:REGEX\f[]\f[]-match transaction descriptions-.RS-.RE-.TP-.B \f[B]\f[C]date:PERIODEXPR\f[]\f[]-match dates within the specified period.-PERIODEXPR is a period expression (with no report interval).-Examples: \f[C]date:2016\f[], \f[C]date:thismonth\f[],-\f[C]date:2000/2/1\-2/15\f[], \f[C]date:lastweek\-\f[].-If the \f[C]\-\-date2\f[] command line flag is present, this matches-secondary dates instead.-.RS-.RE-.TP-.B \f[B]\f[C]date2:PERIODEXPR\f[]\f[]-match secondary dates within the specified period.-.RS-.RE-.TP-.B \f[B]\f[C]depth:N\f[]\f[]-match (or display, depending on command) accounts at or above this depth-.RS-.RE-.TP-.B \f[B]\f[C]real:,\ real:0\f[]\f[]-match real or virtual postings respectively-.RS-.RE-.TP-.B \f[B]\f[C]status:*,\ status:!,\ status:\f[]\f[]-match cleared, pending, or uncleared/pending transactions respectively-.RS-.RE-.TP-.B \f[B]\f[C]tag:REGEX[=REGEX]\f[]\f[]-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.-.RS-.RE-.TP-.B \f[B]\f[C]not:\f[]\f[]-before any of the above negates the match.-.RS-.RE-.TP-.B \f[B]\f[C]inacct:ACCTNAME\f[]\f[]-a special term used automatically when you click an account name in-hledger\-web, specifying the account register we are currently in-(selects the transactions of that account and how to show them, can be-filtered further with \f[C]acct\f[] etc).-Not supported elsewhere in hledger.-.RS-.RE-.PP-Some of these can also be expressed as command\-line options (eg-\f[C]depth:2\f[] is equivalent to \f[C]\-\-depth\ 2\f[]).-Generally you can mix options and query arguments, and the resulting-query will be their intersection (perhaps excluding the-\f[C]\-p/\-\-period\f[] option).-.SH COMMANDS-.PP-hledger provides a number of subcommands; \f[C]hledger\f[] with no-arguments shows a list.-.PP-If you install additional \f[C]hledger\-*\f[] packages, or if you put-programs or scripts named \f[C]hledger\-NAME\f[] 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[]).-You can also write any unambiguous prefix of a command name-(\f[C]hledger\ inc\f[]), or one of the standard short aliases displayed-in the command list (\f[C]hledger\ is\f[]).-.SS accounts-.PP-Show account names.-.TP-.B \f[C]\-\-tree\f[]-show short account names, as a tree-.RS-.RE-.TP-.B \f[C]\-\-flat\f[]-show full account names, as a list (default)-.RS-.RE-.TP-.B \f[C]\-\-drop=N\f[]-in flat mode: omit N leading account name parts-.RS-.RE-.PP-This command lists all account names that are in use (ie, all the-accounts which have at least one transaction posting to them).-With query arguments, only matched account names are shown.-.PP-It shows a flat list by default.-With \f[C]\-\-tree\f[], it uses indentation to show the account-hierarchy.-.PP-In flat mode you can add \f[C]\-\-drop\ N\f[] to omit the first few-account name components.-.PP-Examples:-.IP-.nf-\f[C]-$\ hledger\ accounts\ \-\-tree-assets-\ \ bank-\ \ \ \ checking-\ \ \ \ saving-\ \ cash-expenses-\ \ food-\ \ supplies-income-\ \ gifts-\ \ salary-liabilities-\ \ debts-\f[]-.fi-.IP-.nf-\f[C]-$\ hledger\ accounts\ \-\-drop\ 1-bank:checking-bank:saving-cash-food-supplies-gifts-salary-debts-\f[]-.fi-.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[]-.fi-.SS activity-.PP-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.-.IP-.nf-\f[C]-$\ hledger\ activity\ \-\-quarterly-2008\-01\-01\ **-2008\-04\-01\ *******-2008\-07\-01\ -2008\-10\-01\ **-\f[]-.fi-.SS add-.PP-Prompt for transactions and add them to the journal.-.TP-.B \f[C]\-\-no\-new\-accounts\f[]-don\[aq]t allow creating new accounts; helps prevent typos when entering-account names-.RS-.RE-.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[] 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[] 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[] and follow the prompts.-You can add as many transactions as you like; when you are finished,-enter \f[C]\&.\f[] or press control\-d or control\-c to exit.-.PP-Features:-.IP \[bu] 2-add tries to provide useful defaults, using the most similar recent-transaction (by description) 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[], \f[C]today\f[],-\f[C]tomorrow\f[]).-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[] 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/data/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[]-.fi-.SS balance-.PP-Show accounts and their balances.-Alias: bal.-.TP-.B \f[C]\-\-change\f[]-show balance change in each period (default)-.RS-.RE-.TP-.B \f[C]\-\-cumulative\f[]-show balance change accumulated across periods (in multicolumn reports)-.RS-.RE-.TP-.B \f[C]\-H\ \-\-historical\f[]-show historical ending balance in each period (includes postings before-report start date)-.RS-.RE-.TP-.B \f[C]\-\-tree\f[]-show accounts as a tree; amounts include subaccounts (default in simple-reports)-.RS-.RE-.TP-.B \f[C]\-\-flat\f[]-show accounts as a list; amounts exclude subaccounts except when account-is depth\-clipped (default in multicolumn reports)-.RS-.RE-.TP-.B \f[C]\-V\ \-\-value\f[]-convert amounts to their market value on the report end date (using the-most recent applicable market price, if any)-.RS-.RE-.TP-.B \f[C]\-A\ \-\-average\f[]-show a row average column (in multicolumn mode)-.RS-.RE-.TP-.B \f[C]\-T\ \-\-row\-total\f[]-show a row total column (in multicolumn mode)-.RS-.RE-.TP-.B \f[C]\-N\ \-\-no\-total\f[]-don\[aq]t show the final total row-.RS-.RE-.TP-.B \f[C]\-\-drop=N\f[]-omit N leading account name parts (in flat mode)-.RS-.RE-.TP-.B \f[C]\-\-no\-elide\f[]-don\[aq]t squash boring parent accounts (in tree mode)-.RS-.RE-.TP-.B \f[C]\-\-format=LINEFORMAT\f[]-in single\-column balance reports: use this custom line format-.RS-.RE-.TP-.B \f[C]\-O\ FMT\ \-\-output\-format=FMT\f[]-select the output format.-Supported formats: txt, csv.-.RS-.RE-.TP-.B \f[C]\-o\ FILE\ \-\-output\-file=FILE\f[]-write output to FILE.-A file extension matching one of the above formats selects that format.-.RS-.RE-.PP-The balance command displays accounts and balances.-It is hledger\[aq]s most featureful and most useful command.-.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[]-.fi-.PP-More precisely, the balance command shows the \f[I]change\f[] to each-account\[aq]s balance caused by all (matched) postings.-In the common case where you do not filter by date and your journal sets-the correct opening balances, this is the same as the account\[aq]s-ending balance.-.PP-By default, accounts are displayed hierarchically, with subaccounts-indented below their parent.-"Boring" accounts, which contain a single interesting subaccount and no-balance of their own, are elided into the following line for more-compact output.-(Use \f[C]\-\-no\-elide\f[] to prevent this.)-.PP-Each account\[aq]s balance is the "inclusive" balance \- it includes the-balances of any subaccounts.-.PP-Accounts which have zero balance (and no non\-zero subaccounts) are-omitted.-Use \f[C]\-E/\-\-empty\f[] to show them.-.PP-A final total is displayed by default; use \f[C]\-N/\-\-no\-total\f[] to-suppress it:-.IP-.nf-\f[C]-$\ hledger\ balance\ \-p\ 2008/6\ expenses\ \-\-no\-total-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $2\ \ expenses-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ food-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ supplies-\f[]-.fi-.SS Flat mode-.PP-To see a flat list of full account names instead of the default-hierarchical display, use \f[C]\-\-flat\f[].-In this mode, accounts (unless depth\-clipped) show their "exclusive"-balance, excluding any subaccount balances.-In this mode, you can also use \f[C]\-\-drop\ N\f[] 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[]-.fi-.SS Depth limited balance reports-.PP-With \f[C]\-\-depth\ N\f[], balance shows accounts only to the specified-depth.-This is very useful to show a complex charts of accounts in less detail.-In flat mode, balances from accounts below the depth limit will be shown-as part of a parent account at the depth limit.-.IP-.nf-\f[C]-$\ hledger\ balance\ \-N\ \-\-depth\ 1-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ assets-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $2\ \ expenses-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2\ \ income-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ liabilities-\f[]-.fi-.SS Multicolumn balance reports-.PP-With a reporting interval, multiple balance columns will be shown, one-for each report period.-There are three types of multi\-column 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[]-.fi-.RE-.IP "2." 3-With \f[C]\-\-cumulative\f[]: 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[]-.fi-.RE-.IP "3." 3-With \f[C]\-\-historical/\-H\f[]: 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\ ^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\ -\f[]-.fi-.RE-.PP-Multi\-column balance reports display accounts in flat mode by default;-to see the hierarchy, use \f[C]\-\-tree\f[].-.PP-With a reporting interval (like \f[C]\-\-quarterly\f[] 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.-.PP-The \f[C]\-E/\-\-empty\f[] 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[] flag adds an additional column showing-the total for each row.-.PP-The \f[C]\-A/\-\-average\f[] 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[]-.fi-.SS Market value-.PP-The \f[C]\-V/\-\-value\f[] flag converts the reported amounts to their-market value on the report end date, using the most recent applicable-market prices, when known.-Specifically, when there is a market price (P directive) for the-amount\[aq]s commodity, dated on or before the report end date (see-hledger \-> Report start & end date), the amount will be converted to-the price\[aq]s commodity.-If multiple applicable prices are defined, the latest\-dated one is used-(and if dates are equal, the one last parsed).-.PP-For example:-.IP-.nf-\f[C]-#\ 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-\f[]-.fi-.PP-How many euros do I have ?-.IP-.nf-\f[C]-$\ hledger\ \-f\ t.j\ bal\ euros-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ €100\ \ assets:euros-\f[]-.fi-.PP-What are they worth on nov 3 ?-(no report end date specified, defaults to the last date in the journal)-.IP-.nf-\f[C]-$\ hledger\ \-f\ t.j\ bal\ euros\ \-V-\ \ \ \ \ \ \ \ \ \ \ \ \ $110.00\ \ assets:euros-\f[]-.fi-.PP-What are they worth on dec 21 ?-.IP-.nf-\f[C]-$\ hledger\ \-f\ t.j\ bal\ euros\ \-V\ \-e\ 2016/12/21-\ \ \ \ \ \ \ \ \ \ \ \ \ $103.00\ \ assets:euros-\f[]-.fi-.PP-Currently, hledger\[aq]s \-V only uses market prices recorded with P-directives, not transaction prices (unlike Ledger).-.PP-Using \-B and \-V together is allowed.-.SS Custom balance output-.PP-In simple (non\-multi\-column) balance reports, you can customise the-output with \f[C]\-\-format\ FMT\f[]:-.IP-.nf-\f[C]-$\ 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-\f[]-.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[]-.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[] \- 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[] \- the account\[aq]s name-.IP \[bu] 2-\f[C]total\f[] \- 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[] \- render on multiple lines, bottom\-aligned (the default)-.IP \[bu] 2-\f[C]%^\f[] \- render on multiple lines, top\-aligned-.IP \[bu] 2-\f[C]%,\f[] \- render on one line, comma\-separated-.PP-There are some quirks.-Eg in one\-line mode, \f[C]%(depth_spacer)\f[] has no effect, instead-\f[C]%(account)\f[] has indentation built in.- Experimentation may be needed to get pleasing results.-.PP-Some example formats:-.IP \[bu] 2-\f[C]%(total)\f[] \- the account\[aq]s total-.IP \[bu] 2-\f[C]%\-20.20(account)\f[] \- 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[] \- 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[] \- the default-format for the single\-column balance report-.SS Output destination-.PP-The balance, print, register and stats commands can write their output-to a destination other than the console.-This is controlled by the \f[C]\-o/\-\-output\-file\f[] option.-.IP-.nf-\f[C]-$\ hledger\ balance\ \-o\ \-\ \ \ \ \ #\ write\ to\ stdout\ (the\ default)-$\ hledger\ balance\ \-o\ FILE\ \ #\ write\ to\ FILE-\f[]-.fi-.SS CSV output-.PP-The balance, print and register commands can write their output as CSV.-This is useful for exporting data to other applications, eg to make-charts in a spreadsheet.-This is controlled by the \f[C]\-O/\-\-output\-format\f[] option, or by-specifying a \f[C]\&.csv\f[] file extension with-\f[C]\-o/\-\-output\-file\f[].-.IP-.nf-\f[C]-$\ hledger\ balance\ \-O\ csv\ \ \ \ \ \ \ #\ write\ CSV\ to\ stdout-$\ hledger\ balance\ \-o\ FILE.csv\ \ #\ write\ CSV\ to\ FILE.csv-\f[]-.fi-.SS balancesheet-.PP-Show a balance sheet.-Alias: bs.-.TP-.B \f[C]\-\-flat\f[]-show full account names, as a list (default)-.RS-.RE-.TP-.B \f[C]\-\-drop=N\f[]-in flat mode: omit N leading account name parts-.RS-.RE-.PP-This command displays a simple balance sheet.-It currently assumes that you have top\-level accounts named-\f[C]asset\f[] and \f[C]liability\f[] (plural forms also allowed.)-.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[]-.fi-.SS cashflow-.PP-Show a cashflow statement.-Alias: cf.-.TP-.B \f[C]\-\-flat\f[]-show full account names, as a list (default)-.RS-.RE-.TP-.B \f[C]\-\-drop=N\f[]-in flat mode: omit N leading account name parts-.RS-.RE-.PP-This command displays a simple cashflow statement It shows the change in-all "cash" (ie, liquid assets) accounts for the period.-It currently assumes that cash accounts are under a top\-level account-named \f[C]asset\f[] and do not contain \f[C]receivable\f[] or-\f[C]A/R\f[] (plural forms also allowed.)-.IP-.nf-\f[C]-$\ hledger\ cashflow-Cashflow\ Statement--Cash\ flows:-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ assets-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ bank:saving-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2\ \ \ \ cash-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1--Total:-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1-\f[]-.fi-.SS help-.PP-Show any of the hledger manuals.-.PP-The \f[C]help\f[] command displays any of the main hledger man pages.-(Unlike \f[C]hledger\ \-\-help\f[], which displays only the hledger man-page.) Run it with no arguments to list available topics (their names-are shortened for easier typing), and run \f[C]hledger\ help\ TOPIC\f[]-to select one.-The output is similar to a man page, but fixed width.-It may be long, so you may wish to pipe it into a pager.-See also info and man.-.IP-.nf-\f[C]-$\ hledger\ help-Choose\ a\ topic,\ eg:\ hledger\ help\ cli-cli,\ ui,\ web,\ api,\ journal,\ csv,\ timeclock,\ timedot-\f[]-.fi-.IP-.nf-\f[C]-$\ hledger\ help\ cli\ |\ less--hledger(1)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ hledger\ User\ Manuals\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ hledger(1)----NAME-\ \ \ \ \ \ \ hledger\ \-\ a\ command\-line\ accounting\ tool--SYNOPSIS-\ \ \ \ \ \ \ hledger\ [\-f\ FILE]\ COMMAND\ [OPTIONS]\ [CMDARGS]-\ \ \ \ \ \ \ hledger\ [\-f\ FILE]\ ADDONCMD\ \-\-\ [OPTIONS]\ [CMDARGS]-:-\f[]-.fi-.SS incomestatement-.PP-Show an income statement.-Alias: is.-.TP-.B \f[C]\-\-flat\f[]-show full account names, as a list (default)-.RS-.RE-.TP-.B \f[C]\-\-drop=N\f[]-in flat mode: omit N leading account name parts-.RS-.RE-.PP-This command displays a simple income statement.-It currently assumes that you have top\-level accounts named-\f[C]income\f[] (or \f[C]revenue\f[]) and \f[C]expense\f[] (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[]-.fi-.SS info-.PP-Show any of the hledger manuals using info.-.PP-The \f[C]info\f[] command displays any of the hledger reference manuals-using the info hypertextual documentation viewer.-This can be a very efficient way to browse large manuals.-It requires the "info" program to be available in your PATH.-.PP-As with help, run it with no arguments to list available topics-(manuals).-.SS man-.PP-Show any of the hledger manuals using man.-.PP-The \f[C]man\f[] command displays any of the hledger reference manuals-using man, the standard documentation viewer on unix systems.-This will fit the text to your terminal width, and probably invoke a-pager automatically.-It requires the "man" program to be available in your PATH.-.PP-As with help, run it with no arguments to list available topics-(manuals).-.SS print-.PP-Show transactions from the journal.-.TP-.B \f[C]\-m\ STR\ \-\-match=STR\f[]-show the transaction whose description is most similar to STR, and is-most recent-.RS-.RE-.TP-.B \f[C]\-O\ FMT\ \-\-output\-format=FMT\f[]-select the output format.-Supported formats: txt, csv.-.RS-.RE-.TP-.B \f[C]\-o\ FILE\ \-\-output\-file=FILE\f[]-write output to FILE.-A file extension matching one of the above formats selects that format.-.RS-.RE-.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[]-.fi-.PP-The print command displays full transactions from the journal file,-tidily formatted and showing all amounts explicitly.-The output of print is always a valid hledger journal, but it does-always not preserve all original content exactly (eg directives).-.PP-hledger\[aq]s print command also shows all unit prices in effect, or-(with \-B/\-\-cost) shows cost amounts.-.PP-The print command also supports output destination and CSV output.-.SS register-.PP-Show postings and their running total.-Alias: reg.-.TP-.B \f[C]\-\-cumulative\f[]-show running total from report start date (default)-.RS-.RE-.TP-.B \f[C]\-H\ \-\-historical\f[]-show historical running total/balance (includes postings before report-start date)-.RS-.RE-.TP-.B \f[C]\-A\ \-\-average\f[]-show running average of posting amounts instead of total (implies-\-\-empty)-.RS-.RE-.TP-.B \f[C]\-r\ \-\-related\f[]-show postings\[aq] siblings instead-.RS-.RE-.TP-.B \f[C]\-w\ N\ \-\-width=N\f[]-set output width (default: terminal width or COLUMNS.-\-wN,M sets description width as well)-.RS-.RE-.TP-.B \f[C]\-O\ FMT\ \-\-output\-format=FMT\f[]-select the output format.-Supported formats: txt, csv.-.RS-.RE-.TP-.B \f[C]\-o\ FILE\ \-\-output\-file=FILE\f[]-write output to FILE.-A file extension matching one of the above formats selects that format.-.RS-.RE-.PP-The register command displays postings, 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[]-.fi-.PP-The \f[C]\-\-historical\f[]/\f[C]\-H\f[] 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[]-.fi-.PP-The \f[C]\-\-depth\f[] option limits the amount of sub\-account detail-displayed.-.PP-The \f[C]\-\-average\f[]/\f[C]\-A\f[] 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[] (see below).-It is affected by \f[C]\-\-historical\f[].-It works best when showing just one account and one commodity.-.PP-The \f[C]\-\-related\f[]/\f[C]\-r\f[] flag shows the \f[I]other\f[]-postings in the transactions of the postings which would normally be-shown.-.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[]-.fi-.PP-Periods with no activity, and summary postings with a zero amount, are-not shown by default; use the \f[C]\-\-empty\f[]/\f[C]\-E\f[] 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[]-.fi-.PP-Often, you\[aq]ll want to see just one line per interval.-The \f[C]\-\-depth\f[] 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[]-.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[] environment-variable (not a bash shell variable) or by using the-\f[C]\-\-width\f[]/\f[C]\-w\f[] 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[] .-Here\[aq]s a diagram:-.IP-.nf-\f[C]-<\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\ width\ (W)\ \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\->-date\ (10)\ \ description\ (D)\ \ \ \ \ \ \ account\ (W\-41\-D)\ \ \ \ \ amount\ (12)\ \ \ balance\ (12)-DDDDDDDDDD\ dddddddddddddddddddd\ \ aaaaaaaaaaaaaaaaaaa\ \ AAAAAAAAAAAA\ \ AAAAAAAAAAAA-\f[]-.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,\ and\ set\ description\ width-\f[]-.fi-.PP-The register command also supports the \f[C]\-o/\-\-output\-file\f[] and-\f[C]\-O/\-\-output\-format\f[] options for controlling output-destination and CSV output.-.SS stats-.PP-Show some journal statistics.-.TP-.B \f[C]\-o\ FILE\ \-\-output\-file=FILE\f[]-write output to FILE.-A file extension matching one of the above formats selects that format.-.RS-.RE-.IP-.nf-\f[C]-$\ hledger\ stats-Main\ journal\ file\ \ \ \ \ \ \ \ :\ /src/hledger/data/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\ ($)-\f[]-.fi-.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-The stats command also supports \f[C]\-o/\-\-output\-file\f[] for-controlling output destination.-.SS test-.PP-Run built\-in unit tests.-.IP-.nf-\f[C]-$\ hledger\ test-Cases:\ 74\ \ Tried:\ 74\ \ Errors:\ 0\ \ Failures:\ 0-\f[]-.fi-.PP-This command runs hledger\[aq]s built\-in unit tests and displays a-quick report.-With a regular expression argument, it selects only tests with matching-names.-It\[aq]s mainly used in development, but it\[aq]s also nice to be able-to check your hledger executable for smoke at any time.-.SH ADD\-ON COMMANDS-.PP-Add\-on commands are executables in your PATH whose name starts with-\f[C]hledger\-\f[] and ends with any of these file extensions: none,-\f[C]\&.hs\f[],\f[C]\&.lhs\f[],\f[C]\&.pl\f[],\f[C]\&.py\f[],\f[C]\&.rb\f[],\f[C]\&.rkt\f[],\f[C]\&.sh\f[],\f[C]\&.bat\f[],\f[C]\&.com\f[],\f[C]\&.exe\f[].-Also, an add\-on\[aq]s name may not be the same as any built\-in command-or alias.-.PP-hledger will detect these and include them in the command list and let-you invoke them with \f[C]hledger\ ADDONCMD\f[].-However there are some limitations:-.IP \[bu] 2-Options appearing before ADDONCMD will be visible only to hledger and-will not be passed to the add\-on.-Eg: \f[C]hledger\ \-h\ web\f[] shows hledger\[aq]s usage,-\f[C]hledger\ web\ \-h\f[] shows hledger\-web\[aq]s usage.-.IP \[bu] 2-Options understood only by the add\-on must go after a \f[C]\-\-\f[]-argument to hide them from hledger, which would otherwise reject them.-Eg: \f[C]hledger\ web\ \-\-\ \-\-server\f[].-.PP-Sometimes it may be more convenient to just run the add\-on directly,-eg: \f[C]hledger\-web\ \-\-server\f[].-.PP-Add\-ons which are written in haskell can take advantage of the-hledger\-lib library for journal parsing, reporting, command\-line-options, etc.-.PP-Here are some hledger add\-ons available from Hackage, the extra-directory in the hledger source, or elsewhere:-.SS api-.PP-Web API server, see hledger\-api.-.SS autosync-.PP-Download OFX bank data and/or convert OFX to hledger journal format.-.IP-.nf-\f[C]-$\ hledger\ autosync\ \-\-help-usage:\ hledger\-autosync\ [\-h]\ [\-m\ MAX]\ [\-r]\ [\-a\ ACCOUNT]\ [\-l\ LEDGER]\ [\-i\ INDENT]-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ [\-\-initial]\ [\-\-fid\ FID]\ [\-\-assertions]\ [\-d]\ [\-\-hledger]-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ [\-\-slow]\ [\-\-which]-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ [PATH]--Synchronize\ ledger.--positional\ arguments:-\ \ PATH\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ do\ not\ sync;\ import\ from\ OFX\ file--optional\ arguments:-\ \ \-h,\ \-\-help\ \ \ \ \ \ \ \ \ \ \ \ show\ this\ help\ message\ and\ exit-\ \ \-m\ MAX,\ \-\-max\ MAX\ \ \ \ \ maximum\ number\ of\ days\ to\ process-\ \ \-r,\ \-\-resync\ \ \ \ \ \ \ \ \ \ do\ not\ stop\ until\ max\ days\ reached-\ \ \-a\ ACCOUNT,\ \-\-account\ ACCOUNT-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ account\ name\ for\ import-\ \ \-l\ LEDGER,\ \-\-ledger\ LEDGER-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ specify\ ledger\ file\ to\ READ\ for\ syncing-\ \ \-i\ INDENT,\ \-\-indent\ INDENT-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ number\ of\ spaces\ to\ use\ for\ indentation-\ \ \-\-initial\ \ \ \ \ \ \ \ \ \ \ \ \ create\ initial\ balance\ entries-\ \ \-\-fid\ FID\ \ \ \ \ \ \ \ \ \ \ \ \ pass\ in\ fid\ value\ for\ OFX\ files\ that\ do\ not\ supply\ it-\ \ \-\-assertions\ \ \ \ \ \ \ \ \ \ create\ balance\ assertion\ entries-\ \ \-d,\ \-\-debug\ \ \ \ \ \ \ \ \ \ \ enable\ debug\ logging-\ \ \-\-hledger\ \ \ \ \ \ \ \ \ \ \ \ \ force\ use\ of\ hledger\ (on\ by\ default\ if\ invoked\ as\ hledger\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ autosync)-\ \ \-\-slow\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ use\ slow,\ but\ possibly\ more\ robust,\ method\ of\ calling\ ledger-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (no\ subprocess)-\ \ \-\-which\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ display\ which\ version\ of\ ledger/hledger/ledger\-python\ will-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ be\ used\ by\ ledger\-autosync\ to\ check\ for\ previous-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ transactions-$\ head\ acct1.ofx-OFXHEADER:100-DATA:OFXSGML-VERSION:102-SECURITY:NONE-ENCODING:USASCII-CHARSET:1252-COMPRESSION:NONE-OLDFILEUID:NONE-NEWFILEUIDe:8509488b59d1bb45--$\ hledger\ autosync\ acct1.ofx-2013/08/30\ MONTHLY\ SERVICE\ FEE-\ \ \ \ ;\ ofxid:\ 3000.4303001832.201308301-\ \ \ \ WF:4303001832\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \-$6.00-\ \ \ \ [assets:business:bank:wf:bchecking:banking]\ \ $6.00-\f[]-.fi-.PP-ledger\-autosync, which includes a \f[C]hledger\-autosync\f[] alias,-downloads transactions from your bank(s) via OFX, and prints just the-new ones as journal entries which you can add to your journal.-It can also operate on .OFX files which you\[aq]ve downloaded manually.-It can be a nice alternative to hledger\[aq]s built\-in CSV reader,-especially if your bank supports OFX download.-.SS diff-.PP-Show transactions present in one journal file but not another-.IP-.nf-\f[C]-$\ hledger\ diff\ \-\-help-Usage:\ hledger\-diff\ account:name\ left.journal\ right.journal-$\ cat\ a.journal-1/1-\ (acct:one)\ \ 1--$\ cat\ b.journal-1/1-\ (acct:one)\ \ 1-2/2-\ (acct:two)\ \ 2--$\ hledger\ diff\ acct:two\ a.journal\ b.journal-Unmatched\ transactions\ in\ the\ first\ journal:--Unmatched\ transactions\ in\ the\ second\ journal:--2015/02/02-\ \ \ \ (acct:two)\ \ \ \ \ \ \ \ \ \ \ \ $2-\f[]-.fi-.PP-hledger\-diff compares two journal files.-Given an account name, it prints out the transactions affecting that-account which are in one journal file but not in the other.-This can be useful for reconciling existing journals with bank-statements.-.SS equity-.PP-Print a journal entry that resets account balances to zero.-.IP-.nf-\f[C]-$\ hledger\ balance\ \-\-flat\ \-E\ assets\ liabilities-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ assets:bank:checking-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ assets:bank:saving-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2\ \ assets:cash-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ liabilities:debts-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0-$\ hledger\ equity\ assets\ liabilities-2015/05/23-\ \ \ \ assets:bank:saving\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1-\ \ \ \ assets:cash\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $2-\ \ \ \ liabilities:debts\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1-\ \ \ \ equity:closing\ balances\ \ \ \ \ \ \ \ \ \ \ \ \ 0--2015/05/23-\ \ \ \ assets:bank:saving\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1-\ \ \ \ assets:cash\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2-\ \ \ \ liabilities:debts\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1-\ \ \ \ equity:opening\ balances\ \ \ \ \ \ \ \ \ \ \ \ \ 0-\f[]-.fi-.PP-This prints a journal entry which zeroes out the specified accounts (or-all accounts) with a transfer to/from "equity:closing balances" (like-Ledger\[aq]s equity command).-Also, it prints an similar entry with opposite sign for restoring the-balances from "equity:opening balances".-.PP-These can be useful for ending one journal file and starting a new one,-respectively.-By zeroing your asset and liability accounts at the end of a file and-restoring them at the start of the next one, you will see correct-asset/liability balances whether you run hledger on just one file, or on-several files concatenated with include.-.SS interest-.PP-Generate interest transactions.-.IP-.nf-\f[C]-$\ hledger\ interest\ \-\-help-Usage:\ hledger\-interest\ [OPTION...]\ ACCOUNT-\ \ \-h\ \ \ \ \ \ \ \ \ \ \-\-help\ \ \ \ \ \ \ \ \ \ \ \ print\ this\ message\ and\ exit-\ \ \-V\ \ \ \ \ \ \ \ \ \ \-\-version\ \ \ \ \ \ \ \ \ show\ version\ number\ and\ exit-\ \ \-v\ \ \ \ \ \ \ \ \ \ \-\-verbose\ \ \ \ \ \ \ \ \ echo\ input\ ledger\ to\ stdout\ (default)-\ \ \-q\ \ \ \ \ \ \ \ \ \ \-\-quiet\ \ \ \ \ \ \ \ \ \ \ don\[aq]t\ echo\ input\ ledger\ to\ stdout-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \-\-today\ \ \ \ \ \ \ \ \ \ \ compute\ interest\ up\ until\ today-\ \ \-f\ FILE\ \ \ \ \ \-\-file=FILE\ \ \ \ \ \ \ input\ ledger\ file\ (pass\ \[aq]\-\[aq]\ for\ stdin)-\ \ \-s\ ACCOUNT\ \ \-\-source=ACCOUNT\ \ interest\ source\ account-\ \ \-t\ ACCOUNT\ \ \-\-target=ACCOUNT\ \ interest\ target\ account-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \-\-act\ \ \ \ \ \ \ \ \ \ \ \ \ use\ \[aq]act\[aq]\ day\ counting\ convention-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \-\-30\-360\ \ \ \ \ \ \ \ \ \ use\ \[aq]30/360\[aq]\ day\ counting\ convention-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \-\-30E\-360\ \ \ \ \ \ \ \ \ use\ \[aq]30E/360\[aq]\ day\ counting\ convention-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \-\-30E\-360isda\ \ \ \ \ use\ \[aq]30E/360isda\[aq]\ day\ counting\ convention-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \-\-constant=RATE\ \ \ constant\ interest\ rate-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \-\-annual=RATE\ \ \ \ \ annual\ interest\ rate-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \-\-bgb288\ \ \ \ \ \ \ \ \ \ compute\ interest\ according\ to\ German\ BGB288-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \-\-ing\-diba\ \ \ \ \ \ \ \ compute\ interest\ according\ for\ Ing\-Diba\ Tagesgeld\ account-\f[]-.fi-.IP-.nf-\f[C]-$\ cat\ interest.journal-2008/09/26\ Loan-\ \ \ \ \ Assets:Bank\ \ \ \ \ \ \ \ \ \ EUR\ 10000.00-\ \ \ \ \ Liabilities:Bank--2008/11/27\ Payment-\ \ \ \ \ Assets:Bank\ \ \ \ \ \ \ \ \ \ EUR\ \-3771.12-\ \ \ \ \ Liabilities:Bank--2009/05/03\ Payment-\ \ \ \ \ Assets:Bank\ \ \ \ \ \ \ \ \ \ EUR\ \-1200.00-\ \ \ \ \ Liabilities:Bank--2010/12/10\ Payment-\ \ \ \ \ Assets:Bank\ \ \ \ \ \ \ \ \ \ EUR\ \-3700.00-\ \ \ \ \ Liabilities:Bank-\f[]-.fi-.IP-.nf-\f[C]-$\ hledger\ interest\ \-\-\ \-f\ interest.journal\ \-\-source=Expenses:Interest\ \\-\ \ \ \ \-\-target=Liabilities:Bank\ \-\-30\-360\ \-\-annual=0.05\ Liabilities:Bank-2008/09/26\ Loan-\ \ \ \ Assets:Bank\ \ \ \ \ \ \ EUR\ 10000.00-\ \ \ \ Liabilities:Bank\ \ EUR\ \-10000.00--2008/11/27\ 0.05%\ interest\ for\ EUR\ \-10000.00\ over\ 61\ days-\ \ \ \ Liabilities:Bank\ \ \ \ \ EUR\ \-84.72-\ \ \ \ Expenses:Interest\ \ \ \ \ EUR\ 84.72--2008/11/27\ Payment-\ \ \ \ Assets:Bank\ \ \ \ \ \ \ EUR\ \-3771.12-\ \ \ \ Liabilities:Bank\ \ \ EUR\ 3771.12--2008/12/31\ 0.05%\ interest\ for\ EUR\ \-6313.60\ over\ 34\ days-\ \ \ \ Liabilities:Bank\ \ \ \ \ EUR\ \-29.81-\ \ \ \ Expenses:Interest\ \ \ \ \ EUR\ 29.81--2009/05/03\ 0.05%\ interest\ for\ EUR\ \-6343.42\ over\ 123\ days-\ \ \ \ Liabilities:Bank\ \ \ \ EUR\ \-108.37-\ \ \ \ Expenses:Interest\ \ \ \ EUR\ 108.37--2009/05/03\ Payment-\ \ \ \ Assets:Bank\ \ \ \ \ \ \ EUR\ \-1200.00-\ \ \ \ Liabilities:Bank\ \ \ EUR\ 1200.00--2009/12/31\ 0.05%\ interest\ for\ EUR\ \-5251.78\ over\ 238\ days-\ \ \ \ Liabilities:Bank\ \ \ \ EUR\ \-173.60-\ \ \ \ Expenses:Interest\ \ \ \ EUR\ 173.60--2010/12/10\ 0.05%\ interest\ for\ EUR\ \-5425.38\ over\ 340\ days-\ \ \ \ Liabilities:Bank\ \ \ \ EUR\ \-256.20-\ \ \ \ Expenses:Interest\ \ \ \ EUR\ 256.20--2010/12/10\ Payment-\ \ \ \ Assets:Bank\ \ \ \ \ \ \ EUR\ \-3700.00-\ \ \ \ Liabilities:Bank\ \ \ EUR\ 3700.00-\f[]-.fi-.PP-hledger\-interest computes interests for a given account.-Using command line flags, the program can be configured to use various-schemes for day\-counting, such as act/act, 30/360, 30E/360, and-30/360isda.-Furthermore, it supports a (small) number of interest schemes, i.e.-annual interest with a fixed rate and the scheme mandated by the German-BGB288 (Basiszins für Verbrauchergeschäfte).-See the package page for more.-.SS irr-.PP-Calculate internal rate of return.-.IP-.nf-\f[C]-$\ hledger\ irr\ \-\-help-Usage:\ hledger\-irr\ [OPTION...]-\ \ \-h\ \ \ \ \ \ \ \ \ \ \-\-help\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ print\ this\ message\ and\ exit-\ \ \-V\ \ \ \ \ \ \ \ \ \ \-\-version\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ show\ version\ number\ and\ exit-\ \ \-c\ \ \ \ \ \ \ \ \ \ \-\-cashflow\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ also\ show\ all\ revant\ transactions-\ \ \-f\ FILE\ \ \ \ \ \-\-file=FILE\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ input\ ledger\ file\ (pass\ \[aq]\-\[aq]\ for\ stdin)-\ \ \-i\ ACCOUNT\ \ \-\-investment\-account=ACCOUNT\ \ investment\ account-\ \ \-t\ ACCOUNT\ \ \-\-interest\-account=ACCOUNT\ \ \ \ interest/gain/fees/losses\ account-\ \ \-b\ DATE\ \ \ \ \ \-\-begin=DATE\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ calculate\ interest\ from\ this\ date-\ \ \-e\ DATE\ \ \ \ \ \-\-end=DATE\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ calculate\ interest\ until\ this\ date-\ \ \-D\ \ \ \ \ \ \ \ \ \ \-\-daily\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ calculate\ interest\ for\ each\ day-\ \ \-W\ \ \ \ \ \ \ \ \ \ \-\-weekly\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ calculate\ interest\ for\ each\ week-\ \ \-M\ \ \ \ \ \ \ \ \ \ \-\-monthly\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ calculate\ interest\ for\ each\ month-\ \ \-Y\ \ \ \ \ \ \ \ \ \ \-\-yearly\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ calculate\ interest\ for\ each\ year-\f[]-.fi-.IP-.nf-\f[C]-$\ cat\ irr.journal\ -2011\-01\-01\ Some\ wild\ speculation\ \[en]\ I\ wonder\ if\ it\ pays\ off-\ \ \ Speculation\ \ \ €100.00-\ \ \ Cash--2011\-02\-01\ More\ speculation\ (and\ adjustment\ of\ value)-\ \ \ Cash\ \ \ \ \ \ \ \ \ \-€10.00-\ \ \ Rate\ Gain\ \ \ \ \ \-€1.00-\ \ \ Speculation--2011\-03\-01\ Lets\ pull\ out\ some\ money\ (and\ adjustment\ of\ value)-\ \ \ Cash\ \ \ \ \ \ \ \ \ \ €30.00-\ \ \ Rate\ Gain\ \ \ \ \ \-€3.00-\ \ \ Speculation--2011\-04\-01\ More\ speculation\ (and\ it\ lost\ some\ money!)-\ \ \ Cash\ \ \ \ \ \ \ \ \ \-€50.00-\ \ \ Rate\ Gain\ \ \ \ \ €\ 5.00-\ \ \ Speculation--2011\-05\-01\ Getting\ some\ money\ out\ (and\ adjustment\ of\ value)-\ \ \ Speculation\ \ \-€44.00-\ \ \ Rate\ Gain\ \ \ \ \-€\ 3.00-\ \ \ Cash--2011\-06\-01\ Emptying\ the\ account\ (after\ adjusting\ the\ value)-\ \ \ Speculation\ \ \ \-€85.00-\ \ \ Cash\ \ \ \ \ \ \ \ \ \ \ €90.00-\ \ \ Rate\ Gain\ \ \ \ \ \-€\ 5.00-\f[]-.fi-.IP-.nf-\f[C]-$\ hledger\-irr\ \-f\ irr.journal\ \-t\ "Rate\ Gain"\ \-i\ Speculation\ \ \-\-monthly-2011/01/01\ \-\ 2011/02/01:\ 12.49%-2011/02/01\ \-\ 2011/03/01:\ 41.55%-2011/03/01\ \-\ 2011/04/01:\ \-51.44%-2011/04/01\ \-\ 2011/05/01:\ 32.24%-2011/05/01\ \-\ 2011/06/01:\ 95.92%-\f[]-.fi-.PP-hledger\-irr computes the internal rate of return, also known as the-effective interest rate, of a given investment.-After specifying what account holds the investment, and what account-stores the gains (or losses, or fees, or cost), it calculates the-hypothetical annual rate of fixed rate investment that would have-provided the exact same cash flow.-See the package page for more.-.SS print\-unique-.PP-Print only only journal entries which have a unique description.-.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[]-.fi-.SS rewrite-.PP-Prints all journal entries, adding specified custom postings to matched-entries.-.PP-hledger\-rewrite.hs, in hledger\[aq]s extra directory (compilation-optional), adds postings to existing transactions, optionally with an-amount based on the existing transaction\[aq]s first amount.-See the script for more details.-.IP-.nf-\f[C]-$\ hledger\ rewrite\ \-\-\ [QUERY]\ \ \ \ \ \ \ \ \-\-add\-posting\ "ACCT\ \ AMTEXPR"\ ...-$\ hledger\ rewrite\ \-\-\ ^income\ \ \ \ \ \ \ \ \-\-add\-posting\ \[aq](liabilities:tax)\ \ *.33\[aq]-$\ hledger\ rewrite\ \-\-\ expenses:gifts\ \-\-add\-posting\ \[aq](budget:gifts)\ \ *\-1"\[aq]-\f[]-.fi-.SS ui-.PP-Curses\-style interface, see hledger\-ui.-.SS web-.PP-Web interface, see hledger\-web.-.SH TROUBLESHOOTING-.SS Run\-time problems-.PP-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):-.PP-\f[B]Successfully installed, but "No command \[aq]hledger\[aq]-found"\f[]-.PD 0-.P-.PD-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.-.PP-\f[B]I set a custom LEDGER_FILE, but hledger is still using the default-file\f[]-.PD 0-.P-.PD-\f[C]LEDGER_FILE\f[] should be a real environment variable, not just a-shell variable.-The command \f[C]env\ |\ grep\ LEDGER_FILE\f[] should show it.-You may need to use \f[C]export\f[].-Here\[aq]s an explanation.-.PP-\f[B]"Illegal byte sequence" or "Invalid or incomplete multibyte or wide-character" errors\f[]-.PD 0-.P-.PD-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\[aq]m not sure yet).-.PP-Here\[aq]s an example of setting the locale temporarily, on ubuntu-gnu/linux:-.IP-.nf-\f[C]-$\ 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-\f[]-.fi-.PP-Here\[aq]s one way to set it permanently, there are probably better-ways:-.IP-.nf-\f[C]-$\ echo\ "export\ LANG=en_US.UTF\-8"\ >>~/.bash_profile-$\ bash\ \-\-login-\f[]-.fi-.PP-If we preferred to use eg \f[C]fr_FR.utf8\f[], we might have to install-that first:-.IP-.nf-\f[C]-$\ 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-\f[]-.fi-.PP-Note some platforms allow variant locale spellings, but not all (ubuntu-accepts \f[C]fr_FR.UTF8\f[], mac osx requires exactly-\f[C]fr_FR.UTF\-8\f[]).-.SS Known limitations-.PP-\f[B]Command line interface\f[]-.PP-Add\-on command options, unless they are also understood by the main-hledger executable, must be written after \f[C]\-\-\f[], like this:-\f[C]hledger\ web\ \-\-\ \-\-server\f[]-.PP-\f[B]Differences from Ledger\f[]-.PP-Not all of Ledger\[aq]s journal file syntax is supported.-See file format differences.-.PP-hledger is slower than Ledger, and uses more memory, on large data-files.-.PP-\f[B]Windows limitations\f[]-.PP-In a windows CMD window, non\-ascii characters and colours are not-supported.-.PP-In a windows Cygwin/MSYS/Mintty window, the tab key is not supported in-hledger add.-.SH ENVIRONMENT-.PP-\f[B]COLUMNS\f[] The screen width used by the register command.-Default: the full terminal width.-.PP-\f[B]LEDGER_FILE\f[] The journal file path when not specified with-\f[C]\-f\f[].-Default: \f[C]~/.hledger.journal\f[] (on windows, perhaps-\f[C]C:/Users/USER/.hledger.journal\f[]).-.SH FILES-.PP-Reads data from one or more files in hledger journal, timeclock,-timedot, or CSV format specified with \f[C]\-f\f[], or-\f[C]$LEDGER_FILE\f[], or \f[C]$HOME/.hledger.journal\f[] (on windows,-perhaps \f[C]C:/Users/USER/.hledger.journal\f[]).-.SH BUGS-.PP-The need to precede options with \f[C]\-\-\f[] when invoked from hledger-is awkward.-.PP-hledger can\[aq]t render non\-ascii characters when run from a Windows-command prompt (up to Windows 7 at least).-.PP-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.+.TH "hledger" "1" "March 2017" "hledger 1.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[]+.PD 0+.P+.PD+\f[C]hledger\ [\-f\ FILE]\ ADDONCMD\ \-\-\ [OPTIONS]\ [ARGS]\f[]+.PD 0+.P+.PD+\f[C]hledger\f[]+.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's command\-line interface (there are also curses 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.+.PP+hledger reads data from one or more files in hledger journal, timeclock,+timedot, or CSV format specified with \f[C]\-f\f[], or+\f[C]$LEDGER_FILE\f[], or \f[C]$HOME/.hledger.journal\f[] (on windows,+perhaps \f[C]C:/Users/USER/.hledger.journal\f[]).+If using \f[C]$LEDGER_FILE\f[], note this must be a real environment+variable, not a shell variable.+You can specify standard input with \f[C]\-f\-\f[].+.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[]+.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'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]~/.hledger.journal\f[], or run \f[C]hledger\ add\f[] and follow the+prompts.+Then try some commands like \f[C]hledger\ print\f[] or+\f[C]hledger\ balance\f[].+Run \f[C]hledger\f[] 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[]+.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[]+.fi+.IP+.nf+\f[C]+$\ hledger\ accounts\ \-\-tree+assets+\ \ cash+expenses+\ \ food+income+\ \ gifts+\f[]+.fi+.IP+.nf+\f[C]+$\ hledger\ balance+\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $10\ \ assets:cash+\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $10\ \ expenses:food+\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-20\ \ income:gifts+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0+\f[]+.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[]+.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[]+.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[].+(Note \-h and \-\-help are different, like git.)+.PP+General help options:+.TP+.B \f[C]\-h\f[]+show general usage (or after COMMAND, command usage)+.RS+.RE+.TP+.B \f[C]\-\-help\f[]+show this program\[aq]s manual as plain text (or after an add\-on+COMMAND, the add\-on\[aq]s manual)+.RS+.RE+.TP+.B \f[C]\-\-man\f[]+show this program\[aq]s manual with man+.RS+.RE+.TP+.B \f[C]\-\-info\f[]+show this program\[aq]s manual with info+.RS+.RE+.TP+.B \f[C]\-\-version\f[]+show version+.RS+.RE+.TP+.B \f[C]\-\-debug[=N]\f[]+show debug output (levels 1\-9, default: 1)+.RS+.RE+.PP+General input options:+.TP+.B \f[C]\-f\ FILE\ \-\-file=FILE\f[]+use a different input file.+For stdin, use \- (default: \f[C]$LEDGER_FILE\f[] or+\f[C]$HOME/.hledger.journal\f[])+.RS+.RE+.TP+.B \f[C]\-\-rules\-file=RULESFILE\f[]+Conversion rules file to use when reading CSV (default: FILE.rules)+.RS+.RE+.TP+.B \f[C]\-\-alias=OLD=NEW\f[]+rename accounts named OLD to NEW+.RS+.RE+.TP+.B \f[C]\-\-anon\f[]+anonymize accounts and payees+.RS+.RE+.TP+.B \f[C]\-\-pivot\ TAGNAME\f[]+use some other field/tag for account names+.RS+.RE+.TP+.B \f[C]\-I\ \-\-ignore\-assertions\f[]+ignore any failing balance assertions+.RS+.RE+.PP+General reporting options:+.TP+.B \f[C]\-b\ \-\-begin=DATE\f[]+include postings/txns on or after this date+.RS+.RE+.TP+.B \f[C]\-e\ \-\-end=DATE\f[]+include postings/txns before this date+.RS+.RE+.TP+.B \f[C]\-D\ \-\-daily\f[]+multiperiod/multicolumn report by day+.RS+.RE+.TP+.B \f[C]\-W\ \-\-weekly\f[]+multiperiod/multicolumn report by week+.RS+.RE+.TP+.B \f[C]\-M\ \-\-monthly\f[]+multiperiod/multicolumn report by month+.RS+.RE+.TP+.B \f[C]\-Q\ \-\-quarterly\f[]+multiperiod/multicolumn report by quarter+.RS+.RE+.TP+.B \f[C]\-Y\ \-\-yearly\f[]+multiperiod/multicolumn report by year+.RS+.RE+.TP+.B \f[C]\-p\ \-\-period=PERIODEXP\f[]+set start date, end date, and/or reporting interval all at once+(overrides the flags above)+.RS+.RE+.TP+.B \f[C]\-\-date2\f[]+show, and match with \-b/\-e/\-p/date:, secondary dates instead+.RS+.RE+.TP+.B \f[C]\-C\ \-\-cleared\f[]+include only cleared postings/txns+.RS+.RE+.TP+.B \f[C]\-\-pending\f[]+include only pending postings/txns+.RS+.RE+.TP+.B \f[C]\-U\ \-\-uncleared\f[]+include only uncleared (and pending) postings/txns+.RS+.RE+.TP+.B \f[C]\-R\ \-\-real\f[]+include only non\-virtual postings+.RS+.RE+.TP+.B \f[C]\-\-depth=N\f[]+hide accounts/postings deeper than N+.RS+.RE+.TP+.B \f[C]\-E\ \-\-empty\f[]+show items with zero amount, normally hidden+.RS+.RE+.TP+.B \f[C]\-B\ \-\-cost\f[]+convert amounts to their cost at transaction time (using the transaction+price, if any)+.RS+.RE+.TP+.B \f[C]\-V\ \-\-value\f[]+convert amounts to their market value on the report end date (using the+most recent applicable market price, if any)+.RS+.RE+.PP+Note when multiple similar reporting options are provided, the last one+takes precedence.+Eg \f[C]\-p\ feb\ \-p\ mar\f[] is equivalent to \f[C]\-p\ mar\f[].+.PP+Some of these can also be written as queries.+.SS Command options+.PP+To see options for a particular command, including command\-specific+options, run: \f[C]hledger\ COMMAND\ \-h\f[].+.PP+Command\-specific options must be written after the command name, eg:+\f[C]hledger\ print\ \-x\f[].+.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[].+Or, you can run the addon executable directly:+\f[C]hledger\-ui\ \-\-watch\f[].+.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 Special characters+.PP+Option and argument values which contain problematic characters should+be escaped with double quotes, backslashes, or (best) single quotes.+Problematic characters means spaces, and also characters which are+significant to your command shell, such as less\-than/greater\-than.+Eg:+\f[C]hledger\ register\ \-p\ \[aq]last\ year\[aq]\ "accounts\ receivable\ (receivable|payable)"\ amt:\\>100\f[].+.PP+Characters which are significant both to the shell and in regular+expressions sometimes need to be double\-escaped.+These include parentheses, the pipe symbol and the dollar sign.+Eg, to match the dollar symbol, bash users should do:+\f[C]hledger\ balance\ cur:\[aq]\\$\[aq]\f[] or+\f[C]hledger\ balance\ cur:\\\\$\f[].+.PP+There\[aq]s more..+options and arguments get de\-escaped when hledger is passing them to an+addon executable.+In this case you might need \f[I]triple\f[]\-escaping.+Eg: \f[C]hledger\ ui\ cur:\[aq]\\\\$\[aq]\f[] or+\f[C]hledger\ ui\ cur:\\\\\\\\$\f[].+.PP+If in doubt, keep things simple:+.IP \[bu] 2+run add\-on executables directly+.IP \[bu] 2+write options after the command+.IP \[bu] 2+enclose problematic args in single quotes+.IP \[bu] 2+if needed, also add a backslash to escape regexp metacharacters+.PP+If you\[aq]re really stumped, add \f[C]\-\-debug=2\f[] to troubleshoot.+.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[] (or on Windows,+something like \f[C]C:/Users/USER/.hledger.journal\f[]).+You can override this with the \f[C]$LEDGER_FILE\f[] environment+variable:+.IP+.nf+\f[C]+$\ setenv\ LEDGER_FILE\ ~/finance/2016.journal+$\ hledger\ stats+\f[]+.fi+.PP+or with the \f[C]\-f/\-\-file\f[] option:+.IP+.nf+\f[C]+$\ hledger\ \-f\ /some/file\ stats+\f[]+.fi+.PP+The file name \f[C]\-\f[] (hyphen) means standard input:+.IP+.nf+\f[C]+$\ cat\ some.journal\ |\ hledger\ \-f\-+\f[]+.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 "reader" in turn:+.PP+.TS+tab(@);+lw(10.7n) lw(33.2n) lw(26.1n).+T{+Reader:+T}@T{+Reads:+T}@T{+Used for file extensions:+T}+_+T{+\f[C]journal\f[]+T}@T{+hledger\[aq]s journal format, also some Ledger journals+T}@T{+\f[C]\&.journal\f[] \f[C]\&.j\f[] \f[C]\&.hledger\f[] \f[C]\&.ledger\f[]+T}+T{+\f[C]timeclock\f[]+T}@T{+timeclock files (precise time logging)+T}@T{+\f[C]\&.timeclock\f[]+T}+T{+\f[C]timedot\f[]+T}@T{+timedot files (approximate time logging)+T}@T{+\f[C]\&.timedot\f[]+T}+T{+\f[C]csv\f[]+T}@T{+comma\-separated values (data interchange)+T}@T{+\f[C]\&.csv\f[]+T}+.TE+.PP+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:+.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[]+.fi+.PP+You can also specify multiple \f[C]\-f\f[] 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[].+.SS Smart dates+.PP+hledger\[aq]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\[aq]s+date, and can have less\-significant date parts omitted (defaulting to+1).+.PP+Examples:+.PP+.TS+tab(@);+l l.+T{+\f[C]2009/1/1\f[], \f[C]2009/01/01\f[], \f[C]2009\-1\-1\f[],+\f[C]2009.1.1\f[]+T}@T{+simple dates, several separators allowed+T}+T{+\f[C]2009/1\f[], \f[C]2009\f[]+T}@T{+same as above \- a missing day or month defaults to 1+T}+T{+\f[C]1/1\f[], \f[C]january\f[], \f[C]jan\f[], \f[C]this\ year\f[]+T}@T{+relative dates, meaning january 1 of the current year+T}+T{+\f[C]next\ year\f[]+T}@T{+january 1 of next year+T}+T{+\f[C]this\ month\f[]+T}@T{+the 1st of the current month+T}+T{+\f[C]this\ week\f[]+T}@T{+the most recent monday+T}+T{+\f[C]last\ week\f[]+T}@T{+the monday of the week before this one+T}+T{+\f[C]lastweek\f[]+T}@T{+spaces are optional+T}+T{+\f[C]today\f[], \f[C]yesterday\f[], \f[C]tomorrow\f[]+T}@T{+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[],+\f[C]\-e/\-\-end\f[], \f[C]\-p/\-\-period\f[] or a \f[C]date:\f[] query+(described below).+All of these accept the smart date syntax.+One important thing to be aware of when specifying end dates: as in+Ledger, end dates are exclusive, so you need to write the date+\f[I]after\f[] the last day you want to include.+.PP+Examples:+.PP+.TS+tab(@);+l l.+T{+\f[C]\-b\ 2016/3/17\f[]+T}@T{+begin on St.+Patrick\[aq]s day 2016+T}+T{+\f[C]\-e\ 12/1\f[]+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[]+T}@T{+all transactions on or after the 1st of the current month+T}+T{+\f[C]\-p\ thismonth\f[]+T}@T{+all transactions in the current month+T}+T{+\f[C]date:2016/3/17\-\f[]+T}@T{+the above written as queries instead+T}+T{+\f[C]date:\-12/1\f[]+T}@T{+T}+T{+\f[C]date:thismonth\-\f[]+T}@T{+T}+T{+\f[C]date:thismonth\f[]+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[],+\f[C]\-W/\-\-weekly\f[], \f[C]\-M/\-\-monthly\f[],+\f[C]\-Q/\-\-quarterly\f[], or \f[C]\-Y/\-\-yearly\f[].+More complex intervals may be specified with a period expression.+Report intervals can not be specified with a query, currently.+.SS Period expressions+.PP+The \f[C]\-p/\-\-period\f[] 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\ "from\ 2009/1/1\ to\ 2009/4/1"\f[]+.PP+Keywords like "from" and "to" are optional, and so are the spaces, as+long as you don\[aq]t run two dates together.+"to" can also be written as "\-".+These are equivalent to the above:+.PP+.TS+tab(@);+l.+T{+\f[C]\-p\ "2009/1/1\ 2009/4/1"\f[]+T}+T{+\f[C]\-p2009/1/1to2009/4/1\f[]+T}+T{+\f[C]\-p2009/1/1\-2009/4/1\f[]+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\ "1/1\ 4/1"\f[]+T}+T{+\f[C]\-p\ "january\-apr"\f[]+T}+T{+\f[C]\-p\ "this\ year\ to\ 4/1"\f[]+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\ "from\ 2009/1/1"\f[]+T}@T{+everything after january 1, 2009+T}+T{+\f[C]\-p\ "from\ 2009/1"\f[]+T}@T{+the same+T}+T{+\f[C]\-p\ "from\ 2009"\f[]+T}@T{+the same+T}+T{+\f[C]\-p\ "to\ 2009"\f[]+T}@T{+everything before january 1, 2009+T}+.TE+.PP+A single date with no "from" or "to" defines both the start and end date+like so:+.PP+.TS+tab(@);+l l.+T{+\f[C]\-p\ "2009"\f[]+T}@T{+the year 2009; equivalent to "2009/1/1 to 2010/1/1"+T}+T{+\f[C]\-p\ "2009/1"\f[]+T}@T{+the month of jan; equivalent to "2009/1/1 to 2009/2/1"+T}+T{+\f[C]\-p\ "2009/1/1"\f[]+T}@T{+just that day; equivalent to "2009/1/1 to 2009/1/2"+T}+.TE+.PP+The argument of \f[C]\-p\f[] can also begin with, or be, a report+interval expression.+The basic report intervals are \f[C]daily\f[], \f[C]weekly\f[],+\f[C]monthly\f[], \f[C]quarterly\f[], or \f[C]yearly\f[], which have the+same effect as the \f[C]\-D\f[],\f[C]\-W\f[],\f[C]\-M\f[],\f[C]\-Q\f[],+or \f[C]\-Y\f[] flags.+Between report interval and start/end dates (if any), the word+\f[C]in\f[] is optional.+Examples:+.PP+.TS+tab(@);+l.+T{+\f[C]\-p\ "weekly\ from\ 2009/1/1\ to\ 2009/4/1"\f[]+T}+T{+\f[C]\-p\ "monthly\ in\ 2008"\f[]+T}+T{+\f[C]\-p\ "quarterly"\f[]+T}+.TE+.PP+The following more complex report intervals are also supported:+\f[C]biweekly\f[], \f[C]bimonthly\f[],+\f[C]every\ N\ days|weeks|months|quarters|years\f[],+\f[C]every\ Nth\ day\ [of\ month]\f[],+\f[C]every\ Nth\ day\ of\ week\f[].+.PP+Examples:+.PP+.TS+tab(@);+l.+T{+\f[C]\-p\ "bimonthly\ from\ 2008"\f[]+T}+T{+\f[C]\-p\ "every\ 2\ weeks"\f[]+T}+T{+\f[C]\-p\ "every\ 5\ days\ from\ 1/3"\f[]+T}+.TE+.PP+Show historical balances at end of 15th each month (N is exclusive end+date):+.PP+\f[C]hledger\ balance\ \-H\ \-p\ "every\ 16th\ day"\f[]+.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\ "every\ 3rd\ day\ of\ week"\f[]+.SS Depth limiting+.PP+With the \f[C]\-\-depth\ N\f[] option, 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.+.SS Pivoting+.PP+Normally hledger sums amounts, and organizes them in a hierarchy, based+on account name.+The \f[C]\-\-pivot\ TAGNAME\f[] option causes it to sum and organize+hierarchy based on some other field instead.+.PP+TAGNAME is the full, case\-insensitive name of a tag you have defined,+or one of the built\-in implicit tags (like \f[C]code\f[] or+\f[C]payee\f[]).+As with account names, when tag values have+\f[C]multiple:colon\-separated:parts\f[] hledger will build hierarchy,+displayed in tree\-mode reports, summarisable with a depth limit, and so+on.+.PP+\f[C]\-\-pivot\f[] 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 tag 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[]+.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[]+.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[]+.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[]+.fi+.PP+Another way (the acct: query matches against the pivoted "account+name"):+.IP+.nf+\f[C]+$\ hledger\ balance\ \-\-pivot\ member\ acct:.+\ \ \ \ \ \ \ \ \ \ \ \ \ \ \-2\ EUR\ \ John\ Doe+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\ \ \ \ \ \ \ \ \ \ \ \ \ \ \-2\ EUR+\f[]+.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[], \f[C]desc:REGEX\f[], \f[C]cur:REGEX\f[],+\f[C]tag:...=REGEX\f[]+.IP \[bu] 2+CSV rules conditional blocks: \f[C]if\ REGEX\ ...\f[]+.IP \[bu] 2+account alias directives and options:+\f[C]alias\ /REGEX/\ =\ REPLACEMENT\f[],+\f[C]\-\-alias\ /REGEX/=REPLACEMENT\f[]+.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 (\\<, \\>, \\b, \\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[] directive and \f[C]\-\-alias\f[] option, regular+expressions must be enclosed in forward slashes (\f[C]/REGEX/\f[]).+Elsewhere in hledger, these are not required.+.IP \[bu] 2+In queries, to match a regular expression metacharacter like \f[C]$\f[]+as a literal character, prepend a backslash.+Eg to search for amounts with the dollar sign in hledger\-web, write+\f[C]cur:\\$\f[].+.IP \[bu] 2+On the command line, some metacharacters like \f[C]$\f[] 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, optional prefixes to match+specific fields.+Multiple search terms are combined as follows:+.PP+All commands except print: 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+all the other terms.+.PP+The print command: show 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:+.TP+.B \f[B]\f[C]REGEX\f[]\f[]+match account names by this regular expression+.RS+.RE+.TP+.B \f[B]\f[C]acct:REGEX\f[]\f[]+same as above+.RS+.RE+.TP+.B \f[B]\f[C]amt:N,\ amt:<N,\ amt:<=N,\ amt:>N,\ amt:>=N\f[]\f[]+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.+.RS+.RE+.TP+.B \f[B]\f[C]code:REGEX\f[]\f[]+match by transaction code (eg check number)+.RS+.RE+.TP+.B \f[B]\f[C]cur:REGEX\f[]\f[]+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[]).+Note, to match characters which are regex\-significant, like the dollar+sign (\f[C]$\f[]), you need to prepend \f[C]\\\f[].+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]\\$\[aq]\f[] or+\f[C]hledger\ print\ cur:\\\\$\f[].+.RS+.RE+.TP+.B \f[B]\f[C]desc:REGEX\f[]\f[]+match transaction descriptions+.RS+.RE+.TP+.B \f[B]\f[C]date:PERIODEXPR\f[]\f[]+match dates within the specified period.+PERIODEXPR is a period expression (with no report interval).+Examples: \f[C]date:2016\f[], \f[C]date:thismonth\f[],+\f[C]date:2000/2/1\-2/15\f[], \f[C]date:lastweek\-\f[].+If the \f[C]\-\-date2\f[] command line flag is present, this matches+secondary dates instead.+.RS+.RE+.TP+.B \f[B]\f[C]date2:PERIODEXPR\f[]\f[]+match secondary dates within the specified period.+.RS+.RE+.TP+.B \f[B]\f[C]depth:N\f[]\f[]+match (or display, depending on command) accounts at or above this depth+.RS+.RE+.TP+.B \f[B]\f[C]real:,\ real:0\f[]\f[]+match real or virtual postings respectively+.RS+.RE+.TP+.B \f[B]\f[C]status:*,\ status:!,\ status:\f[]\f[]+match cleared, pending, or uncleared/pending transactions respectively+.RS+.RE+.TP+.B \f[B]\f[C]tag:REGEX[=REGEX]\f[]\f[]+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.+.RS+.RE+.TP+.B \f[B]\f[C]not:\f[]\f[]+before any of the above negates the match.+.RS+.RE+.TP+.B \f[B]\f[C]inacct:ACCTNAME\f[]\f[]+a special term used automatically when you click an account name in+hledger\-web, specifying the account register we are currently in+(selects the transactions of that account and how to show them, can be+filtered further with \f[C]acct\f[] etc).+Not supported elsewhere in hledger.+.RS+.RE+.PP+Some of these can also be expressed as command\-line options (eg+\f[C]depth:2\f[] is equivalent to \f[C]\-\-depth\ 2\f[]).+Generally you can mix options and query arguments, and the resulting+query will be their intersection (perhaps excluding the+\f[C]\-p/\-\-period\f[] option).+.SH COMMANDS+.PP+hledger provides a number of subcommands; \f[C]hledger\f[] with no+arguments shows a list.+.PP+If you install additional \f[C]hledger\-*\f[] packages, or if you put+programs or scripts named \f[C]hledger\-NAME\f[] 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[]).+You can also write any unambiguous prefix of a command name+(\f[C]hledger\ inc\f[]), or one of the standard short aliases displayed+in the command list (\f[C]hledger\ is\f[]).+.SS accounts+.PP+Show account names.+.TP+.B \f[C]\-\-tree\f[]+show short account names, as a tree+.RS+.RE+.TP+.B \f[C]\-\-flat\f[]+show full account names, as a list (default)+.RS+.RE+.TP+.B \f[C]\-\-drop=N\f[]+in flat mode: omit N leading account name parts+.RS+.RE+.PP+This command lists all account names that are in use (ie, all the+accounts which have at least one transaction posting to them).+With query arguments, only matched account names are shown.+.PP+It shows a flat list by default.+With \f[C]\-\-tree\f[], it uses indentation to show the account+hierarchy.+.PP+In flat mode you can add \f[C]\-\-drop\ N\f[] to omit the first few+account name components.+.PP+Examples:+.IP+.nf+\f[C]+$\ hledger\ accounts\ \-\-tree+assets+\ \ bank+\ \ \ \ checking+\ \ \ \ saving+\ \ cash+expenses+\ \ food+\ \ supplies+income+\ \ gifts+\ \ salary+liabilities+\ \ debts+\f[]+.fi+.IP+.nf+\f[C]+$\ hledger\ accounts\ \-\-drop\ 1+bank:checking+bank:saving+cash+food+supplies+gifts+salary+debts+\f[]+.fi+.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[]+.fi+.SS activity+.PP+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.+.IP+.nf+\f[C]+$\ hledger\ activity\ \-\-quarterly+2008\-01\-01\ **+2008\-04\-01\ *******+2008\-07\-01\ +2008\-10\-01\ **+\f[]+.fi+.SS add+.PP+Prompt for transactions and add them to the journal.+.TP+.B \f[C]\-\-no\-new\-accounts\f[]+don\[aq]t allow creating new accounts; helps prevent typos when entering+account names+.RS+.RE+.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[] 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[] 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[] and follow the prompts.+You can add as many transactions as you like; when you are finished,+enter \f[C]\&.\f[] or press control\-d or control\-c to exit.+.PP+Features:+.IP \[bu] 2+add tries to provide useful defaults, using the most similar recent+transaction (by description) 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[], \f[C]today\f[],+\f[C]tomorrow\f[]).+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[] 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[]+.fi+.SS balance+.PP+Show accounts and their balances.+Alias: bal.+.TP+.B \f[C]\-\-change\f[]+show balance change in each period (default)+.RS+.RE+.TP+.B \f[C]\-\-cumulative\f[]+show balance change accumulated across periods (in multicolumn reports)+.RS+.RE+.TP+.B \f[C]\-H\ \-\-historical\f[]+show historical ending balance in each period (includes postings before+report start date)+.RS+.RE+.TP+.B \f[C]\-\-tree\f[]+show accounts as a tree; amounts include subaccounts (default in simple+reports)+.RS+.RE+.TP+.B \f[C]\-\-flat\f[]+show accounts as a list; amounts exclude subaccounts except when account+is depth\-clipped (default in multicolumn reports)+.RS+.RE+.TP+.B \f[C]\-A\ \-\-average\f[]+show a row average column (in multicolumn mode)+.RS+.RE+.TP+.B \f[C]\-T\ \-\-row\-total\f[]+show a row total column (in multicolumn mode)+.RS+.RE+.TP+.B \f[C]\-N\ \-\-no\-total\f[]+don\[aq]t show the final total row+.RS+.RE+.TP+.B \f[C]\-\-drop=N\f[]+omit N leading account name parts (in flat mode)+.RS+.RE+.TP+.B \f[C]\-\-no\-elide\f[]+don\[aq]t squash boring parent accounts (in tree mode)+.RS+.RE+.TP+.B \f[C]\-\-format=LINEFORMAT\f[]+in single\-column balance reports: use this custom line format+.RS+.RE+.TP+.B \f[C]\-O\ FMT\ \-\-output\-format=FMT\f[]+select the output format.+Supported formats: txt, csv.+.RS+.RE+.TP+.B \f[C]\-o\ FILE\ \-\-output\-file=FILE\f[]+write output to FILE.+A file extension matching one of the above formats selects that format.+.RS+.RE+.TP+.B \f[C]\-\-pretty\-tables\f[]+Use unicode to display prettier tables.+.RS+.RE+.PP+The balance command displays accounts and balances.+It is hledger\[aq]s most featureful and most useful command.+.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[]+.fi+.PP+More precisely, the balance command shows the \f[I]change\f[] to each+account\[aq]s balance caused by all (matched) postings.+In the common case where you do not filter by date and your journal sets+the correct opening balances, this is the same as the account\[aq]s+ending balance.+.PP+By default, accounts are displayed hierarchically, with subaccounts+indented below their parent.+"Boring" accounts, which contain a single interesting subaccount and no+balance of their own, are elided into the following line for more+compact output.+(Use \f[C]\-\-no\-elide\f[] to prevent this.)+.PP+Each account\[aq]s balance is the "inclusive" balance \- it includes the+balances of any subaccounts.+.PP+Accounts which have zero balance (and no non\-zero subaccounts) are+omitted.+Use \f[C]\-E/\-\-empty\f[] to show them.+.PP+A final total is displayed by default; use \f[C]\-N/\-\-no\-total\f[] to+suppress it:+.IP+.nf+\f[C]+$\ hledger\ balance\ \-p\ 2008/6\ expenses\ \-\-no\-total+\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $2\ \ expenses+\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ food+\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ supplies+\f[]+.fi+.SS Flat mode+.PP+To see a flat list of full account names instead of the default+hierarchical display, use \f[C]\-\-flat\f[].+In this mode, accounts (unless depth\-clipped) show their "exclusive"+balance, excluding any subaccount balances.+In this mode, you can also use \f[C]\-\-drop\ N\f[] 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[]+.fi+.SS Depth limited balance reports+.PP+With \f[C]\-\-depth\ N\f[], balance shows accounts only to the specified+depth.+This is very useful to show a complex charts of accounts in less detail.+In flat mode, balances from accounts below the depth limit will be shown+as part of a parent account at the depth limit.+.IP+.nf+\f[C]+$\ hledger\ balance\ \-N\ \-\-depth\ 1+\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ assets+\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $2\ \ expenses+\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2\ \ income+\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ liabilities+\f[]+.fi+.SS Multicolumn balance reports+.PP+With a reporting interval, multiple balance columns will be shown, one+for each report period.+There are three types of multi\-column 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[]+.fi+.RE+.IP "2." 3+With \f[C]\-\-cumulative\f[]: 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[]+.fi+.RE+.IP "3." 3+With \f[C]\-\-historical/\-H\f[]: 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\ ^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\ +\f[]+.fi+.RE+.PP+Multi\-column balance reports display accounts in flat mode by default;+to see the hierarchy, use \f[C]\-\-tree\f[].+.PP+With a reporting interval (like \f[C]\-\-quarterly\f[] 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.+.PP+The \f[C]\-E/\-\-empty\f[] 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[] flag adds an additional column showing+the total for each row.+.PP+The \f[C]\-A/\-\-average\f[] 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[]+.fi+.SS Market value+.PP+The \f[C]\-V/\-\-value\f[] flag converts the reported amounts to their+market value on the report end date, using the most recent applicable+market prices, when known.+Specifically, when there is a market price (P directive) for the+amount\[aq]s commodity, dated on or before the report end date (see+hledger \-> Report start & end date), the amount will be converted to+the price\[aq]s commodity.+If multiple applicable prices are defined, the latest\-dated one is used+(and if dates are equal, the one last parsed).+.PP+For example:+.IP+.nf+\f[C]+#\ 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+\f[]+.fi+.PP+How many euros do I have ?+.IP+.nf+\f[C]+$\ hledger\ \-f\ t.j\ bal\ euros+\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ €100\ \ assets:euros+\f[]+.fi+.PP+What are they worth on nov 3 ?+(no report end date specified, defaults to the last date in the journal)+.IP+.nf+\f[C]+$\ hledger\ \-f\ t.j\ bal\ euros\ \-V+\ \ \ \ \ \ \ \ \ \ \ \ \ $110.00\ \ assets:euros+\f[]+.fi+.PP+What are they worth on dec 21 ?+.IP+.nf+\f[C]+$\ hledger\ \-f\ t.j\ bal\ euros\ \-V\ \-e\ 2016/12/21+\ \ \ \ \ \ \ \ \ \ \ \ \ $103.00\ \ assets:euros+\f[]+.fi+.PP+Currently, hledger\[aq]s \-V only uses market prices recorded with P+directives, not transaction prices (unlike Ledger).+.PP+Using \-B and \-V together is allowed.+.SS Custom balance output+.PP+In simple (non\-multi\-column) balance reports, you can customise the+output with \f[C]\-\-format\ FMT\f[]:+.IP+.nf+\f[C]+$\ 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+\f[]+.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[]+.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[] \- 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[] \- the account\[aq]s name+.IP \[bu] 2+\f[C]total\f[] \- 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[] \- render on multiple lines, bottom\-aligned (the default)+.IP \[bu] 2+\f[C]%^\f[] \- render on multiple lines, top\-aligned+.IP \[bu] 2+\f[C]%,\f[] \- render on one line, comma\-separated+.PP+There are some quirks.+Eg in one\-line mode, \f[C]%(depth_spacer)\f[] has no effect, instead+\f[C]%(account)\f[] has indentation built in.+ Experimentation may be needed to get pleasing results.+.PP+Some example formats:+.IP \[bu] 2+\f[C]%(total)\f[] \- the account\[aq]s total+.IP \[bu] 2+\f[C]%\-20.20(account)\f[] \- 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[] \- 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[] \- the default+format for the single\-column balance report+.SS Output destination+.PP+The balance, print, register and stats commands can write their output+to a destination other than the console.+This is controlled by the \f[C]\-o/\-\-output\-file\f[] option.+.IP+.nf+\f[C]+$\ hledger\ balance\ \-o\ \-\ \ \ \ \ #\ write\ to\ stdout\ (the\ default)+$\ hledger\ balance\ \-o\ FILE\ \ #\ write\ to\ FILE+\f[]+.fi+.SS CSV output+.PP+The balance, print and register commands can write their output as CSV.+This is useful for exporting data to other applications, eg to make+charts in a spreadsheet.+This is controlled by the \f[C]\-O/\-\-output\-format\f[] option, or by+specifying a \f[C]\&.csv\f[] file extension with+\f[C]\-o/\-\-output\-file\f[].+.IP+.nf+\f[C]+$\ hledger\ balance\ \-O\ csv\ \ \ \ \ \ \ #\ write\ CSV\ to\ stdout+$\ hledger\ balance\ \-o\ FILE.csv\ \ #\ write\ CSV\ to\ FILE.csv+\f[]+.fi+.SS balancesheet+.PP+Show a balance sheet.+Alias: bs.+.TP+.B \f[C]\-\-change\f[]+show balance change in each period, instead of historical ending+balances+.RS+.RE+.TP+.B \f[C]\-\-cumulative\f[]+show balance change accumulated across periods (in multicolumn reports),+instead of historical ending balances+.RS+.RE+.TP+.B \f[C]\-H\ \-\-historical\f[]+show historical ending balance in each period (includes postings before+report start date) (default)+.RS+.RE+.TP+.B \f[C]\-\-tree\f[]+show accounts as a tree; amounts include subaccounts (default in simple+reports)+.RS+.RE+.TP+.B \f[C]\-\-flat\f[]+show accounts as a list; amounts exclude subaccounts except when account+is depth\-clipped (default in multicolumn reports)+.RS+.RE+.TP+.B \f[C]\-A\ \-\-average\f[]+show a row average column (in multicolumn mode)+.RS+.RE+.TP+.B \f[C]\-T\ \-\-row\-total\f[]+show a row total column (in multicolumn mode)+.RS+.RE+.TP+.B \f[C]\-N\ \-\-no\-total\f[]+don\[aq]t show the final total row+.RS+.RE+.TP+.B \f[C]\-\-drop=N\f[]+omit N leading account name parts (in flat mode)+.RS+.RE+.TP+.B \f[C]\-\-no\-elide\f[]+don\[aq]t squash boring parent accounts (in tree mode)+.RS+.RE+.TP+.B \f[C]\-\-format=LINEFORMAT\f[]+in single\-column balance reports: use this custom line format+.RS+.RE+.PP+This command displays a simple balance sheet.+It currently assumes that you have top\-level accounts named+\f[C]asset\f[] and \f[C]liability\f[] (plural forms also allowed.)+.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[]+.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[]/\f[C]\-\-cumulative\f[]/\f[C]\-\-historical\f[].+Normally balancesheet shows historical ending balances, which is what+you need for a balance sheet; note this means it ignores report begin+dates.+.SS cashflow+.PP+Show a cashflow statement.+Alias: cf.+.TP+.B \f[C]\-\-change\f[]+show balance change in each period (default)+.RS+.RE+.TP+.B \f[C]\-\-cumulative\f[]+show balance change accumulated across periods (in multicolumn reports),+instead of changes during periods+.RS+.RE+.TP+.B \f[C]\-H\ \-\-historical\f[]+show historical ending balance in each period (includes postings before+report start date), instead of changes during each period+.RS+.RE+.TP+.B \f[C]\-\-tree\f[]+show accounts as a tree; amounts include subaccounts (default in simple+reports)+.RS+.RE+.TP+.B \f[C]\-\-flat\f[]+show accounts as a list; amounts exclude subaccounts except when account+is depth\-clipped (default in multicolumn reports)+.RS+.RE+.TP+.B \f[C]\-A\ \-\-average\f[]+show a row average column (in multicolumn mode)+.RS+.RE+.TP+.B \f[C]\-T\ \-\-row\-total\f[]+show a row total column (in multicolumn mode)+.RS+.RE+.TP+.B \f[C]\-N\ \-\-no\-total\f[]+don\[aq]t show the final total row (in simple reports)+.RS+.RE+.TP+.B \f[C]\-\-drop=N\f[]+omit N leading account name parts (in flat mode)+.RS+.RE+.TP+.B \f[C]\-\-no\-elide\f[]+don\[aq]t squash boring parent accounts (in tree mode)+.RS+.RE+.TP+.B \f[C]\-\-format=LINEFORMAT\f[]+in single\-column balance reports: use this custom line format+.RS+.RE+.PP+This command displays a simple cashflow statement It shows the change in+all "cash" (ie, liquid assets) accounts for the period.+It currently assumes that cash accounts are under a top\-level account+named \f[C]asset\f[] and do not contain \f[C]receivable\f[] or+\f[C]A/R\f[] (plural forms also allowed.)+.IP+.nf+\f[C]+$\ hledger\ cashflow+Cashflow\ Statement++Cash\ flows:+\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ assets+\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ bank:saving+\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2\ \ \ \ cash+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1++Total:+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1+\f[]+.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[]/\f[C]\-\-cumulative\f[]/\f[C]\-\-historical\f[].+.SS help+.PP+Show any of the hledger manuals.+.PP+The \f[C]help\f[] command displays any of the main hledger man pages.+(Unlike \f[C]hledger\ \-\-help\f[], which displays only the hledger man+page.) Run it with no arguments to list available topics (their names+are shortened for easier typing), and run \f[C]hledger\ help\ TOPIC\f[]+to select one.+The output is similar to a man page, but fixed width.+It may be long, so you may wish to pipe it into a pager.+See also info and man.+.IP+.nf+\f[C]+$\ hledger\ help+Choose\ a\ topic,\ eg:\ hledger\ help\ cli+cli,\ ui,\ web,\ api,\ journal,\ csv,\ timeclock,\ timedot+\f[]+.fi+.IP+.nf+\f[C]+$\ hledger\ help\ cli\ |\ less++hledger(1)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ hledger\ User\ Manuals\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ hledger(1)++++NAME+\ \ \ \ \ \ \ hledger\ \-\ a\ command\-line\ accounting\ tool++SYNOPSIS+\ \ \ \ \ \ \ hledger\ [\-f\ FILE]\ COMMAND\ [OPTIONS]\ [CMDARGS]+\ \ \ \ \ \ \ hledger\ [\-f\ FILE]\ ADDONCMD\ \-\-\ [OPTIONS]\ [CMDARGS]+:+\f[]+.fi+.SS incomestatement+.PP+Show an income statement.+Alias: is.+.TP+.B \f[C]\-\-change\f[]+show balance change in each period (default)+.RS+.RE+.TP+.B \f[C]\-\-cumulative\f[]+show balance change accumulated across periods (in multicolumn reports),+instead of changes during periods+.RS+.RE+.TP+.B \f[C]\-H\ \-\-historical\f[]+show historical ending balance in each period (includes postings before+report start date), instead of changes during each period+.RS+.RE+.TP+.B \f[C]\-\-tree\f[]+show accounts as a tree; amounts include subaccounts (default in simple+reports)+.RS+.RE+.TP+.B \f[C]\-\-flat\f[]+show accounts as a list; amounts exclude subaccounts except when account+is depth\-clipped (default in multicolumn reports)+.RS+.RE+.TP+.B \f[C]\-A\ \-\-average\f[]+show a row average column (in multicolumn mode)+.RS+.RE+.TP+.B \f[C]\-T\ \-\-row\-total\f[]+show a row total column (in multicolumn mode)+.RS+.RE+.TP+.B \f[C]\-N\ \-\-no\-total\f[]+don\[aq]t show the final total row+.RS+.RE+.TP+.B \f[C]\-\-drop=N\f[]+omit N leading account name parts (in flat mode)+.RS+.RE+.TP+.B \f[C]\-\-no\-elide\f[]+don\[aq]t squash boring parent accounts (in tree mode)+.RS+.RE+.TP+.B \f[C]\-\-format=LINEFORMAT\f[]+in single\-column balance reports: use this custom line format+.RS+.RE+.PP+This command displays a simple income statement.+It currently assumes that you have top\-level accounts named+\f[C]income\f[] (or \f[C]revenue\f[]) and \f[C]expense\f[] (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[]+.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[]/\f[C]\-\-cumulative\f[]/\f[C]\-\-historical\f[].+.SS info+.PP+Show any of the hledger manuals using info.+.PP+The \f[C]info\f[] command displays any of the hledger reference manuals+using the info hypertextual documentation viewer.+This can be a very efficient way to browse large manuals.+It requires the "info" program to be available in your PATH.+.PP+As with help, run it with no arguments to list available topics+(manuals).+.SS man+.PP+Show any of the hledger manuals using man.+.PP+The \f[C]man\f[] command displays any of the hledger reference manuals+using man, the standard documentation viewer on unix systems.+This will fit the text to your terminal width, and probably invoke a+pager automatically.+It requires the "man" program to be available in your PATH.+.PP+As with help, run it with no arguments to list available topics+(manuals).+.SS print+.PP+Show transactions from the journal.+.TP+.B \f[C]\-x\ \ \ \ \ \-\-explicit\f[]+show all amounts explicitly+.RS+.RE+.TP+.B \f[C]\-m\ STR\ \-\-match=STR\f[]+show the transaction whose description is most similar to STR, and is+most recent+.RS+.RE+.TP+.B \f[C]\-O\ FMT\ \-\-output\-format=FMT\f[]+select the output format.+Supported formats: txt, csv.+.RS+.RE+.TP+.B \f[C]\-o\ FILE\ \-\-output\-file=FILE\f[]+write output to FILE.+A file extension matching one of the above formats selects that format.+.RS+.RE+.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[]+.fi+.PP+The print command displays full journal entries (transactions) from the+journal file, tidily formatted.+.PP+As of hledger 1.2, print\[aq]s output is always a valid hledger journal.+However it may not preserve all original content, eg it does not print+directives or inter\-transaction comments.+.PP+Normally, transactions\[aq] implicit/explicit amount style is preserved:+when an amount is omitted in the journal, it will be omitted in the+output.+You can use the \f[C]\-x/\-\-explicit\f[] 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, in this mode postings with a multi\-commodity amount (possible+with an implicit amount in a multi\-commodity transaction) will be split+into multiple single\-commodity postings, for valid journal output.+.PP+With \-B/\-\-cost, amounts with transaction prices are converted to cost+(using the transaction price).+.PP+The print command also supports output destination and CSV output.+Here\[aq]s an example of print\[aq]s CSV output:+.IP+.nf+\f[C]+$\ 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","","",""+\f[]+.fi+.IP \[bu] 2+There is one CSV record per posting, with the parent transaction\[aq]s+fields repeated.+.IP \[bu] 2+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.)+.IP \[bu] 2+The amount is separated into "commodity" (the symbol) and "amount"+(numeric quantity) fields.+.IP \[bu] 2+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.)+.SS register+.PP+Show postings and their running total.+Alias: reg.+.TP+.B \f[C]\-\-cumulative\f[]+show running total from report start date (default)+.RS+.RE+.TP+.B \f[C]\-H\ \-\-historical\f[]+show historical running total/balance (includes postings before report+start date)+.RS+.RE+.TP+.B \f[C]\-A\ \-\-average\f[]+show running average of posting amounts instead of total (implies+\-\-empty)+.RS+.RE+.TP+.B \f[C]\-r\ \-\-related\f[]+show postings\[aq] siblings instead+.RS+.RE+.TP+.B \f[C]\-w\ N\ \-\-width=N\f[]+set output width (default: terminal width or COLUMNS.+\-wN,M sets description width as well)+.RS+.RE+.TP+.B \f[C]\-O\ FMT\ \-\-output\-format=FMT\f[]+select the output format.+Supported formats: txt, csv.+.RS+.RE+.TP+.B \f[C]\-o\ FILE\ \-\-output\-file=FILE\f[]+write output to FILE.+A file extension matching one of the above formats selects that format.+.RS+.RE+.PP+The register command displays postings, 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[]+.fi+.PP+The \f[C]\-\-historical\f[]/\f[C]\-H\f[] 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[]+.fi+.PP+The \f[C]\-\-depth\f[] option limits the amount of sub\-account detail+displayed.+.PP+The \f[C]\-\-average\f[]/\f[C]\-A\f[] 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[] (see below).+It is affected by \f[C]\-\-historical\f[].+It works best when showing just one account and one commodity.+.PP+The \f[C]\-\-related\f[]/\f[C]\-r\f[] flag shows the \f[I]other\f[]+postings in the transactions of the postings which would normally be+shown.+.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[]+.fi+.PP+Periods with no activity, and summary postings with a zero amount, are+not shown by default; use the \f[C]\-\-empty\f[]/\f[C]\-E\f[] 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[]+.fi+.PP+Often, you\[aq]ll want to see just one line per interval.+The \f[C]\-\-depth\f[] 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[]+.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[] environment+variable (not a bash shell variable) or by using the+\f[C]\-\-width\f[]/\f[C]\-w\f[] 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[] .+Here\[aq]s a diagram:+.IP+.nf+\f[C]+<\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\ width\ (W)\ \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\->+date\ (10)\ \ description\ (D)\ \ \ \ \ \ \ account\ (W\-41\-D)\ \ \ \ \ amount\ (12)\ \ \ balance\ (12)+DDDDDDDDDD\ dddddddddddddddddddd\ \ aaaaaaaaaaaaaaaaaaa\ \ AAAAAAAAAAAA\ \ AAAAAAAAAAAA+\f[]+.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,\ and\ set\ description\ width+\f[]+.fi+.PP+The register command also supports the \f[C]\-o/\-\-output\-file\f[] and+\f[C]\-O/\-\-output\-format\f[] options for controlling output+destination and CSV output.+.SS stats+.PP+Show some journal statistics.+.TP+.B \f[C]\-o\ FILE\ \-\-output\-file=FILE\f[]+write output to FILE.+A file extension matching one of the above formats selects that format.+.RS+.RE+.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\ ($)+\f[]+.fi+.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+The stats command also supports \f[C]\-o/\-\-output\-file\f[] for+controlling output destination.+.SS test+.PP+Run built\-in unit tests.+.IP+.nf+\f[C]+$\ hledger\ test+Cases:\ 74\ \ Tried:\ 74\ \ Errors:\ 0\ \ Failures:\ 0+\f[]+.fi+.PP+This command runs hledger\[aq]s built\-in unit tests and displays a+quick report.+With a regular expression argument, it selects only tests with matching+names.+It\[aq]s mainly used in development, but it\[aq]s also nice to be able+to check your hledger executable for smoke at any time.+.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[] and ends with a recognised file extension (currently:+no extension, \f[C]bat\f[],\f[C]com\f[],\f[C]exe\f[],+\f[C]hs\f[],\f[C]lhs\f[],\f[C]pl\f[],\f[C]py\f[],\f[C]rb\f[],\f[C]rkt\f[],\f[C]sh\f[]).+.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[] add\-on is installed,+.IP \[bu] 2+\f[C]hledger\ \-h\ web\f[] shows hledger\[aq]s help, while+\f[C]hledger\ web\ \-h\f[] shows hledger\-web\[aq]s help.+.IP \[bu] 2+Flags specific to the add\-on must have a preceding \f[C]\-\-\f[] to+hide them from hledger.+So \f[C]hledger\ web\ \-\-serve\ \-\-port\ 9000\f[] will be rejected;+you must use \f[C]hledger\ web\ \-\-\ \-\-serve\ \-\-port\ 9000\f[].+.IP \[bu] 2+You can always run add\-ons directly if preferred:+\f[C]hledger\-web\ \-\-serve\ \-\-port\ 9000\f[].+.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 api+.PP+hledger\-api serves hledger data as a JSON web API.+.SS ui+.PP+hledger\-ui provides an efficient curses\-style 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 curses\-style, more interactive 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.+.SS Experimental add\-ons+.PP+These are available in source form in the hledger repo\[aq]s bin/+directory; installing them is pretty easy.+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 budget+.PP+hledger\-budget.hs adds more budget\-tracking features to hledger.+.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.+.SS check\-dates+.PP+hledger\-check\-dates.hs checks that journal entries are ordered by+date.+.SS check\-dupes+.PP+hledger\-check\-dupes.hs checks for account names sharing the same leaf+name.+.SS equity+.PP+hledger\-equity.hs prints balance\-resetting transactions, useful for+bringing account balances across file boundaries.+.SS prices+.PP+hledger\-prices.hs prints all prices from the journal.+.SS print\-unique+.PP+hledger\-print\-unique.hs prints transactions which do not reuse an+already\-seen description.+.SS register\-match+.PP+hledger\-register\-match.hs helps ledger\-autosync detect already\-seen+transactions when importing.+.SS rewrite+.PP+hledger\-rewrite.hs Adds one or more custom postings to matched+transactions.+.SH ENVIRONMENT+.PP+\f[B]COLUMNS\f[] The screen width used by the register command.+Default: the full terminal width.+.PP+\f[B]LEDGER_FILE\f[] The journal file path when not specified with+\f[C]\-f\f[].+Default: \f[C]~/.hledger.journal\f[] (on windows, perhaps+\f[C]C:/Users/USER/.hledger.journal\f[]).+.SH FILES+.PP+Reads data from one or more files in hledger journal, timeclock,+timedot, or CSV format specified with \f[C]\-f\f[], or+\f[C]$LEDGER_FILE\f[], or \f[C]$HOME/.hledger.journal\f[] (on windows,+perhaps \f[C]C:/Users/USER/.hledger.journal\f[]).+.SH BUGS+.PP+The need to precede addon command options with \f[C]\-\-\f[] when+invoked from hledger is awkward.+.PP+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.+.PP+In a Microsoft Windows CMD window, non\-ascii characters and colours are+not supported.+.PP+In a Cygwin/MSYS/Mintty window, the tab key is not supported in hledger+add.+.PP+Not all of Ledger\[aq]s journal file syntax is supported.+See file format differences.+.PP+On large data files, hledger is slower and uses more memory than Ledger.+.SH TROUBLESHOOTING+.PP+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):+.PP+\f[B]Successfully installed, but "No command \[aq]hledger\[aq]+found"\f[]+.PD 0+.P+.PD+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.+.PP+\f[B]I set a custom LEDGER_FILE, but hledger is still using the default+file\f[]+.PD 0+.P+.PD+\f[C]LEDGER_FILE\f[] should be a real environment variable, not just a+shell variable.+The command \f[C]env\ |\ grep\ LEDGER_FILE\f[] should show it.+You may need to use \f[C]export\f[].+Here\[aq]s an explanation.+.PP+\f[B]"Illegal byte sequence" or "Invalid or incomplete multibyte or wide+character" errors\f[]+.PD 0+.P+.PD+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\[aq]m not sure yet).+.PP+Here\[aq]s an example of setting the locale temporarily, on ubuntu+gnu/linux:+.IP+.nf+\f[C]+$\ 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+\f[]+.fi+.PP+Here\[aq]s one way to set it permanently, there are probably better+ways:+.IP+.nf+\f[C]+$\ echo\ "export\ LANG=en_US.UTF\-8"\ >>~/.bash_profile+$\ bash\ \-\-login+\f[]+.fi+.PP+If we preferred to use eg \f[C]fr_FR.utf8\f[], we might have to install+that first:+.IP+.nf+\f[C]+$\ 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+\f[]+.fi+.PP+Note some platforms allow variant locale spellings, but not all (ubuntu+accepts \f[C]fr_FR.UTF8\f[], mac osx requires exactly+\f[C]fr_FR.UTF\-8\f[]). .SH "REPORTING BUGS"
doc/hledger.1.info view
@@ -1,2329 +1,2214 @@-This is hledger/doc/hledger.1.info, produced by makeinfo version 4.8-from stdin.---File: hledger.1.info, Node: Top, Up: (dir)--hledger(1) hledger 1.1-**********************--This is hledger's command-line interface (there are also curses 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'. See-COMMANDS and EXAMPLES below.--* Menu:--* EXAMPLES::-* OPTIONS::-* QUERIES::-* COMMANDS::-* ADD-ON COMMANDS::-* TROUBLESHOOTING::---File: hledger.1.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-- With the journal---2016/02/16 Member Fee Payment John Doe- assets:bank account 2 EUR- income:member fees -2 EUR- ; member: John Doe-- the -pivot comand will output the following:---$ hledger bal --pivot member- 2 EUR assets:bank account- -2 EUR member:John Doe---File: hledger.1.info, Node: OPTIONS, Next: QUERIES, Prev: EXAMPLES, Up: Top--2 OPTIONS-*********--To see general usage and the command list: `hledger -h' or just-`hledger'. To see usage for a specific command: `hledger COMMAND -h'.-- hledger has several kinds of options:-- * General options are always available and can appear anywhere on the- command line. `hledger -h' shows these. Eg: `hledger --version'.-- * Common reporting options are available with most commands. These- and all other non-general options must be written after COMMAND.- `hledger COMMAND -h' shows these. Eg: `hledger register --cleared'.-- * Command-specific options are also provided by some commands.- `hledger COMMAND -h' shows these too. Eg: `hledger register- --average'.-- * Some hledger commands come from separate add-on executables, which- have their own options. `hledger COMMAND -h' shows these, as- usual. Such options, if not also supported by hledger, should be- written following a double hyphen argument (`--') so that- hledger's option parser does not complain. Eg: `hledger ui --- --register=checking'. Or, you can just run the add-on directly:- `hledger-ui --register=checking'.--- Command arguments may also follow the command name. In most cases-these specify a query which filters the data. Command options and-arguments can be intermixed.-- Option and argument values containing problematic characters should-be escaped with double quotes, backslashes, or (best) single quotes.-This means spaces, but also characters which are significant to your-command shell, such as less-than/greater-than. Eg: `hledger register -p-'last year' "accounts receivable (receivable|payable)" amt:\>100'.-- Characters which are significant to the shell and also in regular-expressions, like parentheses, the pipe symbol and the dollar sign, must-sometimes be double-escaped. Eg, to match the dollar symbol: `hledger-balance cur:'\$'' or `hledger balance cur:\\$'.-- There's more.. options and arguments being passed by hledger to an-add-on executable get de-escaped once in the process. In this case you-might need triple-escaping. Eg: `hledger ui cur:'\\$'' or `hledger ui-cur:\\\\$'.-- If in doubt, keep things simple:-- * write options after the command-- * enclose problematic args in single quotes-- * if needed, also add a backslash to escape regexp metacharacters-- * run add-on executables directly-- If you're really curious, add `--debug=2' for troubleshooting.--* Menu:--* General options::-* Reporting options::-* Input files::-* Depth limiting::-* Smart dates::-* Report start & end date::-* Report intervals::-* Period expressions::-* Regular expressions::---File: hledger.1.info, Node: General options, Next: Reporting options, Up: OPTIONS--2.1 General options-===================--Always available, can be written before or after COMMAND.--`-h'- show general usage (or after COMMAND, the command's usage)--`--help'- show the current program's manual as plain text (or after an add-on- COMMAND, the add-on's manual)--`--man'- show the current program's manual with man--`--info'- show the current program's manual with info--`--version'- show version--`--debug[=N]'- show debug output (levels 1-9, default: 1)--`-f FILE --file=FILE'- use a different input file. For stdin, use ---`--rules-file=RULESFILE'- Conversion rules file to use when reading CSV (default: FILE.rules)--`--alias=OLD=NEW'- display accounts named OLD as NEW--`-I --ignore-assertions'- ignore any failing balance assertions in the journal---File: hledger.1.info, Node: Reporting options, Next: Input files, Prev: General options, Up: OPTIONS--2.2 Reporting options-=====================--Common reporting options, must be written after COMMAND.--`-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- (overrides the flags above)--`--date2'- show, and match with -b/-e/-p/date:, secondary dates instead--`-C --cleared'- include only cleared postings/txns--`--pending'- include only pending postings/txns--`-U --uncleared'- include only uncleared (and pending) postings/txns--`-R --real'- include only non-virtual postings--`--depth=N'- hide accounts/postings deeper than N--`-E --empty'- show items with zero amount, normally hidden--`-B --cost'- convert amounts to their cost at transaction time (using the- transaction price, if any)--`--pivot TAG'- will transform the journal before any other processing by- replacing the account name of every posting having the tag TAG- with content VALUE by the account name "TAG:VALUE". The TAG will- only match if it is a full-length match. The pivot will only- happen if the TAG is on a posting, not if it is on the- transaction. If the tag value is a multi:level:account:name the- new account name will be "TAG:multi:level:account:name".--`--anon'- show anonymized accounts and payees-- If a reporting option occurs more than once on the command line, the-last one takes precedence. Eg -p jan -p feb is equivalent to -p feb.---File: hledger.1.info, Node: Input files, Next: Depth limiting, Prev: Reporting options, Up: OPTIONS--2.3 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 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 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. (Directives in one file will not affect the other-files. If you need that, use the include directive instead.)---File: hledger.1.info, Node: Depth limiting, Next: Smart dates, Prev: Input files, Up: OPTIONS--2.4 Depth limiting-==================--With the `--depth N' option, 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.---File: hledger.1.info, Node: Smart dates, Next: Report start & end date, Prev: Depth limiting, Up: OPTIONS--2.5 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:--`2009/1/1', `2009/01/01', `2009-1-1', `2009.1.1' simple dates, several separators allowed-`2009/1', `2009' same as above - a missing day or month defaults to 1-`1/1', `january', `jan', `this year' relative dates, meaning january 1 of the current year-`next year' january 1 of next year-`this month' the 1st of the current month-`this week' the most recent monday-`last week' the monday of the week before this one-`lastweek' spaces are optional-`today', `yesterday', `tomorrow' ---File: hledger.1.info, Node: Report start & end date, Next: Report intervals, Prev: Smart dates, Up: OPTIONS--2.6 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. One important thing to be aware of-when specifying end dates: as in Ledger, end dates are exclusive, so-you need to write the date _after_ the last day you want to include.-- 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.1.info, Node: Report intervals, Next: Period expressions, Prev: Report start & end date, Up: OPTIONS--2.7 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, currently.---File: hledger.1.info, Node: Period expressions, Next: Regular expressions, Prev: Report intervals, Up: OPTIONS--2.8 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"'-- The following more complex report intervals are also supported:-`biweekly', `bimonthly', `every N days|weeks|months|quarters|years',-`every Nth day [of month]', `every Nth day of week'.-- Examples:--`-p "bimonthly from 2008"'-`-p "every 2 weeks"'-`-p "every 5 days from 1/3"'-- 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.1.info, Node: Regular expressions, Prev: Period expressions, Up: OPTIONS--2.9 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.-- * 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 a second time, with- single or double quotes or another backslash. Eg, to match amounts- with the dollar sign from the command line, write `cur:'\$'' or- `cur:\\$'.----File: hledger.1.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,-optional prefixes to match specific fields. Multiple search terms are-combined as follows:-- All commands except print: show transactions/postings/accounts which-match (or negatively match)-- * any of the description terms AND-- * any of the account terms AND-- * all the other terms.-- The print command: show 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:--*`REGEX'*- match account names by this regular expression--*`acct:REGEX'*- 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--*`real:, real:0'*- match real or virtual postings respectively--*`status:*, status:!, status:'*- match cleared, pending, or uncleared/pending 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.--*`not:'*- before any of the above negates the match.--*`inacct:ACCTNAME'*- a special term used automatically when you click an account name in- hledger-web, specifying the account register we are currently in- (selects the transactions of that account and how to show them,- can be filtered further with `acct' etc). Not supported elsewhere- in hledger.-- 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.1.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 any unambiguous prefix of a-command name (`hledger inc'), or one of the standard short aliases-displayed in the command list (`hledger is').--* Menu:--* accounts::-* activity::-* add::-* balance::-* balancesheet::-* cashflow::-* help::-* incomestatement::-* info::-* man::-* print::-* register::-* stats::-* test::---File: hledger.1.info, Node: accounts, Next: activity, Up: COMMANDS--4.1 accounts-============--Show account names.--`--tree'- show short account names, as a tree--`--flat'- show full account names, as a list (default)--`--drop=N'- in flat mode: omit N leading account name parts-- This command lists all account names that are in use (ie, all the-accounts which have at least one transaction posting to them). With-query arguments, only matched account names 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.-- Examples:---$ hledger accounts --tree-assets- bank- checking- saving- cash-expenses- food- supplies-income- gifts- salary-liabilities- debts---$ hledger accounts --drop 1-bank:checking-bank:saving-cash-food-supplies-gifts-salary-debts---$ hledger accounts-assets:bank:checking-assets:bank:saving-assets:cash-expenses:food-expenses:supplies-income:gifts-income:salary-liabilities:debts---File: hledger.1.info, Node: activity, Next: add, Prev: accounts, Up: COMMANDS--4.2 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.---$ hledger activity --quarterly-2008-01-01 **-2008-04-01 *******-2008-07-01-2008-10-01 **---File: hledger.1.info, Node: add, Next: balance, Prev: activity, Up: COMMANDS--4.3 add-=======--Prompt for transactions and add them to the journal.--`--no-new-accounts'- don't allow creating new accounts; helps prevent typos when- entering account names-- 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 recent- transaction (by description) 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/data/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> $---File: hledger.1.info, Node: balance, Next: balancesheet, Prev: add, Up: COMMANDS--4.4 balance-===========--Show accounts and their balances. Alias: bal.--`--change'- show balance change in each period (default)--`--cumulative'- show balance change accumulated across periods (in multicolumn- reports)--`-H --historical'- show historical ending balance in each period (includes postings- before report start date)--`--tree'- show accounts as a tree; amounts include subaccounts (default in- simple reports)--`--flat'- show accounts as a list; amounts exclude subaccounts except when- account is depth-clipped (default in multicolumn reports)--`-V --value'- convert amounts to their market value on the report end date- (using the most recent applicable market price, if any)--`-A --average'- show a row average column (in multicolumn mode)--`-T --row-total'- show a row total column (in multicolumn mode)--`-N --no-total'- don't show the final total row--`--drop=N'- omit N leading account name parts (in flat mode)--`--no-elide'- don't squash boring parent accounts (in tree mode)--`--format=LINEFORMAT'- in single-column balance reports: use this custom line format--`-O FMT --output-format=FMT'- select the output format. Supported formats: txt, csv.--`-o FILE --output-file=FILE'- write output to FILE. A file extension matching one of the above- formats selects that format.-- The balance command displays accounts and balances. It is hledger's-most featureful and most useful command.---$ 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-- More precisely, the balance command shows the _change_ to each-account's balance caused by all (matched) postings. In the common case-where you do not filter by date and your journal sets the correct-opening balances, this is the same as the account's ending balance.-- By default, accounts are displayed hierarchically, with subaccounts-indented below their parent. "Boring" accounts, which contain a single-interesting subaccount and no balance of their own, are elided into the-following line for more compact output. (Use `--no-elide' to prevent-this.)-- Each account's balance is the "inclusive" balance - it includes 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:---$ hledger balance -p 2008/6 expenses --no-total- $2 expenses- $1 food- $1 supplies--* Menu:--* Flat mode::-* Depth limited balance reports::-* Multicolumn balance reports::-* Market value::-* Custom balance output::-* Output destination::-* CSV output::---File: hledger.1.info, Node: Flat mode, Next: Depth limited balance reports, Up: balance--4.4.1 Flat mode------------------To see a flat list of full account names instead of the default-hierarchical display, use `--flat'. In this mode, accounts (unless-depth-clipped) show their "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.1.info, Node: Depth limited balance reports, Next: Multicolumn balance reports, Prev: Flat mode, Up: balance--4.4.2 Depth limited balance reports--------------------------------------With `--depth N', balance shows accounts only to the specified depth.-This is very useful to show a complex charts of accounts in less-detail. In flat mode, balances from accounts below the depth limit will-be shown as part of a parent account at the depth limit.---$ hledger balance -N --depth 1- $-1 assets- $2 expenses- $-2 income- $1 liabilities---File: hledger.1.info, Node: Multicolumn balance reports, Next: Market value, Prev: Depth limited balance reports, Up: balance--4.4.3 Multicolumn balance reports------------------------------------With a reporting interval, multiple balance columns will be shown, one-for each report period. There are three types of multi-column 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--- Multi-column 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---File: hledger.1.info, Node: Market value, Next: Custom balance output, Prev: Multicolumn balance reports, Up: balance--4.4.4 Market value---------------------The `-V/--value' flag converts the reported amounts to their market-value on the report end date, using the most recent applicable market-prices, when known. Specifically, when there is a market price (P-directive) for the amount's commodity, dated on or before the report end-date (see hledger -> Report start & end date), the amount will be-converted to the price's commodity. If multiple applicable prices are-defined, the latest-dated one is used (and if dates are equal, the one-last parsed).-- For example:---# 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 euros- €100 assets:euros-- What are they worth on nov 3 ? (no report end date specified,-defaults to the last date in the journal)---$ hledger -f t.j bal euros -V- $110.00 assets:euros-- What are they worth on dec 21 ?---$ hledger -f t.j bal euros -V -e 2016/12/21- $103.00 assets:euros-- Currently, hledger's -V only uses market prices recorded with P-directives, not transaction prices (unlike Ledger).-- Using -B and -V together is allowed.---File: hledger.1.info, Node: Custom balance output, Next: Output destination, Prev: Market value, Up: balance--4.4.5 Custom balance output------------------------------In simple (non-multi-column) balance reports, you can customise the-output 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.1.info, Node: Output destination, Next: CSV output, Prev: Custom balance output, Up: balance--4.4.6 Output destination---------------------------The balance, print, register and stats 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.1.info, Node: CSV output, Prev: Output destination, Up: balance--4.4.7 CSV output-------------------The balance, print and register commands can write their output as CSV.-This is useful for exporting data to other applications, eg to make-charts in a spreadsheet. This is controlled by the `-O/--output-format'-option, or by specifying a `.csv' 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.1.info, Node: balancesheet, Next: cashflow, Prev: balance, Up: COMMANDS--4.5 balancesheet-================--Show a balance sheet. Alias: bs.--`--flat'- show full account names, as a list (default)--`--drop=N'- in flat mode: omit N leading account name parts-- This command displays a simple balance sheet. It currently assumes-that you have top-level accounts named `asset' and `liability' (plural-forms also allowed.)---$ hledger balancesheet-Balance Sheet--Assets:- $-1 assets- $1 bank:saving- $-2 cash---------------------- $-1--Liabilities:- $1 liabilities:debts---------------------- $1--Total:---------------------- 0---File: hledger.1.info, Node: cashflow, Next: help, Prev: balancesheet, Up: COMMANDS--4.6 cashflow-============--Show a cashflow statement. Alias: cf.--`--flat'- show full account names, as a list (default)--`--drop=N'- in flat mode: omit N leading account name parts-- This command displays a simple cashflow statement It shows the-change in all "cash" (ie, liquid assets) accounts for the period. It-currently assumes that cash accounts are under a top-level account named-`asset' and do not contain `receivable' or `A/R' (plural forms also-allowed.)---$ hledger cashflow-Cashflow Statement--Cash flows:- $-1 assets- $1 bank:saving- $-2 cash---------------------- $-1--Total:---------------------- $-1---File: hledger.1.info, Node: help, Next: incomestatement, Prev: cashflow, Up: COMMANDS--4.7 help-========--Show any of the hledger manuals.-- The `help' command displays any of the main hledger man pages.-(Unlike `hledger --help', which displays only the hledger man page.)-Run it with no arguments to list available topics (their names are-shortened for easier typing), and run `hledger help TOPIC' to select-one. The output is similar to a man page, but fixed width. It may be-long, so you may wish to pipe it into a pager. See also info and man.---$ hledger help-Choose a topic, eg: hledger help cli-cli, ui, web, api, journal, csv, timeclock, timedot---$ hledger help cli | less--hledger(1) hledger User Manuals hledger(1)----NAME- hledger - a command-line accounting tool--SYNOPSIS- hledger [-f FILE] COMMAND [OPTIONS] [CMDARGS]- hledger [-f FILE] ADDONCMD -- [OPTIONS] [CMDARGS]-:---File: hledger.1.info, Node: incomestatement, Next: info, Prev: help, Up: COMMANDS--4.8 incomestatement-===================--Show an income statement. Alias: is.--`--flat'- show full account names, as a list (default)--`--drop=N'- in flat mode: omit N leading account name parts-- 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---File: hledger.1.info, Node: info, Next: man, Prev: incomestatement, Up: COMMANDS--4.9 info-========--Show any of the hledger manuals using info.-- The `info' command displays any of the hledger reference manuals-using the info hypertextual documentation viewer. This can be a very-efficient way to browse large manuals. It requires the "info" program to-be available in your PATH.-- As with help, run it with no arguments to list available topics-(manuals).---File: hledger.1.info, Node: man, Next: print, Prev: info, Up: COMMANDS--4.10 man-========--Show any of the hledger manuals using man.-- The `man' command displays any of the hledger reference manuals-using man, the standard documentation viewer on unix systems. This will-fit the text to your terminal width, and probably invoke a pager-automatically. It requires the "man" program to be available in your-PATH.-- As with help, run it with no arguments to list available topics-(manuals).---File: hledger.1.info, Node: print, Next: register, Prev: man, Up: COMMANDS--4.11 print-==========--Show transactions from the journal.--`-m STR --match=STR'- show the transaction whose description is most similar to STR, and- is most recent--`-O FMT --output-format=FMT'- select the output format. Supported formats: txt, csv.--`-o FILE --output-file=FILE'- write output to FILE. A file extension matching one of the above- formats selects that format.---$ 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-- The print command displays full transactions from the journal file,-tidily formatted and showing all amounts explicitly. The output of print-is always a valid hledger journal, but it does always not preserve all-original content exactly (eg directives).-- hledger's print command also shows all unit prices in effect, or-(with -B/-cost) shows cost amounts.-- The print command also supports output destination and CSV output.---File: hledger.1.info, Node: register, Next: stats, Prev: print, Up: COMMANDS--4.12 register-=============--Show postings and their running total. Alias: reg.--`--cumulative'- show running total from report start date (default)--`-H --historical'- show historical running total/balance (includes postings before- report start date)--`-A --average'- show running average of posting amounts instead of total (implies- -empty)--`-r --related'- show postings' siblings instead--`-w N --width=N'- set output width (default: terminal width or COLUMNS. -wN,M sets- description width as well)--`-O FMT --output-format=FMT'- select the output format. Supported formats: txt, csv.--`-o FILE --output-file=FILE'- write output to FILE. A file extension matching one of the above- formats selects that format.-- The register command displays postings, 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-- 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.-- 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.1.info, Node: Custom register output, Up: register--4.12.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:---<--------------------------------- 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, and set description width-- The register command also supports the `-o/--output-file' and-`-O/--output-format' options for controlling output destination and CSV-output.---File: hledger.1.info, Node: stats, Next: test, Prev: register, Up: COMMANDS--4.13 stats-==========--Show some journal statistics.--`-o FILE --output-file=FILE'- write output to FILE. A file extension matching one of the above- formats selects that format.---$ hledger stats-Main journal file : /src/hledger/data/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 ($)-- 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.-- The stats command also supports `-o/--output-file' for controlling-output destination.---File: hledger.1.info, Node: test, Prev: stats, Up: COMMANDS--4.14 test-=========--Run built-in unit tests.---$ hledger test-Cases: 74 Tried: 74 Errors: 0 Failures: 0-- This command runs hledger's built-in unit tests and displays a quick-report. With a regular expression argument, it selects only tests with-matching names. It's mainly used in development, but it's also nice to-be able to check your hledger executable for smoke at any time.---File: hledger.1.info, Node: ADD-ON COMMANDS, Next: TROUBLESHOOTING, Prev: COMMANDS, Up: Top--5 ADD-ON COMMANDS-*****************--Add-on commands are executables in your PATH whose name starts with-`hledger-' and ends with any of these file extensions: none,-`.hs',`.lhs',`.pl',`.py',`.rb',`.rkt',`.sh',`.bat',`.com',`.exe'.-Also, an add-on's name may not be the same as any built-in command or-alias.-- hledger will detect these and include them in the command list and-let you invoke them with `hledger ADDONCMD'. However there are some-limitations:-- * Options appearing before ADDONCMD will be visible only to hledger- and will not be passed to the add-on. Eg: `hledger -h web' shows- hledger's usage, `hledger web -h' shows hledger-web's usage.-- * Options understood only by the add-on must go after a `--' argument- to hide them from hledger, which would otherwise reject them. Eg:- `hledger web -- --server'.-- Sometimes it may be more convenient to just run the add-on directly,-eg: `hledger-web --server'.-- Add-ons which are written in haskell can take advantage of the-hledger-lib library for journal parsing, reporting, command-line-options, etc.-- Here are some hledger add-ons available from Hackage, the extra-directory in the hledger source, or elsewhere:--* Menu:--* api::-* autosync::-* diff::-* equity::-* interest::-* irr::-* print-unique::-* rewrite::-* ui::-* web::---File: hledger.1.info, Node: api, Next: autosync, Up: ADD-ON COMMANDS--5.1 api-=======--Web API server, see hledger-api.---File: hledger.1.info, Node: autosync, Next: diff, Prev: api, Up: ADD-ON COMMANDS--5.2 autosync-============--Download OFX bank data and/or convert OFX to hledger journal format.---$ hledger autosync --help-usage: hledger-autosync [-h] [-m MAX] [-r] [-a ACCOUNT] [-l LEDGER] [-i INDENT]- [--initial] [--fid FID] [--assertions] [-d] [--hledger]- [--slow] [--which]- [PATH]--Synchronize ledger.--positional arguments:- PATH do not sync; import from OFX file--optional arguments:- -h, --help show this help message and exit- -m MAX, --max MAX maximum number of days to process- -r, --resync do not stop until max days reached- -a ACCOUNT, --account ACCOUNT- set account name for import- -l LEDGER, --ledger LEDGER- specify ledger file to READ for syncing- -i INDENT, --indent INDENT- number of spaces to use for indentation- --initial create initial balance entries- --fid FID pass in fid value for OFX files that do not supply it- --assertions create balance assertion entries- -d, --debug enable debug logging- --hledger force use of hledger (on by default if invoked as hledger-- autosync)- --slow use slow, but possibly more robust, method of calling ledger- (no subprocess)- --which display which version of ledger/hledger/ledger-python will- be used by ledger-autosync to check for previous- transactions-$ head acct1.ofx-OFXHEADER:100-DATA:OFXSGML-VERSION:102-SECURITY:NONE-ENCODING:USASCII-CHARSET:1252-COMPRESSION:NONE-OLDFILEUID:NONE-NEWFILEUIDe:8509488b59d1bb45--$ hledger autosync acct1.ofx-2013/08/30 MONTHLY SERVICE FEE- ; ofxid: 3000.4303001832.201308301- WF:4303001832 -$6.00- [assets:business:bank:wf:bchecking:banking] $6.00-- ledger-autosync, which includes a `hledger-autosync' alias,-downloads transactions from your bank(s) via OFX, and prints just the-new ones as journal entries which you can add to your journal. It can-also operate on .OFX files which you've downloaded manually. It can be a-nice alternative to hledger's built-in CSV reader, especially if your-bank supports OFX download.---File: hledger.1.info, Node: diff, Next: equity, Prev: autosync, Up: ADD-ON COMMANDS--5.3 diff-========--Show transactions present in one journal file but not another---$ hledger diff --help-Usage: hledger-diff account:name left.journal right.journal-$ cat a.journal-1/1- (acct:one) 1--$ cat b.journal-1/1- (acct:one) 1-2/2- (acct:two) 2--$ hledger diff acct:two a.journal b.journal-Unmatched transactions in the first journal:--Unmatched transactions in the second journal:--2015/02/02- (acct:two) $2-- hledger-diff compares two journal files. Given an account name, it-prints out the transactions affecting that account which are in one-journal file but not in the other. This can be useful for reconciling-existing journals with bank statements.---File: hledger.1.info, Node: equity, Next: interest, Prev: diff, Up: ADD-ON COMMANDS--5.4 equity-==========--Print a journal entry that resets account balances to zero.---$ hledger balance --flat -E assets liabilities- 0 assets:bank:checking- $1 assets:bank:saving- $-2 assets:cash- $1 liabilities:debts---------------------- 0-$ hledger equity assets liabilities-2015/05/23- assets:bank:saving $-1- assets:cash $2- liabilities:debts $-1- equity:closing balances 0--2015/05/23- assets:bank:saving $1- assets:cash $-2- liabilities:debts $1- equity:opening balances 0-- This prints a journal entry which zeroes out the specified accounts-(or all accounts) with a transfer to/from "equity:closing balances"-(like Ledger's equity command). Also, it prints an similar entry with-opposite sign for restoring the balances from "equity:opening balances".-- These can be useful for ending one journal file and starting a new-one, respectively. By zeroing your asset and liability accounts at the-end of a file and restoring them at the start of the next one, you will-see correct asset/liability balances whether you run hledger on just one-file, or on several files concatenated with include.---File: hledger.1.info, Node: interest, Next: irr, Prev: equity, Up: ADD-ON COMMANDS--5.5 interest-============--Generate interest transactions.---$ hledger interest --help-Usage: hledger-interest [OPTION...] ACCOUNT- -h --help print this message and exit- -V --version show version number and exit- -v --verbose echo input ledger to stdout (default)- -q --quiet don't echo input ledger to stdout- --today compute interest up until today- -f FILE --file=FILE input ledger file (pass '-' for stdin)- -s ACCOUNT --source=ACCOUNT interest source account- -t ACCOUNT --target=ACCOUNT interest target account- --act use 'act' day counting convention- --30-360 use '30/360' day counting convention- --30E-360 use '30E/360' day counting convention- --30E-360isda use '30E/360isda' day counting convention- --constant=RATE constant interest rate- --annual=RATE annual interest rate- --bgb288 compute interest according to German BGB288- --ing-diba compute interest according for Ing-Diba Tagesgeld account---$ cat interest.journal-2008/09/26 Loan- Assets:Bank EUR 10000.00- Liabilities:Bank--2008/11/27 Payment- Assets:Bank EUR -3771.12- Liabilities:Bank--2009/05/03 Payment- Assets:Bank EUR -1200.00- Liabilities:Bank--2010/12/10 Payment- Assets:Bank EUR -3700.00- Liabilities:Bank---$ hledger interest -- -f interest.journal --source=Expenses:Interest \- --target=Liabilities:Bank --30-360 --annual=0.05 Liabilities:Bank-2008/09/26 Loan- Assets:Bank EUR 10000.00- Liabilities:Bank EUR -10000.00--2008/11/27 0.05% interest for EUR -10000.00 over 61 days- Liabilities:Bank EUR -84.72- Expenses:Interest EUR 84.72--2008/11/27 Payment- Assets:Bank EUR -3771.12- Liabilities:Bank EUR 3771.12--2008/12/31 0.05% interest for EUR -6313.60 over 34 days- Liabilities:Bank EUR -29.81- Expenses:Interest EUR 29.81--2009/05/03 0.05% interest for EUR -6343.42 over 123 days- Liabilities:Bank EUR -108.37- Expenses:Interest EUR 108.37--2009/05/03 Payment- Assets:Bank EUR -1200.00- Liabilities:Bank EUR 1200.00--2009/12/31 0.05% interest for EUR -5251.78 over 238 days- Liabilities:Bank EUR -173.60- Expenses:Interest EUR 173.60--2010/12/10 0.05% interest for EUR -5425.38 over 340 days- Liabilities:Bank EUR -256.20- Expenses:Interest EUR 256.20--2010/12/10 Payment- Assets:Bank EUR -3700.00- Liabilities:Bank EUR 3700.00-- hledger-interest computes interests for a given account. Using-command line flags, the program can be configured to use various-schemes for day-counting, such as act/act, 30/360, 30E/360, and-30/360isda. Furthermore, it supports a (small) number of interest-schemes, i.e. annual interest with a fixed rate and the scheme-mandated by the German BGB288 (Basiszins für Verbrauchergeschäfte).-See the package page for more.---File: hledger.1.info, Node: irr, Next: print-unique, Prev: interest, Up: ADD-ON COMMANDS--5.6 irr-=======--Calculate internal rate of return.---$ hledger irr --help-Usage: hledger-irr [OPTION...]- -h --help print this message and exit- -V --version show version number and exit- -c --cashflow also show all revant transactions- -f FILE --file=FILE input ledger file (pass '-' for stdin)- -i ACCOUNT --investment-account=ACCOUNT investment account- -t ACCOUNT --interest-account=ACCOUNT interest/gain/fees/losses account- -b DATE --begin=DATE calculate interest from this date- -e DATE --end=DATE calculate interest until this date- -D --daily calculate interest for each day- -W --weekly calculate interest for each week- -M --monthly calculate interest for each month- -Y --yearly calculate interest for each year---$ cat irr.journal-2011-01-01 Some wild speculation – I wonder if it pays off- Speculation €100.00- Cash--2011-02-01 More speculation (and adjustment of value)- Cash -€10.00- Rate Gain -€1.00- Speculation--2011-03-01 Lets pull out some money (and adjustment of value)- Cash €30.00- Rate Gain -€3.00- Speculation--2011-04-01 More speculation (and it lost some money!)- Cash -€50.00- Rate Gain € 5.00- Speculation--2011-05-01 Getting some money out (and adjustment of value)- Speculation -€44.00- Rate Gain -€ 3.00- Cash--2011-06-01 Emptying the account (after adjusting the value)- Speculation -€85.00- Cash €90.00- Rate Gain -€ 5.00---$ hledger-irr -f irr.journal -t "Rate Gain" -i Speculation --monthly-2011/01/01 - 2011/02/01: 12.49%-2011/02/01 - 2011/03/01: 41.55%-2011/03/01 - 2011/04/01: -51.44%-2011/04/01 - 2011/05/01: 32.24%-2011/05/01 - 2011/06/01: 95.92%-- hledger-irr computes the internal rate of return, also known as the-effective interest rate, of a given investment. After specifying what-account holds the investment, and what account stores the gains (or-losses, or fees, or cost), it calculates the hypothetical annual rate of-fixed rate investment that would have provided the exact same cash flow.-See the package page for more.---File: hledger.1.info, Node: print-unique, Next: rewrite, Prev: irr, Up: ADD-ON COMMANDS--5.7 print-unique-================--Print only only journal entries which have a unique description.---$ 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.1.info, Node: rewrite, Next: ui, Prev: print-unique, Up: ADD-ON COMMANDS--5.8 rewrite-===========--Prints all journal entries, adding specified custom postings to matched-entries.-- hledger-rewrite.hs, in hledger's extra directory (compilation-optional), adds postings to existing transactions, optionally with an-amount based on the existing transaction's first amount. See the script-for more details.---$ hledger rewrite -- [QUERY] --add-posting "ACCT AMTEXPR" ...-$ hledger rewrite -- ^income --add-posting '(liabilities:tax) *.33'-$ hledger rewrite -- expenses:gifts --add-posting '(budget:gifts) *-1"'---File: hledger.1.info, Node: ui, Next: web, Prev: rewrite, Up: ADD-ON COMMANDS--5.9 ui-======--Curses-style interface, see hledger-ui.---File: hledger.1.info, Node: web, Prev: ui, Up: ADD-ON COMMANDS--5.10 web-========--Web interface, see hledger-web.---File: hledger.1.info, Node: TROUBLESHOOTING, Prev: ADD-ON COMMANDS, Up: Top--6 TROUBLESHOOTING-*****************--* Menu:--* Run-time problems::-* Known limitations::---File: hledger.1.info, Node: Run-time problems, Next: Known limitations, Up: TROUBLESHOOTING--6.1 Run-time problems-=====================--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').---File: hledger.1.info, Node: Known limitations, Prev: Run-time problems, Up: TROUBLESHOOTING--6.2 Known limitations-=====================--*Command line interface*-- Add-on command options, unless they are also understood by the main-hledger executable, must be written after `--', like this: `hledger web--- --server'-- *Differences from Ledger*-- Not all of Ledger's journal file syntax is supported. See file format-differences.-- hledger is slower than Ledger, and uses more memory, on large data-files.-- *Windows limitations*-- In a windows CMD window, non-ascii characters and colours are not-supported.-- In a windows Cygwin/MSYS/Mintty window, the tab key is not supported-in hledger add.----Tag Table:-Node: Top82-Node: EXAMPLES1873-Ref: #examples1975-Node: OPTIONS3979-Ref: #options4083-Node: General options6711-Ref: #general-options6840-Node: Reporting options7611-Ref: #reporting-options7764-Node: Input files9587-Ref: #input-files9727-Node: Depth limiting11564-Ref: #depth-limiting11704-Node: Smart dates11905-Ref: #smart-dates12051-Node: Report start & end date13048-Ref: #report-start-end-date13220-Node: Report intervals14296-Ref: #report-intervals14461-Node: Period expressions14860-Ref: #period-expressions15025-Node: Regular expressions17360-Ref: #regular-expressions17502-Node: QUERIES18985-Ref: #queries19089-Node: COMMANDS22728-Ref: #commands22842-Node: accounts23515-Ref: #accounts23615-Node: activity24597-Ref: #activity24709-Node: add25068-Ref: #add25169-Node: balance27828-Ref: #balance27941-Node: Flat mode30954-Ref: #flat-mode31081-Node: Depth limited balance reports31500-Ref: #depth-limited-balance-reports31703-Node: Multicolumn balance reports32124-Ref: #multicolumn-balance-reports32326-Node: Market value36975-Ref: #market-value37139-Node: Custom balance output38440-Ref: #custom-balance-output38613-Node: Output destination40717-Ref: #output-destination40882-Node: CSV output41152-Ref: #csv-output41271-Node: balancesheet41668-Ref: #balancesheet41796-Node: cashflow42448-Ref: #cashflow42565-Node: help43255-Ref: #help43367-Node: incomestatement44204-Ref: #incomestatement44334-Node: info45061-Ref: #info45168-Node: man45530-Ref: #man45627-Node: print46030-Ref: #print46135-Node: register47481-Ref: #register47594-Node: Custom register output52086-Ref: #custom-register-output52217-Node: stats53514-Ref: #stats53620-Node: test54496-Ref: #test54583-Node: ADD-ON COMMANDS54950-Ref: #add-on-commands55086-Node: api56374-Ref: #api56466-Node: autosync56500-Ref: #autosync56615-Node: diff58930-Ref: #diff59040-Node: equity59704-Ref: #equity59818-Node: interest61146-Ref: #interest61263-Node: irr64347-Ref: #irr64460-Node: print-unique66835-Ref: #print-unique66965-Node: rewrite67223-Ref: #rewrite67342-Node: ui67871-Ref: #ui67971-Node: web68012-Ref: #web68100-Node: TROUBLESHOOTING68133-Ref: #troubleshooting68252-Node: Run-time problems68306-Ref: #run-time-problems68449-Node: Known limitations70393-Ref: #known-limitations70536+This is hledger.1.info, produced by makeinfo version 6.0 from stdin.+++File: hledger.1.info, Node: Top, Next: EXAMPLES, Up: (dir)++hledger(1) hledger 1.2+**********************++This is hledger's command-line interface (there are also curses 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.1.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.1.info, Node: OPTIONS, Next: QUERIES, Prev: EXAMPLES, Up: Top++2 OPTIONS+*********++* Menu:++* General options::+* Command options::+* Command arguments::+* Special characters::+* Input files::+* Smart dates::+* Report start & end date::+* Report intervals::+* Period expressions::+* Depth limiting::+* Pivoting::+* Regular expressions::+++File: hledger.1.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'. (Note -h and -help are+different, like git.)++ General help options:++'-h'++ show general usage (or after COMMAND, command usage)+'--help'++ show this program's manual as plain text (or after an add-on+ COMMAND, the add-on's manual)+'--man'++ show this program's manual with man+'--info'++ show this program's manual with info+'--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)+'--alias=OLD=NEW'++ rename accounts named OLD to NEW+'--anon'++ anonymize accounts and payees+'--pivot TAGNAME'++ use some other field/tag for account names+'-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+ (overrides the flags above)+'--date2'++ show, and match with -b/-e/-p/date:, secondary dates instead+'-C --cleared'++ include only cleared postings/txns+'--pending'++ include only pending postings/txns+'-U --uncleared'++ include only uncleared (and pending) postings/txns+'-R --real'++ include only non-virtual postings+'--depth=N'++ hide accounts/postings deeper than N+'-E --empty'++ show items with zero amount, normally hidden+'-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)++ Note when multiple similar reporting options are provided, the last+one takes precedence. Eg '-p feb -p mar' is equivalent to '-p mar'.++ Some of these can also be written as queries.+++File: hledger.1.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.1.info, Node: Command arguments, Next: Special characters, 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.1.info, Node: Special characters, Next: Input files, Prev: Command arguments, Up: OPTIONS++2.4 Special characters+======================++Option and argument values which contain problematic characters should+be escaped with double quotes, backslashes, or (best) single quotes.+Problematic characters means spaces, and also characters which are+significant to your command shell, such as less-than/greater-than. Eg:+'hledger register -p 'last year' "accounts receivable+(receivable|payable)" amt:\>100'.++ Characters which are significant both to the shell and in regular+expressions sometimes need to be double-escaped. 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:\\$'.++ There's more.. options and arguments get de-escaped when hledger is+passing them to an addon executable. In this case you might need+_triple_-escaping. Eg: 'hledger ui cur:'\\$'' or 'hledger ui+cur:\\\\$'.++ If in doubt, keep things simple:++ * run add-on executables directly+ * write options after the command+ * enclose problematic args in single quotes+ * if needed, also add a backslash to escape regexp metacharacters++ If you're really stumped, add '--debug=2' to troubleshoot.+++File: hledger.1.info, Node: Input files, Next: Smart dates, Prev: Special characters, Up: OPTIONS++2.5 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'+ some Ledger journals '.hledger' '.ledger'+'timeclock' timeclock files (precise time '.timeclock'+ 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 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.1.info, Node: Smart dates, Next: Report start & end date, Prev: Input files, Up: OPTIONS++2.6 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:++'2009/1/1', '2009/01/01', '2009-1-1', '2009.1.1' simple dates, several separators allowed+'2009/1', '2009' same as above - a missing day or month defaults to 1+'1/1', 'january', 'jan', 'this year' relative dates, meaning january 1 of the current year+'next year' january 1 of next year+'this month' the 1st of the current month+'this week' the most recent monday+'last week' the monday of the week before this one+'lastweek' spaces are optional+'today', 'yesterday', 'tomorrow'+++File: hledger.1.info, Node: Report start & end date, Next: Report intervals, Prev: Smart dates, Up: OPTIONS++2.7 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. One important thing to be aware of+when specifying end dates: as in Ledger, end dates are exclusive, so you+need to write the date _after_ the last day you want to include.++ 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.1.info, Node: Report intervals, Next: Period expressions, Prev: Report start & end date, Up: OPTIONS++2.8 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, currently.+++File: hledger.1.info, Node: Period expressions, Next: Depth limiting, Prev: Report intervals, Up: OPTIONS++2.9 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"'++ The following more complex report intervals are also supported:+'biweekly', 'bimonthly', 'every N days|weeks|months|quarters|years',+'every Nth day [of month]', 'every Nth day of week'.++ Examples:++'-p "bimonthly from 2008"'+'-p "every 2 weeks"'+'-p "every 5 days from 1/3"'++ 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.1.info, Node: Depth limiting, Next: Pivoting, Prev: Period expressions, Up: OPTIONS++2.10 Depth limiting+===================++With the '--depth N' option, 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.+++File: hledger.1.info, Node: Pivoting, Next: Regular expressions, Prev: Depth limiting, Up: OPTIONS++2.11 Pivoting+=============++Normally hledger sums amounts, and organizes them in a hierarchy, based+on account name. The '--pivot TAGNAME' option causes it to sum and+organize hierarchy based on some other field instead.++ TAGNAME is the full, case-insensitive name of a tag you have defined,+or one of the built-in implicit tags (like 'code' or 'payee'). As with+account names, when tag values have 'multiple:colon-separated:parts'+hledger will build hierarchy, displayed in tree-mode reports,+summarisable with a depth limit, and so on.++ '--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 tag 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.1.info, Node: Regular expressions, Prev: Pivoting, Up: OPTIONS++2.12 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.1.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, optional prefixes to match specific fields.+Multiple search terms are combined as follows:++ All commands except print: show transactions/postings/accounts which+match (or negatively match)++ * any of the description terms AND+ * any of the account terms AND+ * all the other terms.++ The print command: show 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:++*'REGEX'*++ match account names by this regular expression+*'acct:REGEX'*++ 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+*'real:, real:0'*++ match real or virtual postings respectively+*'status:*, status:!, status:'*++ match cleared, pending, or uncleared/pending 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.+*'not:'*++ before any of the above negates the match.+*'inacct:ACCTNAME'*++ a special term used automatically when you click an account name in+ hledger-web, specifying the account register we are currently in+ (selects the transactions of that account and how to show them, can+ be filtered further with 'acct' etc). Not supported elsewhere in+ hledger.++ 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.1.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 any unambiguous prefix of a+command name ('hledger inc'), or one of the standard short aliases+displayed in the command list ('hledger is').+* Menu:++* accounts::+* activity::+* add::+* balance::+* balancesheet::+* cashflow::+* help::+* incomestatement::+* info::+* man::+* print::+* register::+* stats::+* test::+++File: hledger.1.info, Node: accounts, Next: activity, Up: COMMANDS++4.1 accounts+============++Show account names.++'--tree'++ show short account names, as a tree+'--flat'++ show full account names, as a list (default)+'--drop=N'++ in flat mode: omit N leading account name parts++ This command lists all account names that are in use (ie, all the+accounts which have at least one transaction posting to them). With+query arguments, only matched account names 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.++ Examples:++$ hledger accounts --tree+assets+ bank+ checking+ saving+ cash+expenses+ food+ supplies+income+ gifts+ salary+liabilities+ debts++$ hledger accounts --drop 1+bank:checking+bank:saving+cash+food+supplies+gifts+salary+debts++$ hledger accounts+assets:bank:checking+assets:bank:saving+assets:cash+expenses:food+expenses:supplies+income:gifts+income:salary+liabilities:debts+++File: hledger.1.info, Node: activity, Next: add, Prev: accounts, Up: COMMANDS++4.2 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.++$ hledger activity --quarterly+2008-01-01 **+2008-04-01 *******+2008-07-01+2008-10-01 **+++File: hledger.1.info, Node: add, Next: balance, Prev: activity, Up: COMMANDS++4.3 add+=======++Prompt for transactions and add them to the journal.++'--no-new-accounts'++ don't allow creating new accounts; helps prevent typos when+ entering account names++ 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 recent+ transaction (by description) 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> $+++File: hledger.1.info, Node: balance, Next: balancesheet, Prev: add, Up: COMMANDS++4.4 balance+===========++Show accounts and their balances. Alias: bal.++'--change'++ show balance change in each period (default)+'--cumulative'++ show balance change accumulated across periods (in multicolumn+ reports)+'-H --historical'++ show historical ending balance in each period (includes postings+ before report start date)+'--tree'++ show accounts as a tree; amounts include subaccounts (default in+ simple reports)+'--flat'++ show accounts as a list; amounts exclude subaccounts except when+ account is depth-clipped (default in multicolumn reports)+'-A --average'++ show a row average column (in multicolumn mode)+'-T --row-total'++ show a row total column (in multicolumn mode)+'-N --no-total'++ don't show the final total row+'--drop=N'++ omit N leading account name parts (in flat mode)+'--no-elide'++ don't squash boring parent accounts (in tree mode)+'--format=LINEFORMAT'++ in single-column balance reports: use this custom line format+'-O FMT --output-format=FMT'++ select the output format. Supported formats: txt, csv.+'-o FILE --output-file=FILE'++ write output to FILE. A file extension matching one of the above+ formats selects that format.+'--pretty-tables'++ Use unicode to display prettier tables.++ The balance command displays accounts and balances. It is hledger's+most featureful and most useful command.++$ 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++ More precisely, the balance command shows the _change_ to each+account's balance caused by all (matched) postings. In the common case+where you do not filter by date and your journal sets the correct+opening balances, this is the same as the account's ending balance.++ By default, accounts are displayed hierarchically, with subaccounts+indented below their parent. "Boring" accounts, which contain a single+interesting subaccount and no balance of their own, are elided into the+following line for more compact output. (Use '--no-elide' to prevent+this.)++ Each account's balance is the "inclusive" balance - it includes 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:++$ hledger balance -p 2008/6 expenses --no-total+ $2 expenses+ $1 food+ $1 supplies++* Menu:++* Flat mode::+* Depth limited balance reports::+* Multicolumn balance reports::+* Market value::+* Custom balance output::+* Output destination::+* CSV output::+++File: hledger.1.info, Node: Flat mode, Next: Depth limited balance reports, Up: balance++4.4.1 Flat mode+---------------++To see a flat list of full account names instead of the default+hierarchical display, use '--flat'. In this mode, accounts (unless+depth-clipped) show their "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.1.info, Node: Depth limited balance reports, Next: Multicolumn balance reports, Prev: Flat mode, Up: balance++4.4.2 Depth limited balance reports+-----------------------------------++With '--depth N', balance shows accounts only to the specified depth.+This is very useful to show a complex charts of accounts in less detail.+In flat mode, balances from accounts below the depth limit will be shown+as part of a parent account at the depth limit.++$ hledger balance -N --depth 1+ $-1 assets+ $2 expenses+ $-2 income+ $1 liabilities+++File: hledger.1.info, Node: Multicolumn balance reports, Next: Market value, Prev: Depth limited balance reports, Up: balance++4.4.3 Multicolumn balance reports+---------------------------------++With a reporting interval, multiple balance columns will be shown, one+for each report period. There are three types of multi-column 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++ Multi-column 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+++File: hledger.1.info, Node: Market value, Next: Custom balance output, Prev: Multicolumn balance reports, Up: balance++4.4.4 Market value+------------------++The '-V/--value' flag converts the reported amounts to their market+value on the report end date, using the most recent applicable market+prices, when known. Specifically, when there is a market price (P+directive) for the amount's commodity, dated on or before the report end+date (see hledger -> Report start & end date), the amount will be+converted to the price's commodity. If multiple applicable prices are+defined, the latest-dated one is used (and if dates are equal, the one+last parsed).++ For example:++# 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 euros+ €100 assets:euros++ What are they worth on nov 3 ? (no report end date specified,+defaults to the last date in the journal)++$ hledger -f t.j bal euros -V+ $110.00 assets:euros++ What are they worth on dec 21 ?++$ hledger -f t.j bal euros -V -e 2016/12/21+ $103.00 assets:euros++ Currently, hledger's -V only uses market prices recorded with P+directives, not transaction prices (unlike Ledger).++ Using -B and -V together is allowed.+++File: hledger.1.info, Node: Custom balance output, Next: Output destination, Prev: Market value, Up: balance++4.4.5 Custom balance output+---------------------------++In simple (non-multi-column) balance reports, you can customise the+output 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.1.info, Node: Output destination, Next: CSV output, Prev: Custom balance output, Up: balance++4.4.6 Output destination+------------------------++The balance, print, register and stats 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.1.info, Node: CSV output, Prev: Output destination, Up: balance++4.4.7 CSV output+----------------++The balance, print and register commands can write their output as CSV.+This is useful for exporting data to other applications, eg to make+charts in a spreadsheet. This is controlled by the '-O/--output-format'+option, or by specifying a '.csv' 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.1.info, Node: balancesheet, Next: cashflow, Prev: balance, Up: COMMANDS++4.5 balancesheet+================++Show a balance sheet. Alias: bs.++'--change'++ show balance change in each period, instead of historical ending+ balances+'--cumulative'++ show balance change accumulated across periods (in multicolumn+ reports), instead of historical ending balances+'-H --historical'++ show historical ending balance in each period (includes postings+ before report start date) (default)+'--tree'++ show accounts as a tree; amounts include subaccounts (default in+ simple reports)+'--flat'++ show accounts as a list; amounts exclude subaccounts except when+ account is depth-clipped (default in multicolumn reports)+'-A --average'++ show a row average column (in multicolumn mode)+'-T --row-total'++ show a row total column (in multicolumn mode)+'-N --no-total'++ don't show the final total row+'--drop=N'++ omit N leading account name parts (in flat mode)+'--no-elide'++ don't squash boring parent accounts (in tree mode)+'--format=LINEFORMAT'++ in single-column balance reports: use this custom line format++ This command displays a simple balance sheet. It currently assumes+that you have top-level accounts named 'asset' and 'liability' (plural+forms also allowed.)++$ 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.+++File: hledger.1.info, Node: cashflow, Next: help, Prev: balancesheet, Up: COMMANDS++4.6 cashflow+============++Show a cashflow statement. Alias: cf.++'--change'++ show balance change in each period (default)+'--cumulative'++ show balance change accumulated across periods (in multicolumn+ reports), instead of changes during periods+'-H --historical'++ show historical ending balance in each period (includes postings+ before report start date), instead of changes during each period+'--tree'++ show accounts as a tree; amounts include subaccounts (default in+ simple reports)+'--flat'++ show accounts as a list; amounts exclude subaccounts except when+ account is depth-clipped (default in multicolumn reports)+'-A --average'++ show a row average column (in multicolumn mode)+'-T --row-total'++ show a row total column (in multicolumn mode)+'-N --no-total'++ don't show the final total row (in simple reports)+'--drop=N'++ omit N leading account name parts (in flat mode)+'--no-elide'++ don't squash boring parent accounts (in tree mode)+'--format=LINEFORMAT'++ in single-column balance reports: use this custom line format++ This command displays a simple cashflow statement It shows the change+in all "cash" (ie, liquid assets) accounts for the period. It currently+assumes that cash accounts are under a top-level account named 'asset'+and do not contain 'receivable' or 'A/R' (plural forms also allowed.)++$ 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'.+++File: hledger.1.info, Node: help, Next: incomestatement, Prev: cashflow, Up: COMMANDS++4.7 help+========++Show any of the hledger manuals.++ The 'help' command displays any of the main hledger man pages.+(Unlike 'hledger --help', which displays only the hledger man page.)+Run it with no arguments to list available topics (their names are+shortened for easier typing), and run 'hledger help TOPIC' to select+one. The output is similar to a man page, but fixed width. It may be+long, so you may wish to pipe it into a pager. See also info and man.++$ hledger help+Choose a topic, eg: hledger help cli+cli, ui, web, api, journal, csv, timeclock, timedot++$ hledger help cli | less++hledger(1) hledger User Manuals hledger(1)++++NAME+ hledger - a command-line accounting tool++SYNOPSIS+ hledger [-f FILE] COMMAND [OPTIONS] [CMDARGS]+ hledger [-f FILE] ADDONCMD -- [OPTIONS] [CMDARGS]+:+++File: hledger.1.info, Node: incomestatement, Next: info, Prev: help, Up: COMMANDS++4.8 incomestatement+===================++Show an income statement. Alias: is.++'--change'++ show balance change in each period (default)+'--cumulative'++ show balance change accumulated across periods (in multicolumn+ reports), instead of changes during periods+'-H --historical'++ show historical ending balance in each period (includes postings+ before report start date), instead of changes during each period+'--tree'++ show accounts as a tree; amounts include subaccounts (default in+ simple reports)+'--flat'++ show accounts as a list; amounts exclude subaccounts except when+ account is depth-clipped (default in multicolumn reports)+'-A --average'++ show a row average column (in multicolumn mode)+'-T --row-total'++ show a row total column (in multicolumn mode)+'-N --no-total'++ don't show the final total row+'--drop=N'++ omit N leading account name parts (in flat mode)+'--no-elide'++ don't squash boring parent accounts (in tree mode)+'--format=LINEFORMAT'++ in single-column balance reports: use this custom line format++ 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'.+++File: hledger.1.info, Node: info, Next: man, Prev: incomestatement, Up: COMMANDS++4.9 info+========++Show any of the hledger manuals using info.++ The 'info' command displays any of the hledger reference manuals+using the info hypertextual documentation viewer. This can be a very+efficient way to browse large manuals. It requires the "info" program+to be available in your PATH.++ As with help, run it with no arguments to list available topics+(manuals).+++File: hledger.1.info, Node: man, Next: print, Prev: info, Up: COMMANDS++4.10 man+========++Show any of the hledger manuals using man.++ The 'man' command displays any of the hledger reference manuals using+man, the standard documentation viewer on unix systems. This will fit+the text to your terminal width, and probably invoke a pager+automatically. It requires the "man" program to be available in your+PATH.++ As with help, run it with no arguments to list available topics+(manuals).+++File: hledger.1.info, Node: print, Next: register, Prev: man, Up: COMMANDS++4.11 print+==========++Show transactions from the journal.++'-x --explicit'++ show all amounts explicitly+'-m STR --match=STR'++ show the transaction whose description is most similar to STR, and+ is most recent+'-O FMT --output-format=FMT'++ select the output format. Supported formats: txt, csv.+'-o FILE --output-file=FILE'++ write output to FILE. A file extension matching one of the above+ formats selects that format.++$ 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++ The print command displays full journal entries (transactions) from+the journal file, tidily formatted.++ As of hledger 1.2, print's output is always a valid hledger journal.+However it may not preserve all original content, eg it does not print+directives or inter-transaction comments.++ Normally, transactions' implicit/explicit amount style is preserved:+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, in+this mode postings with a multi-commodity amount (possible with an+implicit amount in a multi-commodity transaction) will be split into+multiple single-commodity postings, for valid journal output.++ With -B/-cost, amounts with transaction prices are converted to cost+(using the transaction price).++ The print command also supports output destination and CSV output.+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.1.info, Node: register, Next: stats, Prev: print, Up: COMMANDS++4.12 register+=============++Show postings and their running total. Alias: reg.++'--cumulative'++ show running total from report start date (default)+'-H --historical'++ show historical running total/balance (includes postings before+ report start date)+'-A --average'++ show running average of posting amounts instead of total (implies+ -empty)+'-r --related'++ show postings' siblings instead+'-w N --width=N'++ set output width (default: terminal width or COLUMNS. -wN,M sets+ description width as well)+'-O FMT --output-format=FMT'++ select the output format. Supported formats: txt, csv.+'-o FILE --output-file=FILE'++ write output to FILE. A file extension matching one of the above+ formats selects that format.++ The register command displays postings, 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++ 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.++ 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.1.info, Node: Custom register output, Up: register++4.12.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:++<--------------------------------- 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, and set description width++ The register command also supports the '-o/--output-file' and+'-O/--output-format' options for controlling output destination and CSV+output.+++File: hledger.1.info, Node: stats, Next: test, Prev: register, Up: COMMANDS++4.13 stats+==========++Show some journal statistics.++'-o FILE --output-file=FILE'++ write output to FILE. A file extension matching one of the above+ formats selects that format.++$ 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 ($)++ 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.++ The stats command also supports '-o/--output-file' for controlling+output destination.+++File: hledger.1.info, Node: test, Prev: stats, Up: COMMANDS++4.14 test+=========++Run built-in unit tests.++$ hledger test+Cases: 74 Tried: 74 Errors: 0 Failures: 0++ This command runs hledger's built-in unit tests and displays a quick+report. With a regular expression argument, it selects only tests with+matching names. It's mainly used in development, but it's also nice to+be able to check your hledger executable for smoke at any time.+++File: hledger.1.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.1.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:++* api::+* ui::+* web::+++File: hledger.1.info, Node: api, Next: ui, Up: Official add-ons++5.1.1 api+---------++hledger-api serves hledger data as a JSON web API.+++File: hledger.1.info, Node: ui, Next: web, Prev: api, Up: Official add-ons++5.1.2 ui+--------++hledger-ui provides an efficient curses-style interface.+++File: hledger.1.info, Node: web, Prev: ui, Up: Official add-ons++5.1.3 web+---------++hledger-web provides a simple web interface.+++File: hledger.1.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::+++File: hledger.1.info, Node: diff, Next: iadd, Up: Third party add-ons++5.2.1 diff+----------++hledger-diff shows differences in an account's transactions between one+journal file and another.+++File: hledger.1.info, Node: iadd, Next: interest, Prev: diff, Up: Third party add-ons++5.2.2 iadd+----------++hledger-iadd is a curses-style, more interactive replacement for the add+command.+++File: hledger.1.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.1.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.+++File: hledger.1.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;+installing them is pretty easy. 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::+* budget::+* chart::+* check::+* check-dates::+* check-dupes::+* equity::+* prices::+* print-unique::+* register-match::+* rewrite::+++File: hledger.1.info, Node: autosync, Next: budget, 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.1.info, Node: budget, Next: chart, Prev: autosync, Up: Experimental add-ons++5.3.2 budget+------------++hledger-budget.hs adds more budget-tracking features to hledger.+++File: hledger.1.info, Node: chart, Next: check, Prev: budget, Up: Experimental add-ons++5.3.3 chart+-----------++hledger-chart.hs is an old pie chart generator, in need of some love.+++File: hledger.1.info, Node: check, Next: check-dates, Prev: chart, Up: Experimental add-ons++5.3.4 check+-----------++hledger-check.hs checks more powerful account balance assertions.+++File: hledger.1.info, Node: check-dates, Next: check-dupes, Prev: check, Up: Experimental add-ons++5.3.5 check-dates+-----------------++hledger-check-dates.hs checks that journal entries are ordered by date.+++File: hledger.1.info, Node: check-dupes, Next: equity, Prev: check-dates, Up: Experimental add-ons++5.3.6 check-dupes+-----------------++hledger-check-dupes.hs checks for account names sharing the same leaf+name.+++File: hledger.1.info, Node: equity, Next: prices, Prev: check-dupes, Up: Experimental add-ons++5.3.7 equity+------------++hledger-equity.hs prints balance-resetting transactions, useful for+bringing account balances across file boundaries.+++File: hledger.1.info, Node: prices, Next: print-unique, Prev: equity, Up: Experimental add-ons++5.3.8 prices+------------++hledger-prices.hs prints all prices from the journal.+++File: hledger.1.info, Node: print-unique, Next: register-match, Prev: prices, Up: Experimental add-ons++5.3.9 print-unique+------------------++hledger-print-unique.hs prints transactions which do not reuse an+already-seen description.+++File: hledger.1.info, Node: register-match, Next: rewrite, Prev: print-unique, Up: Experimental add-ons++5.3.10 register-match+---------------------++hledger-register-match.hs helps ledger-autosync detect already-seen+transactions when importing.+++File: hledger.1.info, Node: rewrite, Prev: register-match, Up: Experimental add-ons++5.3.11 rewrite+--------------++hledger-rewrite.hs Adds one or more custom postings to matched+transactions.+++Tag Table:+Node: Top70+Node: EXAMPLES1886+Ref: #examples1988+Node: OPTIONS3634+Ref: #options3738+Node: General options3993+Ref: #general-options4120+Node: Command options6643+Ref: #command-options6796+Node: Command arguments7194+Ref: #command-arguments7354+Node: Special characters7475+Ref: #special-characters7633+Node: Input files8801+Ref: #input-files8939+Node: Smart dates10902+Ref: #smart-dates11045+Node: Report start & end date12024+Ref: #report-start-end-date12196+Node: Report intervals13262+Ref: #report-intervals13427+Node: Period expressions13828+Ref: #period-expressions13988+Node: Depth limiting16328+Ref: #depth-limiting16474+Node: Pivoting16675+Ref: #pivoting16810+Node: Regular expressions18581+Ref: #regular-expressions18715+Node: QUERIES20076+Ref: #queries20180+Node: COMMANDS23826+Ref: #commands23940+Node: accounts24613+Ref: #accounts24713+Node: activity25695+Ref: #activity25807+Node: add26166+Ref: #add26267+Node: balance28925+Ref: #balance29038+Node: Flat mode31980+Ref: #flat-mode32107+Node: Depth limited balance reports32527+Ref: #depth-limited-balance-reports32730+Node: Multicolumn balance reports33150+Ref: #multicolumn-balance-reports33352+Node: Market value38000+Ref: #market-value38164+Node: Custom balance output39464+Ref: #custom-balance-output39637+Node: Output destination41730+Ref: #output-destination41895+Node: CSV output42165+Ref: #csv-output42284+Node: balancesheet42681+Ref: #balancesheet42809+Node: cashflow44716+Ref: #cashflow44833+Node: help46701+Ref: #help46813+Node: incomestatement47651+Ref: #incomestatement47781+Node: info49673+Ref: #info49780+Node: man50144+Ref: #man50241+Node: print50646+Ref: #print50751+Node: register54507+Ref: #register54620+Node: Custom register output59116+Ref: #custom-register-output59247+Node: stats60544+Ref: #stats60650+Node: test61531+Ref: #test61618+Node: ADD-ON COMMANDS61986+Ref: #add-on-commands62098+Node: Official add-ons63385+Ref: #official-add-ons63527+Node: api63614+Ref: #api63705+Node: ui63757+Ref: #ui63858+Node: web63916+Ref: #web64007+Node: Third party add-ons64053+Ref: #third-party-add-ons64230+Node: diff64365+Ref: #diff64464+Node: iadd64563+Ref: #iadd64679+Node: interest64762+Ref: #interest64885+Node: irr64980+Ref: #irr65080+Node: Experimental add-ons65158+Ref: #experimental-add-ons65312+Node: autosync65705+Ref: #autosync65819+Node: budget66058+Ref: #budget66182+Node: chart66248+Ref: #chart66367+Node: check66438+Ref: #check66562+Node: check-dates66629+Ref: #check-dates66771+Node: check-dupes66844+Ref: #check-dupes66987+Node: equity67064+Ref: #equity67192+Node: prices67311+Ref: #prices67440+Node: print-unique67495+Ref: #print-unique67644+Node: register-match67737+Ref: #register-match67893+Node: rewrite67991+Ref: #rewrite68112 End Tag Table
doc/hledger.1.txt view
@@ -7,1907 +7,1862 @@ hledger - a command-line accounting tool SYNOPSIS- hledger [-f FILE] COMMAND [OPTIONS] [CMDARGS]- hledger [-f FILE] ADDONCMD -- [OPTIONS] [CMDARGS]--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 curses and web- interfaces). Its basic function is to read a plain text file describ-- ing 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, trans-- lating 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. See COMMANDS- and EXAMPLES below.--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-- With the journal-- 2016/02/16 Member Fee Payment John Doe- assets:bank account 2 EUR- income:member fees -2 EUR- ; member: John Doe-- the --pivot comand will output the following:-- $ hledger bal --pivot member- 2 EUR assets:bank account- -2 EUR member:John Doe--OPTIONS- To see general usage and the command list: hledger -h or just hledger.- To see usage for a specific command: hledger COMMAND -h.-- hledger has several kinds of options:-- o General options are always available and can appear anywhere on the- command line. hledger -h shows these. Eg: hledger --version.-- o Common reporting options are available with most commands. These and- all other non-general options must be written after COMMAND.- hledger COMMAND -h shows these. Eg: hledger register --cleared.-- o Command-specific options are also provided by some commands.- hledger COMMAND -h shows these too. Eg: hledger register --average.-- o Some hledger commands come from separate add-on executables, which- have their own options. hledger COMMAND -h shows these, as usual.- Such options, if not also supported by hledger, should be written- following a double hyphen argument (--) so that hledger's option- parser does not complain. Eg: hledger ui -- --register=checking.- Or, you can just run the add-on directly: hledger-ui --regis-- ter=checking.-- Command arguments may also follow the command name. In most cases- these specify a query which filters the data. Command options and- arguments can be intermixed.-- Option and argument values containing problematic characters should be- escaped with double quotes, backslashes, or (best) single quotes. This- means spaces, but also characters which are significant to your command- shell, such as less-than/greater-than. Eg: hledger regis-- ter -p 'last year' "accounts receivable (receiv-- able|payable)" amt:\>100.-- Characters which are significant to the shell and also in regular- expressions, like parentheses, the pipe symbol and the dollar sign,- must sometimes be double-escaped. Eg, to match the dollar symbol:- hledger balance cur:'\$' or hledger balance cur:\\$.-- There's more.. options and arguments being passed by hledger to an- add-on executable get de-escaped once in the process. In this case you- might need triple-escaping. Eg: hledger ui cur:'\\$' or- hledger ui cur:\\\\$.-- If in doubt, keep things simple:-- o write options after the command-- o enclose problematic args in single quotes-- o if needed, also add a backslash to escape regexp metacharacters-- o run add-on executables directly-- If you're really curious, add --debug=2 for troubleshooting.-- General options- Always available, can be written before or after COMMAND.-- -h show general usage (or after COMMAND, the command's usage)-- --help show the current program's manual as plain text (or after an- add-on COMMAND, the add-on's manual)-- --man show the current program's manual with man-- --info show the current program's manual with info-- --version- show version-- --debug[=N]- show debug output (levels 1-9, default: 1)-- -f FILE --file=FILE- use a different input file. For stdin, use --- --rules-file=RULESFILE- Conversion rules file to use when reading CSV (default:- FILE.rules)-- --alias=OLD=NEW- display accounts named OLD as NEW-- -I --ignore-assertions- ignore any failing balance assertions in the journal-- Reporting options- Common reporting options, must be written after COMMAND.-- -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- (overrides the flags above)-- --date2- show, and match with -b/-e/-p/date:, secondary dates instead-- -C --cleared- include only cleared postings/txns-- --pending- include only pending postings/txns-- -U --uncleared- include only uncleared (and pending) postings/txns-- -R --real- include only non-virtual postings-- --depth=N- hide accounts/postings deeper than N-- -E --empty- show items with zero amount, normally hidden-- -B --cost- convert amounts to their cost at transaction time (using the- transaction price, if any)-- --pivot TAG- will transform the journal before any other processing by- replacing the account name of every posting having the tag TAG- with content VALUE by the account name "TAG:VALUE". The TAG- will only match if it is a full-length match. The pivot will- only happen if the TAG is on a posting, not if it is on the- transaction. If the tag value is a multi:level:account:name the- new account name will be "TAG:multi:level:account:name".-- --anon show anonymized accounts and payees-- If a reporting option occurs more than once on the command line, the- last one takes precedence. Eg -p jan -p feb is equivalent to -p feb.-- 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 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. (Directives in one file will not affect the other files.- If you need that, use the include directive instead.)-- Depth limiting- With the --depth N option, 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.-- 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:--- 2009/1/1, 2009/01/01, simple dates, several sep-- 2009-1-1, 2009.1.1 arators allowed- 2009/1, 2009 same as above - a missing- day or month defaults to 1- 1/1, january, jan, relative dates, meaning- this year january 1 of the current- year- next year january 1 of next year- this month the 1st of the current- month- this week the most recent monday- last week the monday of the week- before this one- lastweek spaces are optional- today, yesterday, tomorrow-- 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. One important thing to be aware of when- specifying end dates: as in Ledger, end dates are exclusive, so you- need to write the date after the last day you want to include.-- 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- after the 1st of the cur-- rent 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- intervals can not be specified with a query, currently.-- 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- 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"-- The following more complex report intervals are also supported:- biweekly, bimonthly, every N days|weeks|months|quarters|years,- every Nth day [of month], every Nth day of week.-- Examples:--- -p "bimonthly from 2008"- -p "every 2 weeks"- -p "every 5 days from 1/3"-- 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"-- 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- replacement 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 To match a regular expression metacharacter like $ as a literal char-- acter, 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 a second time, with single or- double quotes or another backslash. Eg, to match amounts with the- dollar sign from the command line, write cur:'\$' or cur:\\$.--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, optional prefixes to match specific fields. Multiple- search terms are combined as follows:-- All commands except print: show transactions/postings/accounts which- match (or negatively match)-- o any of the description terms AND-- o any of the account terms AND-- o all the other terms.-- The print command: show 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:-- REGEX match account names by this regular expression-- acct:REGEX- 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-- real:, real:0- match real or virtual postings respectively-- status:*, status:!, status:- match cleared, pending, or uncleared/pending 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.-- not: before any of the above negates the match.-- inacct:ACCTNAME- a special term used automatically when you click an account name- in hledger-web, specifying the account register we are currently- in (selects the transactions of that account and how to show- them, can be filtered further with acct etc). Not supported- elsewhere in hledger.-- 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 incomestatement). You can also write any unambiguous prefix of- a command name (hledger inc), or one of the standard short aliases dis-- played in the command list (hledger is).-- accounts- Show account names.-- --tree show short account names, as a tree-- --flat show full account names, as a list (default)-- --drop=N- in flat mode: omit N leading account name parts-- This command lists all account names that are in use (ie, all the- accounts which have at least one transaction posting to them). With- query arguments, only matched account names 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.-- Examples:-- $ hledger accounts --tree- assets- bank- checking- saving- cash- expenses- food- supplies- income- gifts- salary- liabilities- debts-- $ hledger accounts --drop 1- bank:checking- bank:saving- cash- food- supplies- gifts- salary- debts-- $ hledger accounts- assets:bank:checking- assets:bank:saving- assets:cash- expenses:food- expenses:supplies- income:gifts- income:salary- liabilities:debts-- 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.-- $ hledger activity --quarterly- 2008-01-01 **- 2008-04-01 *******- 2008-07-01- 2008-10-01 **-- add- Prompt for transactions and add them to the journal.-- --no-new-accounts- don't allow creating new accounts; helps prevent typos when- entering account names-- 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 recent- transaction (by description) 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/data/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> $-- balance- Show accounts and their balances. Alias: bal.-- --change- show balance change in each period (default)-- --cumulative- show balance change accumulated across periods (in multicolumn- reports)-- -H --historical- show historical ending balance in each period (includes postings- before report start date)-- --tree show accounts as a tree; amounts include subaccounts (default in- simple reports)-- --flat show accounts as a list; amounts exclude subaccounts except when- account is depth-clipped (default in multicolumn reports)-- -V --value- convert amounts to their market value on the report end date- (using the most recent applicable market price, if any)-- -A --average- show a row average column (in multicolumn mode)-- -T --row-total- show a row total column (in multicolumn mode)-- -N --no-total- don't show the final total row-- --drop=N- omit N leading account name parts (in flat mode)-- --no-elide- don't squash boring parent accounts (in tree mode)-- --format=LINEFORMAT- in single-column balance reports: use this custom line format-- -O FMT --output-format=FMT- select the output format. Supported formats: txt, csv.-- -o FILE --output-file=FILE- write output to FILE. A file extension matching one of the- above formats selects that format.-- The balance command displays accounts and balances. It is hledger's- most featureful and most useful command.-- $ 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-- More precisely, the balance command shows the change to each account's- balance caused by all (matched) postings. In the common case where you- do not filter by date and your journal sets the correct opening bal-- ances, this is the same as the account's ending balance.-- By default, accounts are displayed hierarchically, with subaccounts- indented below their parent. "Boring" accounts, which contain a single- interesting subaccount and no balance of their own, are elided into the- following line for more compact output. (Use --no-elide to prevent- this.)-- Each account's balance is the "inclusive" balance - it includes 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:-- $ hledger balance -p 2008/6 expenses --no-total- $2 expenses- $1 food- $1 supplies-- Flat mode- To see a flat list of full account names instead of the default hierar-- chical display, use --flat. In this mode, accounts (unless- depth-clipped) show their "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, balance shows accounts only to the specified depth.- This is very useful to show a complex charts of accounts in less- detail. In flat mode, balances from accounts below the depth limit- will be shown as part of a parent account at the depth limit.-- $ hledger balance -N --depth 1- $-1 assets- $2 expenses- $-2 income- $1 liabilities-- Multicolumn balance reports- With a reporting interval, multiple balance columns will be shown, one- for each report period. There are three types of multi-column 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-- Multi-column 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- 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 oth-- erwise 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-- Market value- The -V/--value flag converts the reported amounts to their market value- on the report end date, using the most recent applicable market prices,- when known. Specifically, when there is a market price (P directive)- for the amount's commodity, dated on or before the report end date (see- hledger -> Report start & end date), the amount will be converted to- the price's commodity. If multiple applicable prices are defined, the- latest-dated one is used (and if dates are equal, the one last parsed).-- For example:-- # 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 euros- 100 assets:euros-- What are they worth on nov 3 ? (no report end date specified, defaults- to the last date in the journal)-- $ hledger -f t.j bal euros -V- $110.00 assets:euros-- What are they worth on dec 21 ?-- $ hledger -f t.j bal euros -V -e 2016/12/21- $103.00 assets:euros-- Currently, hledger's -V only uses market prices recorded with P direc-- tives, not transaction prices (unlike Ledger).-- Using -B and -V together is allowed.-- Custom balance output- In simple (non-multi-column) balance reports, you can customise the- output 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- effect, 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-- Output destination- The balance, print, register and stats 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-- CSV output- The balance, print and register commands can write their output as CSV.- This is useful for exporting data to other applications, eg to make- charts in a spreadsheet. This is controlled by the -O/--output-format- option, or by specifying a .csv file extension with -o/--output-file.-- $ hledger balance -O csv # write CSV to stdout- $ hledger balance -o FILE.csv # write CSV to FILE.csv-- balancesheet- Show a balance sheet. Alias: bs.-- --flat show full account names, as a list (default)-- --drop=N- in flat mode: omit N leading account name parts-- This command displays a simple balance sheet. It currently assumes- that you have top-level accounts named asset and liability (plural- forms also allowed.)-- $ hledger balancesheet- Balance Sheet-- Assets:- $-1 assets- $1 bank:saving- $-2 cash- --------------------- $-1-- Liabilities:- $1 liabilities:debts- --------------------- $1-- Total:- --------------------- 0-- cashflow- Show a cashflow statement. Alias: cf.-- --flat show full account names, as a list (default)-- --drop=N- in flat mode: omit N leading account name parts-- This command displays a simple cashflow statement It shows the change- in all "cash" (ie, liquid assets) accounts for the period. It cur-- rently assumes that cash accounts are under a top-level account named- asset and do not contain receivable or A/R (plural forms also allowed.)-- $ hledger cashflow- Cashflow Statement-- Cash flows:- $-1 assets- $1 bank:saving- $-2 cash- --------------------- $-1-- Total:- --------------------- $-1-- help- Show any of the hledger manuals.-- The help command displays any of the main hledger man pages. (Unlike- hledger --help, which displays only the hledger man page.) Run it with- no arguments to list available topics (their names are shortened for- easier typing), and run hledger help TOPIC to select one. The output- is similar to a man page, but fixed width. It may be long, so you may- wish to pipe it into a pager. See also info and man.-- $ hledger help- Choose a topic, eg: hledger help cli- cli, ui, web, api, journal, csv, timeclock, timedot-- $ hledger help cli | less-- hledger(1) hledger User Manuals hledger(1)---- NAME- hledger - a command-line accounting tool-- SYNOPSIS- hledger [-f FILE] COMMAND [OPTIONS] [CMDARGS]- hledger [-f FILE] ADDONCMD -- [OPTIONS] [CMDARGS]- :-- incomestatement- Show an income statement. Alias: is.-- --flat show full account names, as a list (default)-- --drop=N- in flat mode: omit N leading account name parts-- 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-- info- Show any of the hledger manuals using info.-- The info command displays any of the hledger reference manuals using- the info hypertextual documentation viewer. This can be a very effi-- cient way to browse large manuals. It requires the "info" program to- be available in your PATH.-- As with help, run it with no arguments to list available topics (manu-- als).-- man- Show any of the hledger manuals using man.-- The man command displays any of the hledger reference manuals using- man, the standard documentation viewer on unix systems. This will fit- the text to your terminal width, and probably invoke a pager automati-- cally. It requires the "man" program to be available in your PATH.-- As with help, run it with no arguments to list available topics (manu-- als).-- print- Show transactions from the journal.-- -m STR --match=STR- show the transaction whose description is most similar to STR,- and is most recent-- -O FMT --output-format=FMT- select the output format. Supported formats: txt, csv.-- -o FILE --output-file=FILE- write output to FILE. A file extension matching one of the- above formats selects that format.-- $ 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-- The print command displays full transactions from the journal file,- tidily formatted and showing all amounts explicitly. The output of- print is always a valid hledger journal, but it does always not pre-- serve all original content exactly (eg directives).-- hledger's print command also shows all unit prices in effect, or (with- -B/--cost) shows cost amounts.-- The print command also supports output destination and CSV output.-- register- Show postings and their running total. Alias: reg.-- --cumulative- show running total from report start date (default)-- -H --historical- show historical running total/balance (includes postings before- report start date)-- -A --average- show running average of posting amounts instead of total- (implies --empty)-- -r --related- show postings' siblings instead-- -w N --width=N- set output width (default: terminal width or COLUMNS. -wN,M- sets description width as well)-- -O FMT --output-format=FMT- select the output format. Supported formats: txt, csv.-- -o FILE --output-file=FILE- write output to FILE. A file extension matching one of the- above formats selects that format.-- The register command displays postings, 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-- 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.-- 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.-- 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:-- <--------------------------------- 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, and set description width-- The register command also supports the -o/--output-file and -O/--out-- put-format options for controlling output destination and CSV output.-- stats- Show some journal statistics.-- -o FILE --output-file=FILE- write output to FILE. A file extension matching one of the- above formats selects that format.-- $ hledger stats- Main journal file : /src/hledger/data/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 ($)-- 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.-- The stats command also supports -o/--output-file for controlling output- destination.-- test- Run built-in unit tests.-- $ hledger test- Cases: 74 Tried: 74 Errors: 0 Failures: 0-- This command runs hledger's built-in unit tests and displays a quick- report. With a regular expression argument, it selects only tests with- matching names. It's mainly used in development, but it's also nice to- be able to check your hledger executable for smoke at any time.--ADD-ON COMMANDS- Add-on commands are executables in your PATH whose name starts with- hledger- and ends with any of these file extensions: none,- .hs,.lhs,.pl,.py,.rb,.rkt,.sh,.bat,.com,.exe. Also, an add-on's name- may not be the same as any built-in command or alias.-- hledger will detect these and include them in the command list and let- you invoke them with hledger ADDONCMD. However there are some limita-- tions:-- o Options appearing before ADDONCMD will be visible only to hledger and- will not be passed to the add-on. Eg: hledger -h web shows hledger's- usage, hledger web -h shows hledger-web's usage.-- o Options understood only by the add-on must go after a -- argument to- hide them from hledger, which would otherwise reject them. Eg:- hledger web -- --server.-- Sometimes it may be more convenient to just run the add-on directly,- eg: hledger-web --server.-- Add-ons which are written in haskell can take advantage of the- hledger-lib library for journal parsing, reporting, command-line- options, etc.-- Here are some hledger add-ons available from Hackage, the extra direc-- tory in the hledger source, or elsewhere:-- api- Web API server, see hledger-api.-- autosync- Download OFX bank data and/or convert OFX to hledger journal format.-- $ hledger autosync --help- usage: hledger-autosync [-h] [-m MAX] [-r] [-a ACCOUNT] [-l LEDGER] [-i INDENT]- [--initial] [--fid FID] [--assertions] [-d] [--hledger]- [--slow] [--which]- [PATH]-- Synchronize ledger.-- positional arguments:- PATH do not sync; import from OFX file-- optional arguments:- -h, --help show this help message and exit- -m MAX, --max MAX maximum number of days to process- -r, --resync do not stop until max days reached- -a ACCOUNT, --account ACCOUNT- set account name for import- -l LEDGER, --ledger LEDGER- specify ledger file to READ for syncing- -i INDENT, --indent INDENT- number of spaces to use for indentation- --initial create initial balance entries- --fid FID pass in fid value for OFX files that do not supply it- --assertions create balance assertion entries- -d, --debug enable debug logging- --hledger force use of hledger (on by default if invoked as hledger-- autosync)- --slow use slow, but possibly more robust, method of calling ledger- (no subprocess)- --which display which version of ledger/hledger/ledger-python will- be used by ledger-autosync to check for previous- transactions- $ head acct1.ofx- OFXHEADER:100- DATA:OFXSGML- VERSION:102- SECURITY:NONE- ENCODING:USASCII- CHARSET:1252- COMPRESSION:NONE- OLDFILEUID:NONE- NEWFILEUIDe:8509488b59d1bb45-- $ hledger autosync acct1.ofx- 2013/08/30 MONTHLY SERVICE FEE- ; ofxid: 3000.4303001832.201308301- WF:4303001832 -$6.00- [assets:business:bank:wf:bchecking:banking] $6.00-- ledger-autosync, which includes a hledger-autosync alias, downloads- transactions from your bank(s) via OFX, and prints just the new ones as- journal entries which you can add to your journal. It can also operate- on .OFX files which you've downloaded manually. It can be a nice- alternative to hledger's built-in CSV reader, especially if your bank- supports OFX download.-- diff- Show transactions present in one journal file but not another-- $ hledger diff --help- Usage: hledger-diff account:name left.journal right.journal- $ cat a.journal- 1/1- (acct:one) 1-- $ cat b.journal- 1/1- (acct:one) 1- 2/2- (acct:two) 2-- $ hledger diff acct:two a.journal b.journal- Unmatched transactions in the first journal:-- Unmatched transactions in the second journal:-- 2015/02/02- (acct:two) $2-- hledger-diff compares two journal files. Given an account name, it- prints out the transactions affecting that account which are in one- journal file but not in the other. This can be useful for reconciling- existing journals with bank statements.-- equity- Print a journal entry that resets account balances to zero.-- $ hledger balance --flat -E assets liabilities- 0 assets:bank:checking- $1 assets:bank:saving- $-2 assets:cash- $1 liabilities:debts- --------------------- 0- $ hledger equity assets liabilities- 2015/05/23- assets:bank:saving $-1- assets:cash $2- liabilities:debts $-1- equity:closing balances 0-- 2015/05/23- assets:bank:saving $1- assets:cash $-2- liabilities:debts $1- equity:opening balances 0-- This prints a journal entry which zeroes out the specified accounts (or- all accounts) with a transfer to/from "equity:closing balances" (like- Ledger's equity command). Also, it prints an similar entry with oppo-- site sign for restoring the balances from "equity:opening balances".-- These can be useful for ending one journal file and starting a new one,- respectively. By zeroing your asset and liability accounts at the end- of a file and restoring them at the start of the next one, you will see- correct asset/liability balances whether you run hledger on just one- file, or on several files concatenated with include.-- interest- Generate interest transactions.-- $ hledger interest --help- Usage: hledger-interest [OPTION...] ACCOUNT- -h --help print this message and exit- -V --version show version number and exit- -v --verbose echo input ledger to stdout (default)- -q --quiet don't echo input ledger to stdout- --today compute interest up until today- -f FILE --file=FILE input ledger file (pass '-' for stdin)- -s ACCOUNT --source=ACCOUNT interest source account- -t ACCOUNT --target=ACCOUNT interest target account- --act use 'act' day counting convention- --30-360 use '30/360' day counting convention- --30E-360 use '30E/360' day counting convention- --30E-360isda use '30E/360isda' day counting convention- --constant=RATE constant interest rate- --annual=RATE annual interest rate- --bgb288 compute interest according to German BGB288- --ing-diba compute interest according for Ing-Diba Tagesgeld account-- $ cat interest.journal- 2008/09/26 Loan- Assets:Bank EUR 10000.00- Liabilities:Bank-- 2008/11/27 Payment- Assets:Bank EUR -3771.12- Liabilities:Bank-- 2009/05/03 Payment- Assets:Bank EUR -1200.00- Liabilities:Bank-- 2010/12/10 Payment- Assets:Bank EUR -3700.00- Liabilities:Bank-- $ hledger interest -- -f interest.journal --source=Expenses:Interest \- --target=Liabilities:Bank --30-360 --annual=0.05 Liabilities:Bank- 2008/09/26 Loan- Assets:Bank EUR 10000.00- Liabilities:Bank EUR -10000.00-- 2008/11/27 0.05% interest for EUR -10000.00 over 61 days- Liabilities:Bank EUR -84.72- Expenses:Interest EUR 84.72-- 2008/11/27 Payment- Assets:Bank EUR -3771.12- Liabilities:Bank EUR 3771.12-- 2008/12/31 0.05% interest for EUR -6313.60 over 34 days- Liabilities:Bank EUR -29.81- Expenses:Interest EUR 29.81-- 2009/05/03 0.05% interest for EUR -6343.42 over 123 days- Liabilities:Bank EUR -108.37- Expenses:Interest EUR 108.37-- 2009/05/03 Payment- Assets:Bank EUR -1200.00- Liabilities:Bank EUR 1200.00-- 2009/12/31 0.05% interest for EUR -5251.78 over 238 days- Liabilities:Bank EUR -173.60- Expenses:Interest EUR 173.60-- 2010/12/10 0.05% interest for EUR -5425.38 over 340 days- Liabilities:Bank EUR -256.20- Expenses:Interest EUR 256.20-- 2010/12/10 Payment- Assets:Bank EUR -3700.00- Liabilities:Bank EUR 3700.00-- hledger-interest computes interests for a given account. Using command- line flags, the program can be configured to use various schemes for- day-counting, such as act/act, 30/360, 30E/360, and 30/360isda. Fur-- thermore, it supports a (small) number of interest schemes, i.e.- annual interest with a fixed rate and the scheme mandated by the German- BGB288 (Basiszins fr Verbrauchergeschfte). See the package page for- more.-- irr- Calculate internal rate of return.-- $ hledger irr --help- Usage: hledger-irr [OPTION...]- -h --help print this message and exit- -V --version show version number and exit- -c --cashflow also show all revant transactions- -f FILE --file=FILE input ledger file (pass '-' for stdin)- -i ACCOUNT --investment-account=ACCOUNT investment account- -t ACCOUNT --interest-account=ACCOUNT interest/gain/fees/losses account- -b DATE --begin=DATE calculate interest from this date- -e DATE --end=DATE calculate interest until this date- -D --daily calculate interest for each day- -W --weekly calculate interest for each week- -M --monthly calculate interest for each month- -Y --yearly calculate interest for each year-- $ cat irr.journal- 2011-01-01 Some wild speculation - I wonder if it pays off- Speculation 100.00- Cash-- 2011-02-01 More speculation (and adjustment of value)- Cash -10.00- Rate Gain -1.00- Speculation-- 2011-03-01 Lets pull out some money (and adjustment of value)- Cash 30.00- Rate Gain -3.00- Speculation-- 2011-04-01 More speculation (and it lost some money!)- Cash -50.00- Rate Gain 5.00- Speculation-- 2011-05-01 Getting some money out (and adjustment of value)- Speculation -44.00- Rate Gain - 3.00- Cash-- 2011-06-01 Emptying the account (after adjusting the value)- Speculation -85.00- Cash 90.00- Rate Gain - 5.00-- $ hledger-irr -f irr.journal -t "Rate Gain" -i Speculation --monthly- 2011/01/01 - 2011/02/01: 12.49%- 2011/02/01 - 2011/03/01: 41.55%- 2011/03/01 - 2011/04/01: -51.44%- 2011/04/01 - 2011/05/01: 32.24%- 2011/05/01 - 2011/06/01: 95.92%-- hledger-irr computes the internal rate of return, also known as the- effective interest rate, of a given investment. After specifying what- account holds the investment, and what account stores the gains (or- losses, or fees, or cost), it calculates the hypothetical annual rate- of fixed rate investment that would have provided the exact same cash- flow. See the package page for more.-- print-unique- Print only only journal entries which have a unique description.-- $ 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-- rewrite- Prints all journal entries, adding specified custom postings to matched- entries.-- hledger-rewrite.hs, in hledger's extra directory (compilation- optional), adds postings to existing transactions, optionally with an- amount based on the existing transaction's first amount. See the- script for more details.-- $ hledger rewrite -- [QUERY] --add-posting "ACCT AMTEXPR" ...- $ hledger rewrite -- ^income --add-posting '(liabilities:tax) *.33'- $ hledger rewrite -- expenses:gifts --add-posting '(budget:gifts) *-1"'-- ui- Curses-style interface, see hledger-ui.-- web- Web interface, see hledger-web.--TROUBLESHOOTING- Run-time problems- 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 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).-- Known limitations- Command line interface-- Add-on command options, unless they are also understood by the main- hledger executable, must be written after --, like this:- hledger web -- --server-- Differences from Ledger-- Not all of Ledger's journal file syntax is supported. See file format- differences.-- hledger is slower than Ledger, and uses more memory, on large data- files.-- Windows limitations-- In a windows CMD window, non-ascii characters and colours are not sup-- ported.-- In a windows Cygwin/MSYS/Mintty window, the tab key is not supported in- hledger add.--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).--BUGS- The need to precede options with -- when invoked from hledger is awk-- ward.-- hledger can't render non-ascii characters when run from a Windows com-- mand prompt (up to Windows 7 at least).-- 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.----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-2016 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.1 December 2016 hledger(1)+ 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+ 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 curses and web+ interfaces). Its basic function is to read a plain text file describ-+ ing 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, trans-+ lating 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. (Note -h and --help+ are different, like git.)++ General help options:++ -h show general usage (or after COMMAND, command usage)++ --help show this program's manual as plain text (or after an add-on+ COMMAND, the add-on's manual)++ --man show this program's manual with man++ --info show this program's manual with info++ --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)++ --alias=OLD=NEW+ rename accounts named OLD to NEW++ --anon anonymize accounts and payees++ --pivot TAGNAME+ use some other field/tag for account names++ -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+ (overrides the flags above)++ --date2+ show, and match with -b/-e/-p/date:, secondary dates instead++ -C --cleared+ include only cleared postings/txns++ --pending+ include only pending postings/txns++ -U --uncleared+ include only uncleared (and pending) postings/txns++ -R --real+ include only non-virtual postings++ --depth=N+ hide accounts/postings deeper than N++ -E --empty+ show items with zero amount, normally hidden++ -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)++ Note when multiple similar reporting options are provided, the last one+ takes precedence. Eg -p feb -p mar is equivalent to -p mar.++ Some of these can also be written as queries.++ 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.++ Command arguments+ Most hledger commands accept arguments after the command name, which+ are often a query, filtering the data in some way.++ Special characters+ Option and argument values which contain problematic characters should+ be escaped with double quotes, backslashes, or (best) single quotes.+ Problematic characters means spaces, and also characters which are sig-+ nificant to your command shell, such as less-than/greater-than. Eg:+ hledger register -p 'last year' "accounts receivable (receiv-+ able|payable)" amt:\>100.++ Characters which are significant both to the shell and in regular+ expressions sometimes need to be double-escaped. These include paren-+ theses, the pipe symbol and the dollar sign. Eg, to match the dollar+ symbol, bash users should do: hledger balance cur:'\$' or hledger bal-+ ance cur:\\$.++ There's more.. options and arguments get de-escaped when hledger is+ passing them to an addon executable. In this case you might need+ triple-escaping. Eg: hledger ui cur:'\\$' or hledger ui cur:\\\\$.++ If in doubt, keep things simple:++ o run add-on executables directly++ o write options after the command++ o enclose problematic args in single quotes++ o if needed, also add a backslash to escape regexp metacharacters++ If you're really stumped, add --debug=2 to troubleshoot.++ 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 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:+++ 2009/1/1, 2009/01/01, simple dates, several sep-+ 2009-1-1, 2009.1.1 arators allowed+ 2009/1, 2009 same as above - a missing+ day or month defaults to 1+ 1/1, january, jan, relative dates, meaning+ this year january 1 of the current+ year+ next year january 1 of next year+ this month the 1st of the current+ month+ this week the most recent monday+ last week the monday of the week+ before this one+ lastweek spaces are optional+ today, yesterday, tomorrow++ 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. One important thing to be aware of when+ specifying end dates: as in Ledger, end dates are exclusive, so you+ need to write the date after the last day you want to include.++ 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+ after the 1st of the cur-+ rent 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+ intervals can not be specified with a query, currently.++ 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+ 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"++ The following more complex report intervals are also supported:+ biweekly, bimonthly, every N days|weeks|months|quarters|years,+ every Nth day [of month], every Nth day of week.++ Examples:+++ -p "bimonthly from 2008"+ -p "every 2 weeks"+ -p "every 5 days from 1/3"++ 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, 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.++ Pivoting+ Normally hledger sums amounts, and organizes them in a hierarchy, based+ on account name. The --pivot TAGNAME option causes it to sum and orga-+ nize hierarchy based on some other field instead.++ TAGNAME is the full, case-insensitive name of a tag you have defined,+ or one of the built-in implicit tags (like code or payee). As with+ account names, when tag values have multiple:colon-separated:parts+ hledger will build hierarchy, displayed in tree-mode reports, summaris-+ able with a depth limit, and so on.++ --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 tag 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++ 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+ replacement 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, optional prefixes to match specific fields. Multiple+ search terms are combined as follows:++ All commands except print: show transactions/postings/accounts which+ match (or negatively match)++ o any of the description terms AND++ o any of the account terms AND++ o all the other terms.++ The print command: show 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:++ REGEX match account names by this regular expression++ acct:REGEX+ 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++ real:, real:0+ match real or virtual postings respectively++ status:*, status:!, status:+ match cleared, pending, or uncleared/pending 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.++ not: before any of the above negates the match.++ inacct:ACCTNAME+ a special term used automatically when you click an account name+ in hledger-web, specifying the account register we are currently+ in (selects the transactions of that account and how to show+ them, can be filtered further with acct etc). Not supported+ elsewhere in hledger.++ 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 incomestatement). You can also write any unambiguous prefix of+ a command name (hledger inc), or one of the standard short aliases dis-+ played in the command list (hledger is).++ accounts+ Show account names.++ --tree show short account names, as a tree++ --flat show full account names, as a list (default)++ --drop=N+ in flat mode: omit N leading account name parts++ This command lists all account names that are in use (ie, all the+ accounts which have at least one transaction posting to them). With+ query arguments, only matched account names 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.++ Examples:++ $ hledger accounts --tree+ assets+ bank+ checking+ saving+ cash+ expenses+ food+ supplies+ income+ gifts+ salary+ liabilities+ debts++ $ hledger accounts --drop 1+ bank:checking+ bank:saving+ cash+ food+ supplies+ gifts+ salary+ debts++ $ hledger accounts+ assets:bank:checking+ assets:bank:saving+ assets:cash+ expenses:food+ expenses:supplies+ income:gifts+ income:salary+ liabilities:debts++ 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.++ $ hledger activity --quarterly+ 2008-01-01 **+ 2008-04-01 *******+ 2008-07-01+ 2008-10-01 **++ add+ Prompt for transactions and add them to the journal.++ --no-new-accounts+ don't allow creating new accounts; helps prevent typos when+ entering account names++ 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 recent+ transaction (by description) 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> $++ balance+ Show accounts and their balances. Alias: bal.++ --change+ show balance change in each period (default)++ --cumulative+ show balance change accumulated across periods (in multicolumn+ reports)++ -H --historical+ show historical ending balance in each period (includes postings+ before report start date)++ --tree show accounts as a tree; amounts include subaccounts (default in+ simple reports)++ --flat show accounts as a list; amounts exclude subaccounts except when+ account is depth-clipped (default in multicolumn reports)++ -A --average+ show a row average column (in multicolumn mode)++ -T --row-total+ show a row total column (in multicolumn mode)++ -N --no-total+ don't show the final total row++ --drop=N+ omit N leading account name parts (in flat mode)++ --no-elide+ don't squash boring parent accounts (in tree mode)++ --format=LINEFORMAT+ in single-column balance reports: use this custom line format++ -O FMT --output-format=FMT+ select the output format. Supported formats: txt, csv.++ -o FILE --output-file=FILE+ write output to FILE. A file extension matching one of the+ above formats selects that format.++ --pretty-tables+ Use unicode to display prettier tables.++ The balance command displays accounts and balances. It is hledger's+ most featureful and most useful command.++ $ 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++ More precisely, the balance command shows the change to each account's+ balance caused by all (matched) postings. In the common case where you+ do not filter by date and your journal sets the correct opening bal-+ ances, this is the same as the account's ending balance.++ By default, accounts are displayed hierarchically, with subaccounts+ indented below their parent. "Boring" accounts, which contain a single+ interesting subaccount and no balance of their own, are elided into the+ following line for more compact output. (Use --no-elide to prevent+ this.)++ Each account's balance is the "inclusive" balance - it includes 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:++ $ hledger balance -p 2008/6 expenses --no-total+ $2 expenses+ $1 food+ $1 supplies++ Flat mode+ To see a flat list of full account names instead of the default hierar-+ chical display, use --flat. In this mode, accounts (unless+ depth-clipped) show their "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, balance shows accounts only to the specified depth.+ This is very useful to show a complex charts of accounts in less+ detail. In flat mode, balances from accounts below the depth limit+ will be shown as part of a parent account at the depth limit.++ $ hledger balance -N --depth 1+ $-1 assets+ $2 expenses+ $-2 income+ $1 liabilities++ Multicolumn balance reports+ With a reporting interval, multiple balance columns will be shown, one+ for each report period. There are three types of multi-column 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++ Multi-column 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+ 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 oth-+ erwise 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++ Market value+ The -V/--value flag converts the reported amounts to their market value+ on the report end date, using the most recent applicable market prices,+ when known. Specifically, when there is a market price (P directive)+ for the amount's commodity, dated on or before the report end date (see+ hledger -> Report start & end date), the amount will be converted to+ the price's commodity. If multiple applicable prices are defined, the+ latest-dated one is used (and if dates are equal, the one last parsed).++ For example:++ # 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 euros+ 100 assets:euros++ What are they worth on nov 3 ? (no report end date specified, defaults+ to the last date in the journal)++ $ hledger -f t.j bal euros -V+ $110.00 assets:euros++ What are they worth on dec 21 ?++ $ hledger -f t.j bal euros -V -e 2016/12/21+ $103.00 assets:euros++ Currently, hledger's -V only uses market prices recorded with P direc-+ tives, not transaction prices (unlike Ledger).++ Using -B and -V together is allowed.++ Custom balance output+ In simple (non-multi-column) balance reports, you can customise the+ output 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+ effect, 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++ Output destination+ The balance, print, register and stats 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++ CSV output+ The balance, print and register commands can write their output as CSV.+ This is useful for exporting data to other applications, eg to make+ charts in a spreadsheet. This is controlled by the -O/--output-format+ option, or by specifying a .csv file extension with -o/--output-file.++ $ hledger balance -O csv # write CSV to stdout+ $ hledger balance -o FILE.csv # write CSV to FILE.csv++ balancesheet+ Show a balance sheet. Alias: bs.++ --change+ show balance change in each period, instead of historical ending+ balances++ --cumulative+ show balance change accumulated across periods (in multicolumn+ reports), instead of historical ending balances++ -H --historical+ show historical ending balance in each period (includes postings+ before report start date) (default)++ --tree show accounts as a tree; amounts include subaccounts (default in+ simple reports)++ --flat show accounts as a list; amounts exclude subaccounts except when+ account is depth-clipped (default in multicolumn reports)++ -A --average+ show a row average column (in multicolumn mode)++ -T --row-total+ show a row total column (in multicolumn mode)++ -N --no-total+ don't show the final total row++ --drop=N+ omit N leading account name parts (in flat mode)++ --no-elide+ don't squash boring parent accounts (in tree mode)++ --format=LINEFORMAT+ in single-column balance reports: use this custom line format++ This command displays a simple balance sheet. It currently assumes+ that you have top-level accounts named asset and liability (plural+ forms also allowed.)++ $ 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.++ cashflow+ Show a cashflow statement. Alias: cf.++ --change+ show balance change in each period (default)++ --cumulative+ show balance change accumulated across periods (in multicolumn+ reports), instead of changes during periods++ -H --historical+ show historical ending balance in each period (includes postings+ before report start date), instead of changes during each period++ --tree show accounts as a tree; amounts include subaccounts (default in+ simple reports)++ --flat show accounts as a list; amounts exclude subaccounts except when+ account is depth-clipped (default in multicolumn reports)++ -A --average+ show a row average column (in multicolumn mode)++ -T --row-total+ show a row total column (in multicolumn mode)++ -N --no-total+ don't show the final total row (in simple reports)++ --drop=N+ omit N leading account name parts (in flat mode)++ --no-elide+ don't squash boring parent accounts (in tree mode)++ --format=LINEFORMAT+ in single-column balance reports: use this custom line format++ This command displays a simple cashflow statement It shows the change+ in all "cash" (ie, liquid assets) accounts for the period. It cur-+ rently assumes that cash accounts are under a top-level account named+ asset and do not contain receivable or A/R (plural forms also allowed.)++ $ 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.++ help+ Show any of the hledger manuals.++ The help command displays any of the main hledger man pages. (Unlike+ hledger --help, which displays only the hledger man page.) Run it with+ no arguments to list available topics (their names are shortened for+ easier typing), and run hledger help TOPIC to select one. The output+ is similar to a man page, but fixed width. It may be long, so you may+ wish to pipe it into a pager. See also info and man.++ $ hledger help+ Choose a topic, eg: hledger help cli+ cli, ui, web, api, journal, csv, timeclock, timedot++ $ hledger help cli | less++ hledger(1) hledger User Manuals hledger(1)++++ NAME+ hledger - a command-line accounting tool++ SYNOPSIS+ hledger [-f FILE] COMMAND [OPTIONS] [CMDARGS]+ hledger [-f FILE] ADDONCMD -- [OPTIONS] [CMDARGS]+ :++ incomestatement+ Show an income statement. Alias: is.++ --change+ show balance change in each period (default)++ --cumulative+ show balance change accumulated across periods (in multicolumn+ reports), instead of changes during periods++ -H --historical+ show historical ending balance in each period (includes postings+ before report start date), instead of changes during each period++ --tree show accounts as a tree; amounts include subaccounts (default in+ simple reports)++ --flat show accounts as a list; amounts exclude subaccounts except when+ account is depth-clipped (default in multicolumn reports)++ -A --average+ show a row average column (in multicolumn mode)++ -T --row-total+ show a row total column (in multicolumn mode)++ -N --no-total+ don't show the final total row++ --drop=N+ omit N leading account name parts (in flat mode)++ --no-elide+ don't squash boring parent accounts (in tree mode)++ --format=LINEFORMAT+ in single-column balance reports: use this custom line format++ 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.++ info+ Show any of the hledger manuals using info.++ The info command displays any of the hledger reference manuals using+ the info hypertextual documentation viewer. This can be a very effi-+ cient way to browse large manuals. It requires the "info" program to+ be available in your PATH.++ As with help, run it with no arguments to list available topics (manu-+ als).++ man+ Show any of the hledger manuals using man.++ The man command displays any of the hledger reference manuals using+ man, the standard documentation viewer on unix systems. This will fit+ the text to your terminal width, and probably invoke a pager automati-+ cally. It requires the "man" program to be available in your PATH.++ As with help, run it with no arguments to list available topics (manu-+ als).++ print+ Show transactions from the journal.++ -x --explicit+ show all amounts explicitly++ -m STR --match=STR+ show the transaction whose description is most similar to STR,+ and is most recent++ -O FMT --output-format=FMT+ select the output format. Supported formats: txt, csv.++ -o FILE --output-file=FILE+ write output to FILE. A file extension matching one of the+ above formats selects that format.++ $ 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++ The print command displays full journal entries (transactions) from the+ journal file, tidily formatted.++ As of hledger 1.2, print's output is always a valid hledger journal.+ However it may not preserve all original content, eg it does not print+ directives or inter-transaction comments.++ Normally, transactions' implicit/explicit amount style is preserved:+ 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, in+ this mode postings with a multi-commodity amount (possible with an+ implicit amount in a multi-commodity transaction) will be split into+ multiple single-commodity postings, for valid journal output.++ With -B/--cost, amounts with transaction prices are converted to cost+ (using the transaction price).++ The print command also supports output destination and CSV output.+ 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.)++ register+ Show postings and their running total. Alias: reg.++ --cumulative+ show running total from report start date (default)++ -H --historical+ show historical running total/balance (includes postings before+ report start date)++ -A --average+ show running average of posting amounts instead of total+ (implies --empty)++ -r --related+ show postings' siblings instead++ -w N --width=N+ set output width (default: terminal width or COLUMNS. -wN,M+ sets description width as well)++ -O FMT --output-format=FMT+ select the output format. Supported formats: txt, csv.++ -o FILE --output-file=FILE+ write output to FILE. A file extension matching one of the+ above formats selects that format.++ The register command displays postings, 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++ 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.++ 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.++ 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:++ <--------------------------------- 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, and set description width++ The register command also supports the -o/--output-file and -O/--out-+ put-format options for controlling output destination and CSV output.++ stats+ Show some journal statistics.++ -o FILE --output-file=FILE+ write output to FILE. A file extension matching one of the+ above formats selects that format.++ $ 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 ($)++ 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.++ The stats command also supports -o/--output-file for controlling output+ destination.++ test+ Run built-in unit tests.++ $ hledger test+ Cases: 74 Tried: 74 Errors: 0 Failures: 0++ This command runs hledger's built-in unit tests and displays a quick+ report. With a regular expression argument, it selects only tests with+ matching names. It's mainly used in development, but it's also nice to+ be able to check your hledger executable for smoke at any time.++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.++ api+ hledger-api serves hledger data as a JSON web API.++ ui+ hledger-ui provides an efficient curses-style 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 curses-style, more interactive 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+ account.++ Experimental add-ons+ These are available in source form in the hledger repo's bin/ direc-+ tory; installing them is pretty easy. They may be less mature and doc-+ umented 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.++ budget+ hledger-budget.hs adds more budget-tracking features to hledger.++ 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.++ check-dates+ hledger-check-dates.hs checks that journal entries are ordered by date.++ check-dupes+ hledger-check-dupes.hs checks for account names sharing the same leaf+ name.++ equity+ hledger-equity.hs prints balance-resetting transactions, useful for+ bringing account balances across file boundaries.++ prices+ hledger-prices.hs prints all prices from the journal.++ print-unique+ hledger-print-unique.hs prints transactions which do not reuse an+ already-seen description.++ register-match+ hledger-register-match.hs helps ledger-autosync detect already-seen+ transactions when importing.++ rewrite+ hledger-rewrite.hs Adds one or more custom postings to matched transac-+ tions.++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).++BUGS+ 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.++ 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+ 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 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-2016 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.2 March 2017 hledger(1)
doc/other/hledger-api.1 view
@@ -1,5 +1,5 @@ -.TH "hledger\-api" "1" "December 2016" "hledger\-api 1.1" "hledger User Manuals"+.TH "hledger\-api" "1" "March 2017" "hledger\-api 1.2" "hledger User Manuals" @@ -12,10 +12,6 @@ .PD 0 .P .PD-\f[C]hledger\-api\ \-\-swagger\f[]-.PD 0-.P-.PD \f[C]hledger\ api\ \-\-\ [OPTIONS]\f[] .SH DESCRIPTION .PP@@ -51,41 +47,30 @@ Note: if invoking hledger\-api as a hledger subcommand, write \f[C]\-\-\f[] before options as shown above. .TP-.B \f[C]\-d\ \-\-static\-dir=DIR\f[]-serve files from a different directory (default: \f[C]\&.\f[])-.RS-.RE-.TP-.B \f[C]\-p\ \-\-port=PORT\f[]-use a different TCP port (default: 8001)+.B \f[C]\-f\ \-\-file=FILE\f[]+use a different input file.+For stdin, use \- (default: \f[C]$LEDGER_FILE\f[] or+\f[C]$HOME/.hledger.journal\f[]) .RS .RE .TP-.B \f[C]\-\-swagger\f[]-print API docs in Swagger 2.0 format, and exit-.RS-.RE-.PP-hledger general options:-.TP-.B \f[C]\-h\f[]-show general usage (or after COMMAND, the command\[aq]s usage)+.B \f[C]\-d\ \-\-static\-dir=DIR\f[]+serve files from a different directory (default: \f[C]\&.\f[]) .RS .RE .TP-.B \f[C]\-\-help\f[]-show the current program\[aq]s manual as plain text (or after an add\-on-COMMAND, the add\-on\[aq]s manual)+.B \f[C]\-\-host=IPADDR\f[]+listen on this IP address (default: 127.0.0.1) .RS .RE .TP-.B \f[C]\-\-man\f[]-show the current program\[aq]s manual with man+.B \f[C]\-p\ \-\-port=PORT\f[]+listen on this TCP port (default: 8001) .RS .RE .TP-.B \f[C]\-\-info\f[]-show the current program\[aq]s manual with info+.B \f[C]\-\-swagger\f[]+print API docs in Swagger 2.0 format, and exit .RS .RE .TP@@ -94,29 +79,23 @@ .RS .RE .TP-.B \f[C]\-\-debug[=N]\f[]-show debug output (levels 1\-9, default: 1)-.RS-.RE-.TP-.B \f[C]\-f\ FILE\ \-\-file=FILE\f[]-use a different input file.-For stdin, use \-+.B \f[C]\-h\f[]+show usage .RS .RE .TP-.B \f[C]\-\-rules\-file=RULESFILE\f[]-Conversion rules file to use when reading CSV (default: FILE.rules)+.B \f[C]\-\-help\f[]+show manual as plain text .RS .RE .TP-.B \f[C]\-\-alias=OLD=NEW\f[]-display accounts named OLD as NEW+.B \f[C]\-\-man\f[]+show manual with man .RS .RE .TP-.B \f[C]\-I\ \-\-ignore\-assertions\f[]-ignore any failing balance assertions in the journal+.B \f[C]\-\-info\f[]+show manual with info .RS .RE .SH ENVIRONMENT
doc/other/hledger-api.1.info view
@@ -1,32 +1,30 @@-This is hledger-api/doc/hledger-api.1.info, produced by makeinfo-version 4.8 from stdin.+This is hledger-api.1.info, produced by makeinfo version 6.0 from stdin. -File: hledger-api.1.info, Node: Top, Up: (dir)+File: hledger-api.1.info, Node: Top, Next: OPTIONS, Up: (dir) -hledger-api(1) hledger-api 1.1+hledger-api(1) hledger-api 1.2 ****************************** hledger-api is a simple web API server, intended to support client-side-web apps operating on hledger data. It comes with a series of simple+web apps operating on hledger data. It comes with a series of simple client-side app examples, which drive its evolution. 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),+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. The server listens on IP address 127.0.0.1, accessible only to local-requests, by default. You can change this with `--host', eg `--host-0.0.0.0' to listen on all addresses. Note there is no other access+requests, by default. You can change this with '--host', eg '--host+0.0.0.0' to listen on all addresses. Note there is no other access control, so you will need to hide hledger-api behind an authenticating-proxy if you want to restrict access. You can change the TCP port-(default: 8001) with `-p PORT'.+proxy if you want to restrict access. You can change the TCP port+(default: 8001) with '-p PORT'. - If invoked as `hledger-api --swagger', instead of starting a server+ If invoked as 'hledger-api --swagger', instead of starting a server the API docs will be printed in Swagger 2.0 format.- * Menu: * OPTIONS::@@ -37,56 +35,45 @@ 1 OPTIONS ********* -Note: if invoking hledger-api as a hledger subcommand, write `--'-before options as shown above.--`-d --static-dir=DIR'- serve files from a different directory (default: `.')--`-p --port=PORT'- use a different TCP port (default: 8001)+Note: if invoking hledger-api as a hledger subcommand, write '--' before+options as shown above. -`--swagger'- print API docs in Swagger 2.0 format, and exit+'-f --file=FILE' - hledger general options:+ use a different input file. For stdin, use - (default:+ '$LEDGER_FILE' or '$HOME/.hledger.journal')+'-d --static-dir=DIR' -`-h'- show general usage (or after COMMAND, the command's usage)+ serve files from a different directory (default: '.')+'--host=IPADDR' -`--help'- show the current program's manual as plain text (or after an add-on- COMMAND, the add-on's manual)+ listen on this IP address (default: 127.0.0.1)+'-p --port=PORT' -`--man'- show the current program's manual with man+ listen on this TCP port (default: 8001)+'--swagger' -`--info'- show the current program's manual with info+ print API docs in Swagger 2.0 format, and exit+'--version' -`--version' show version--`--debug[=N]'- show debug output (levels 1-9, default: 1)--`-f FILE --file=FILE'- use a different input file. For stdin, use -+'-h' -`--rules-file=RULESFILE'- Conversion rules file to use when reading CSV (default: FILE.rules)+ show usage+'--help' -`--alias=OLD=NEW'- display accounts named OLD as NEW+ show manual as plain text+'--man' -`-I --ignore-assertions'- ignore any failing balance assertions in the journal+ show manual with man+'--info' + show manual with info Tag Table:-Node: Top90-Node: OPTIONS1216-Ref: #options1303+Node: Top74+Node: OPTIONS1220+Ref: #options1307 End Tag Table
doc/other/hledger-api.1.txt view
@@ -8,7 +8,6 @@ SYNOPSIS hledger-api [OPTIONS]- hledger-api --swagger hledger api -- [OPTIONS] DESCRIPTION@@ -41,64 +40,52 @@ Note: if invoking hledger-api as a hledger subcommand, write -- before options as shown above. + -f --file=FILE+ use a different input file. For stdin, use - (default:+ $LEDGER_FILE or $HOME/.hledger.journal)+ -d --static-dir=DIR serve files from a different directory (default: .) + --host=IPADDR+ listen on this IP address (default: 127.0.0.1)+ -p --port=PORT- use a different TCP port (default: 8001)+ listen on this TCP port (default: 8001) --swagger print API docs in Swagger 2.0 format, and exit - hledger general options:-- -h show general usage (or after COMMAND, the command's usage)-- --help show the current program's manual as plain text (or after an- add-on COMMAND, the add-on's manual)-- --man show the current program's manual with man-- --info show the current program's manual with info- --version show version - --debug[=N]- show debug output (levels 1-9, default: 1)-- -f FILE --file=FILE- use a different input file. For stdin, use -+ -h show usage - --rules-file=RULESFILE- Conversion rules file to use when reading CSV (default:- FILE.rules)+ --help show manual as plain text - --alias=OLD=NEW- display accounts named OLD as NEW+ --man show manual with man - -I --ignore-assertions- ignore any failing balance assertions in the journal+ --info show manual with info 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). FILES- Reads data from one or more files in hledger journal, timeclock, time-- dot, or CSV format specified with -f, or $LEDGER_FILE, or- $HOME/.hledger.journal (on windows, perhaps+ Reads data from one or more files in hledger journal, timeclock, time-+ dot, or CSV format specified with -f, or $LEDGER_FILE, or+ $HOME/.hledger.journal (on windows, perhaps C:/Users/USER/.hledger.journal). BUGS- The need to precede options with -- when invoked from hledger is awk-+ The need to precede options with -- when invoked from hledger is awk- ward. 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) @@ -112,7 +99,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) @@ -120,4 +107,4 @@ -hledger-api 1.1 December 2016 hledger-api(1)+hledger-api 1.2 March 2017 hledger-api(1)
doc/other/hledger-ui.1 view
@@ -1,5 +1,5 @@ -.TH "hledger\-ui" "1" "December 2016" "hledger\-ui 1.1" "hledger User Manuals"+.TH "hledger\-ui" "1" "March 2017" "hledger\-ui 1.2" "hledger User Manuals" @@ -40,7 +40,7 @@ the data. .TP .B \f[C]\-\-watch\f[]-watch for data (and time) changes and reload automatically+watch for data and date changes and reload automatically .RS .RE .TP@@ -63,64 +63,38 @@ show full account names, unindented .RS .RE-.TP-.B \f[C]\-V\ \-\-value\f[]-show amounts as their current market value in their default valuation-commodity (accounts screen only)-.RS-.RE .PP-hledger general options:-.TP-.B \f[C]\-h\f[]-show general usage (or after COMMAND, the command\[aq]s usage)-.RS-.RE-.TP-.B \f[C]\-\-help\f[]-show the current program\[aq]s manual as plain text (or after an add\-on-COMMAND, the add\-on\[aq]s manual)-.RS-.RE-.TP-.B \f[C]\-\-man\f[]-show the current program\[aq]s manual with man-.RS-.RE-.TP-.B \f[C]\-\-info\f[]-show the current program\[aq]s manual with info-.RS-.RE+hledger input options: .TP-.B \f[C]\-\-version\f[]-show version+.B \f[C]\-f\ FILE\ \-\-file=FILE\f[]+use a different input file.+For stdin, use \- (default: \f[C]$LEDGER_FILE\f[] or+\f[C]$HOME/.hledger.journal\f[]) .RS .RE .TP-.B \f[C]\-\-debug[=N]\f[]-show debug output (levels 1\-9, default: 1)+.B \f[C]\-\-rules\-file=RULESFILE\f[]+Conversion rules file to use when reading CSV (default: FILE.rules) .RS .RE .TP-.B \f[C]\-f\ FILE\ \-\-file=FILE\f[]-use a different input file.-For stdin, use \-+.B \f[C]\-\-alias=OLD=NEW\f[]+rename accounts named OLD to NEW .RS .RE .TP-.B \f[C]\-\-rules\-file=RULESFILE\f[]-Conversion rules file to use when reading CSV (default: FILE.rules)+.B \f[C]\-\-anon\f[]+anonymize accounts and payees .RS .RE .TP-.B \f[C]\-\-alias=OLD=NEW\f[]-display accounts named OLD as NEW+.B \f[C]\-\-pivot\ TAGNAME\f[]+use some other field/tag for account names .RS .RE .TP .B \f[C]\-I\ \-\-ignore\-assertions\f[]-ignore any failing balance assertions in the journal+ignore any failing balance assertions .RS .RE .PP@@ -208,20 +182,42 @@ .RS .RE .TP-.B \f[C]\-\-pivot\ TAG\f[]-will transform the journal before any other processing by replacing the-account name of every posting having the tag TAG with content VALUE by-the account name "TAG:VALUE".-The TAG will only match if it is a full\-length match.-The pivot will only happen if the TAG is on a posting, not if it is on-the transaction.-If the tag value is a multi:level:account:name the new account name will-be "TAG:multi:level:account:name".+.B \f[C]\-V\ \-\-value\f[]+convert amounts to their market value on the report end date (using the+most recent applicable market price, if any) .RS .RE+.PP+hledger help options: .TP-.B \f[C]\-\-anon\f[]-show anonymized accounts and payees+.B \f[C]\-h\f[]+show general usage (or after COMMAND, command usage)+.RS+.RE+.TP+.B \f[C]\-\-help\f[]+show this program\[aq]s manual as plain text (or after an add\-on+COMMAND, the add\-on\[aq]s manual)+.RS+.RE+.TP+.B \f[C]\-\-man\f[]+show this program\[aq]s manual with man+.RS+.RE+.TP+.B \f[C]\-\-info\f[]+show this program\[aq]s manual with info+.RS+.RE+.TP+.B \f[C]\-\-version\f[]+show version+.RS+.RE+.TP+.B \f[C]\-\-debug[=N]\f[]+show debug output (levels 1\-9, default: 1) .RS .RE .SH KEYS
doc/other/hledger-ui.1.info view
@@ -1,24 +1,22 @@-This is hledger-ui/doc/hledger-ui.1.info, produced by makeinfo version-4.8 from stdin.+This is hledger-ui.1.info, produced by makeinfo version 6.0 from stdin. -File: hledger-ui.1.info, Node: Top, Up: (dir)+File: hledger-ui.1.info, Node: Top, Next: OPTIONS, Up: (dir) -hledger-ui(1) hledger-ui 1.1+hledger-ui(1) hledger-ui 1.2 **************************** hledger-ui is hledger's curses-style 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+limited data entry capability. It is easier than hledger's command-line interface, and sometimes quicker and more convenient than the web interface. Like hledger, it reads data from one or more files in hledger-journal, timeclock, timedot, or CSV format specified with `-f', or-`$LEDGER_FILE', or `$HOME/.hledger.journal' (on windows, perhaps-`C:/Users/USER/.hledger.journal'). For more about this see hledger(1),+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.- * Menu: * OPTIONS::@@ -31,186 +29,187 @@ 1 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 the data. -`--watch'- watch for data (and time) changes and reload automatically+'--watch' -`--theme=default|terminal|greenterm'+ watch for data and date changes and reload automatically+'--theme=default|terminal|greenterm'+ use this custom display theme+'--register=ACCTREGEX' -`--register=ACCTREGEX' start in the (first) matched account's register screen+'--change' -`--change' show period balances (changes) at startup instead of historical balances+'--flat' -`--flat' show full account names, unindented -`-V --value'- show amounts as their current market value in their default- valuation commodity (accounts screen only)-- hledger general options:--`-h'- show general usage (or after COMMAND, the command's usage)--`--help'- show the current program's manual as plain text (or after an add-on- COMMAND, the add-on's manual)--`--man'- show the current program's manual with man+ hledger input options: -`--info'- show the current program's manual with info+'-f FILE --file=FILE' -`--version'- show version+ use a different input file. For stdin, use - (default:+ '$LEDGER_FILE' or '$HOME/.hledger.journal')+'--rules-file=RULESFILE' -`--debug[=N]'- show debug output (levels 1-9, default: 1)+ Conversion rules file to use when reading CSV (default: FILE.rules)+'--alias=OLD=NEW' -`-f FILE --file=FILE'- use a different input file. For stdin, use -+ rename accounts named OLD to NEW+'--anon' -`--rules-file=RULESFILE'- Conversion rules file to use when reading CSV (default: FILE.rules)+ anonymize accounts and payees+'--pivot TAGNAME' -`--alias=OLD=NEW'- display accounts named OLD as NEW+ use some other field/tag for account names+'-I --ignore-assertions' -`-I --ignore-assertions'- ignore any failing balance assertions in the journal+ ignore any failing balance assertions hledger reporting options: -`-b --begin=DATE'+'-b --begin=DATE'+ include postings/txns on or after this date+'-e --end=DATE' -`-e --end=DATE' include postings/txns before this date+'-D --daily' -`-D --daily' multiperiod/multicolumn report by day+'-W --weekly' -`-W --weekly' multiperiod/multicolumn report by week+'-M --monthly' -`-M --monthly' multiperiod/multicolumn report by month+'-Q --quarterly' -`-Q --quarterly' multiperiod/multicolumn report by quarter+'-Y --yearly' -`-Y --yearly' multiperiod/multicolumn report by year+'-p --period=PERIODEXP' -`-p --period=PERIODEXP' set start date, end date, and/or reporting interval all at once (overrides the flags above)+'--date2' -`--date2' show, and match with -b/-e/-p/date:, secondary dates instead+'-C --cleared' -`-C --cleared' include only cleared postings/txns+'--pending' -`--pending' include only pending postings/txns+'-U --uncleared' -`-U --uncleared' include only uncleared (and pending) postings/txns+'-R --real' -`-R --real' include only non-virtual postings+'--depth=N' -`--depth=N' hide accounts/postings deeper than N+'-E --empty' -`-E --empty' show items with zero amount, normally hidden+'-B --cost' -`-B --cost' convert amounts to their cost at transaction time (using the transaction price, if any)+'-V --value' -`--pivot TAG'- will transform the journal before any other processing by- replacing the account name of every posting having the tag TAG- with content VALUE by the account name "TAG:VALUE". The TAG will- only match if it is a full-length match. The pivot will only- happen if the TAG is on a posting, not if it is on the- transaction. If the tag value is a multi:level:account:name the- new account name will be "TAG:multi:level:account:name".+ convert amounts to their market value on the report end date (using+ the most recent applicable market price, if any) -`--anon'- show anonymized accounts and payees+ hledger help options: +'-h'++ show general usage (or after COMMAND, command usage)+'--help'++ show this program's manual as plain text (or after an add-on+ COMMAND, the add-on's manual)+'--man'++ show this program's manual with man+'--info'++ show this program's manual with info+'--version'++ show version+'--debug[=N]'++ show debug output (levels 1-9, default: 1)+ File: hledger-ui.1.info, Node: KEYS, Next: SCREENS, Prev: OPTIONS, Up: Top 2 KEYS ****** -`?' shows a help dialog listing all keys. (Some of these also appear in-the quick help at the bottom of each screen.) Press `?' again (or-`ESCAPE', or `LEFT') to close it. The following keys work on most+'?' 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' movement keys are also supported. A tip: movement speed+ 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' 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+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+'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.+period will move automatically to track the current date. To set a+non-standard period, you can use '/' and a 'date:' query. - `/' lets you set a general filter query limiting the data shown,-using the same query terms as in hledger and hledger-web. While editing-the query, you can use CTRL-a/e/d/k, BS, cursor keys; press `ENTER' to-set it, or `ESCAPE'to cancel. There are also keys for quickly adjusting+ '/' lets you set a general filter query limiting the data shown,+using the same query terms as in hledger and hledger-web. While editing+the query, you can use CTRL-a/e/d/k, BS, cursor keys; press 'ENTER' to+set it, or 'ESCAPE'to cancel. There are also keys for quickly adjusting some common filters like account depth and cleared/uncleared (see-below). `BACKSPACE' or `DELETE' removes all filters, showing all+below). 'BACKSPACE' or 'DELETE' removes all filters, showing all transactions. - `ESCAPE' removes all filters and jumps back to the top screen. Or,+ 'ESCAPE' removes all filters and jumps back to the top screen. Or, it cancels a minibuffer edit or help dialog in progress. - `g' reloads from the data file(s) and updates the current screen and-any previous screens. (With large files, this could cause a noticeable+ 'g' reloads from the data file(s) and updates the current screen and+any previous screens. (With large files, this could cause a noticeable pause.) - `I' toggles balance assertion checking. Disabling balance assertions+ 'I' toggles balance assertion checking. Disabling balance assertions temporarily can be useful for troubleshooting. - `a' runs command-line hledger's add command, and reloads the updated-file. This allows some basic data entry.+ 'a' runs command-line hledger's add command, and reloads the updated+file. This allows some basic data entry. - `E' runs $HLEDGER_UI_EDITOR, or $EDITOR, or a default (`emacsclient--a "" -nw') on the journal file. With some editors (emacs, vi), the+ 'E' runs $HLEDGER_UI_EDITOR, or $EDITOR, or a default ('emacsclient+-a "" -nw') on the journal file. With some editors (emacs, vi), the cursor will be positioned at the current transaction when invoked from the register and transaction screens, and at the error location (if possible) when invoked from the error screen. - `q' quits the application.+ 'q' quits the application. Additional screen-specific keys are described below. @@ -233,45 +232,45 @@ 3.1 Accounts screen =================== -This is normally the first screen displayed. It lists accounts and their-balances, like hledger's balance command. By default, it shows all-accounts and their latest ending balances (including the balances of-subaccounts). if you specify a query on the command line, it shows just+This is normally the first screen displayed. It lists accounts and+their balances, like hledger's balance command. By default, it shows+all accounts and their latest ending balances (including the balances of+subaccounts). if you specify a query on the command line, it shows just the matched accounts and the balances from matched transactions. Account names are normally indented to show the hierarchy (tree mode). To see less detail, set a depth limit by pressing a number key,-`1' to `9'. `0' shows even less detail, collapsing all accounts to a-single total. `-' and `+' (or `=') decrease and increase the depth-limit. To remove the depth limit, set it higher than the maximum-account depth, or press `ESCAPE'.+'1' to '9'. '0' shows even less detail, collapsing all accounts to a+single total. '-' and '+' (or '=') decrease and increase the depth+limit. To remove the depth limit, set it higher than the maximum+account depth, or press 'ESCAPE'. - `F' toggles flat mode, in which accounts are shown as a flat list,-with their full names. In this mode, account balances exclude+ 'F' toggles flat mode, in which accounts are shown as a flat list,+with their full names. In this mode, account balances exclude subaccounts, except for accounts at the depth limit (as with hledger's balance command). - `H' toggles between showing historical balances or period balances.+ 'H' toggles between showing historical balances or period balances. Historical balances (the default) are ending balances at the end of the report period, taking into account all transactions before that date (filtered by the filter query if any), including transactions before the-start of the report period. In other words, historical balances are what-you would see on a bank statement for that account (unless disturbed by-a filter query). Period balances ignore transactions before the report-start date, so they show the change in balance during the report period.-They are more useful eg when viewing a time log.+start of the report period. In other words, historical balances are+what you would see on a bank statement for that account (unless+disturbed by a filter query). Period balances ignore transactions+before the report start date, so they show the change in balance during+the report period. They are more useful eg when viewing a time log. - `C' toggles cleared mode, in which uncleared transactions and-postings are not shown. `U' toggles uncleared mode, in which only+ 'C' toggles cleared mode, in which uncleared transactions and+postings are not shown. 'U' toggles uncleared mode, in which only uncleared transactions/postings are shown. - `R' toggles real mode, in which virtual postings are ignored.+ 'R' toggles real mode, in which virtual postings are ignored. - `Z' toggles nonzero mode, in which only accounts with nonzero+ 'Z' toggles nonzero mode, in which only accounts with nonzero balances are shown (hledger-ui shows zero items by default, unlike command-line hledger). - Press `right' or `enter' to view an account's transactions register.+ Press 'right' or 'enter' to view an account's transactions register. File: hledger-ui.1.info, Node: Register screen, Next: Transaction screen, Prev: Accounts screen, Up: SCREENS@@ -280,44 +279,42 @@ =================== This screen shows the transactions affecting a particular account, like-a check register. Each line represents one transaction and shows:+a check register. Each line represents one transaction and shows: - * the other account(s) involved, in abbreviated form. (If there are- both real and virtual postings, it shows only the accounts- affected by real postings.)+ * the other account(s) involved, in abbreviated form. (If there are+ both real and virtual postings, it shows only the accounts affected+ by real postings.) * the overall change to the current account's balance; positive for an inflow to this account, negative for an outflow. * the running historical total or period total for the current- account, after the transaction. This can be toggled with `H'.- Similar to the accounts screen, the historical total is affected- by transactions (filtered by the filter query) before the report- start date, while the period total is not. If the historical total- is not disturbed by a filter query, it will be the running- historical balance you would see on a bank register for the- current account.-+ account, after the transaction. This can be toggled with 'H'.+ Similar to the accounts screen, the historical total is affected by+ transactions (filtered by the filter query) before the report start+ date, while the period total is not. If the historical total is+ not disturbed by a filter query, it will be the running historical+ balance you would see on a bank register for the current account. If the accounts screen was in tree mode, the register screen will include transactions from both the current account and its subaccounts. If the accounts screen was in flat mode, and a non-depth-clipped account was selected, the register screen will exclude transactions from-subaccounts. In other words, the register always shows the transactions-responsible for the period balance shown on the accounts screen. As on-the accounts screen, this can be toggled with `F'.+subaccounts. In other words, the register always shows the transactions+responsible for the period balance shown on the accounts screen. As on+the accounts screen, this can be toggled with 'F'. - `C' toggles cleared mode, in which uncleared transactions and-postings are not shown. `U' toggles uncleared mode, in which only+ 'C' toggles cleared mode, in which uncleared transactions and+postings are not shown. 'U' toggles uncleared mode, in which only uncleared transactions/postings are shown. - `R' toggles real mode, in which virtual postings are ignored.+ 'R' toggles real mode, in which virtual postings are ignored. - `Z' toggles nonzero mode, in which only transactions posting a+ 'Z' toggles nonzero mode, in which only transactions posting a nonzero change are shown (hledger-ui shows zero items by default, unlike command-line hledger). - Press `right' (or `enter') to view the selected transaction in+ Press 'right' (or 'enter') to view the selected transaction in detail. @@ -335,11 +332,11 @@ 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+ 'up' and 'down' will step through all transactions listed in the+previous account register screen. In the title bar, the numbers in+parentheses show your position within that account register. They will vary depending on which account register you came from (remember most-transactions appear in multiple account registers). The #N number+transactions appear in multiple account registers). The #N number preceding them is the transaction's position within the complete unfiltered journal, which is a more stable id (at least until the next reload).@@ -351,27 +348,26 @@ ================ 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+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.) - Tag Table:-Node: Top88-Node: OPTIONS823-Ref: #options922-Node: KEYS4003-Ref: #keys4100-Node: SCREENS6670-Ref: #screens6757-Node: Accounts screen6847-Ref: #accounts-screen6977-Node: Register screen9015-Ref: #register-screen9172-Node: Transaction screen11060-Ref: #transaction-screen11220-Node: Error screen12087-Ref: #error-screen12211+Node: Top73+Node: OPTIONS825+Ref: #options924+Node: KEYS3650+Ref: #keys3747+Node: SCREENS6335+Ref: #screens6422+Node: Accounts screen6512+Ref: #accounts-screen6642+Node: Register screen8691+Ref: #register-screen8848+Node: Transaction screen10737+Ref: #transaction-screen10897+Node: Error screen11767+Ref: #error-screen11891 End Tag Table
doc/other/hledger-ui.1.txt view
@@ -36,7 +36,7 @@ the data. --watch- watch for data (and time) changes and reload automatically+ watch for data and date changes and reload automatically --theme=default|terminal|greenterm use this custom display theme@@ -50,39 +50,26 @@ --flat show full account names, unindented - -V --value- show amounts as their current market value in their default val-- uation commodity (accounts screen only)-- hledger general options:-- -h show general usage (or after COMMAND, the command's usage)-- --help show the current program's manual as plain text (or after an- add-on COMMAND, the add-on's manual)-- --man show the current program's manual with man-- --info show the current program's manual with info-- --version- show version-- --debug[=N]- show debug output (levels 1-9, default: 1)+ hledger input options: -f FILE --file=FILE- use a different input file. For stdin, use -+ 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:+ Conversion rules file to use when reading CSV (default: FILE.rules) --alias=OLD=NEW- display accounts named OLD as NEW+ rename accounts named OLD to NEW + --anon anonymize accounts and payees++ --pivot TAGNAME+ use some other field/tag for account names+ -I --ignore-assertions- ignore any failing balance assertions in the journal+ ignore any failing balance assertions hledger reporting options: @@ -108,7 +95,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 (overrides the flags above) --date2@@ -133,66 +120,76 @@ show items with zero amount, normally hidden -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) - --pivot TAG- will transform the journal before any other processing by- replacing the account name of every posting having the tag TAG- with content VALUE by the account name "TAG:VALUE". The TAG- will only match if it is a full-length match. The pivot will- only happen if the TAG is on a posting, not if it is on the- transaction. If the tag value is a multi:level:account:name the- new account name will be "TAG:multi:level:account:name".+ -V --value+ convert amounts to their market value on the report end date+ (using the most recent applicable market price, if any) - --anon show anonymized accounts and payees+ hledger help options: + -h show general usage (or after COMMAND, command usage)++ --help show this program's manual as plain text (or after an add-on+ COMMAND, the add-on's manual)++ --man show this program's manual with man++ --info show this program's manual with info++ --version+ show version++ --debug[=N]+ show debug output (levels 1-9, default: 1)+ 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+ the previous screen, up/down/page up/page down/home/end move up and down through lists. Vi-style h/j/k/l 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+ 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+ With shift pressed, the cursor keys adjust the report period, limiting+ the transactions to be shown (by default, all are shown).+ shift-down/up steps downward and upward through these standard report period durations: year, quarter, month, week, day. Then,- shift-left/right moves to the previous/next period. t sets the report- period to today. With the --watch option, when viewing a "current"- period (the current day, week, month, quarter, or year), the period- will move automatically to track the current date. To set a non-stan-+ shift-left/right moves to the previous/next period. t sets the report+ period to today. With the --watch option, when viewing a "current"+ period (the current day, week, month, quarter, or year), the period+ will move automatically to track the current date. To set a non-stan- dard period, you can use / and a date: query. - / lets you set a general filter query limiting the data shown, using- the same query terms as in hledger and hledger-web. While editing the- query, you can use CTRL-a/e/d/k, BS, cursor keys; press ENTER to set+ / lets you set a general filter query limiting the data shown, using+ the same query terms as in hledger and hledger-web. While editing the+ query, you can use CTRL-a/e/d/k, BS, cursor keys; press ENTER to set it, or ESCAPEto cancel. There are also keys for quickly adjusting some- common filters like account depth and cleared/uncleared (see below).+ common filters like account depth and cleared/uncleared (see below). BACKSPACE or DELETE removes all filters, showing all transactions. - ESCAPE removes all filters and jumps back to the top screen. Or, it+ ESCAPE removes all filters and jumps back to the top screen. Or, it cancels a minibuffer edit or help dialog in progress. - g reloads from the data file(s) and updates the current screen and any- previous screens. (With large files, this could cause a noticeable+ g reloads from the data file(s) and updates the current screen and any+ previous screens. (With large files, this could cause a noticeable pause.) - I toggles balance assertion checking. Disabling balance assertions+ I toggles balance assertion checking. Disabling balance assertions temporarily can be useful for troubleshooting. - a runs command-line hledger's add command, and reloads the updated+ a runs command-line hledger's add command, and reloads the updated file. This allows some basic data entry. - E runs $HLEDGER_UI_EDITOR, or $EDITOR, or a default (emac-+ E runs $HLEDGER_UI_EDITOR, or $EDITOR, or a default (emac- sclient -a "" -nw) on the journal file. With some editors (emacs, vi),- the cursor will be positioned at the current transaction when invoked- from the register and transaction screens, and at the error location+ the cursor will be positioned at the current transaction when invoked+ from the register and transaction screens, and at the error location (if possible) when invoked from the error screen. q quits the application.@@ -201,42 +198,42 @@ SCREENS Accounts screen- This is normally the first screen displayed. It lists accounts and- their balances, like hledger's balance command. By default, it shows- all accounts and their latest ending balances (including the balances- of subaccounts). if you specify a query on the command line, it shows+ This is normally the first screen displayed. It lists accounts and+ their balances, like hledger's balance command. By default, it shows+ all accounts and their latest ending balances (including the balances+ of subaccounts). if you specify a query on the command line, it shows just the matched accounts and the balances from matched transactions. - Account names are normally indented to show the hierarchy (tree mode).+ Account names are normally indented to show the hierarchy (tree mode). To see less detail, set a depth limit by pressing a number key, 1 to 9. 0 shows even less detail, collapsing all accounts to a single total. -- and + (or =) decrease and increase the depth limit. To remove the- depth limit, set it higher than the maximum account depth, or press+ and + (or =) decrease and increase the depth limit. To remove the+ depth limit, set it higher than the maximum account depth, or press ESCAPE. - F toggles flat mode, in which accounts are shown as a flat list, with- their full names. In this mode, account balances exclude subaccounts,- except for accounts at the depth limit (as with hledger's balance com-+ F toggles flat mode, in which accounts are shown as a flat list, with+ their full names. In this mode, account balances exclude subaccounts,+ except for accounts at the depth limit (as with hledger's balance com- mand). H toggles between showing historical balances or period balances. His-- torical balances (the default) are ending balances at the end of the- report period, taking into account all transactions before that date- (filtered by the filter query if any), including transactions before- the start of the report period. In other words, historical balances- are what you would see on a bank statement for that account (unless- disturbed by a filter query). Period balances ignore transactions+ torical balances (the default) are ending balances at the end of the+ report period, taking into account all transactions before that date+ (filtered by the filter query if any), including transactions before+ the start of the report period. In other words, historical balances+ are what you would see on a bank statement for that account (unless+ disturbed by a filter query). Period balances ignore transactions before the report start date, so they show the change in balance during the report period. They are more useful eg when viewing a time log. - C toggles cleared mode, in which uncleared transactions and postings- are not shown. U toggles uncleared mode, in which only uncleared+ C toggles cleared mode, in which uncleared transactions and postings+ are not shown. U toggles uncleared mode, in which only uncleared transactions/postings are shown. R toggles real mode, in which virtual postings are ignored. - Z toggles nonzero mode, in which only accounts with nonzero balances- are shown (hledger-ui shows zero items by default, unlike command-line+ Z toggles nonzero mode, in which only accounts with nonzero balances+ are shown (hledger-ui shows zero items by default, unlike command-line hledger). Press right or enter to view an account's transactions register.@@ -245,62 +242,62 @@ This screen shows the transactions affecting a particular account, like a check register. Each line represents one transaction and shows: - o the other account(s) involved, in abbreviated form. (If there are- both real and virtual postings, it shows only the accounts affected+ o the other account(s) involved, in abbreviated form. (If there are+ both real and virtual postings, it shows only the accounts affected by real postings.) - o the overall change to the current account's balance; positive for an+ o the overall change to the current account's balance; positive for an inflow to this account, negative for an outflow. o the running historical total or period total for the current account,- after the transaction. This can be toggled with H. Similar to the- accounts screen, the historical total is affected by transactions- (filtered by the filter query) before the report start date, while+ after the transaction. This can be toggled with H. Similar to the+ accounts screen, the historical total is affected by transactions+ (filtered by the filter query) before the report start date, while the period total is not. If the historical total is not disturbed by- a filter query, it will be the running historical balance you would+ a filter query, it will be the running historical balance you would see on a bank register for the current account. - If the accounts screen was in tree mode, the register screen will+ If the accounts screen was in tree mode, the register screen will include transactions from both the current account and its subaccounts.- If the accounts screen was in flat mode, and a non-depth-clipped- account was selected, the register screen will exclude transactions+ If the accounts screen was in flat mode, and a non-depth-clipped+ account was selected, the register screen will exclude transactions from subaccounts. In other words, the register always shows the trans-- actions responsible for the period balance shown on the accounts+ actions responsible for the period balance shown on the accounts screen. As on the accounts screen, this can be toggled with F. - C toggles cleared mode, in which uncleared transactions and postings- are not shown. U toggles uncleared mode, in which only uncleared+ C toggles cleared mode, in which uncleared transactions and postings+ are not shown. U toggles uncleared mode, in which only uncleared transactions/postings are shown. R toggles real mode, in which virtual postings are ignored. - Z toggles nonzero mode, in which only transactions posting a nonzero- change are shown (hledger-ui shows zero items by default, unlike com-+ Z toggles nonzero mode, in which only transactions posting a nonzero+ change are shown (hledger-ui shows zero items by default, unlike com- mand-line hledger). Press right (or enter) to view the selected transaction in detail. Transaction screen- This screen shows a single transaction, as a general journal entry,- similar to hledger's print command and journal format (hledger_jour-+ This screen shows a single transaction, as a general journal entry,+ similar to hledger's print command and journal format (hledger_jour- nal(5)). - The transaction's date(s) and any cleared flag, transaction code,- description, comments, along with all of its account postings are- shown. Simple transactions have two postings, but there can be more+ The transaction's date(s) and any cleared flag, transaction code,+ description, comments, along with all of its account postings are+ shown. Simple transactions have two postings, but there can be more (or in certain cases, fewer). - up and down will step through all transactions listed in the previous- account register screen. In the title bar, the numbers in parentheses- show your position within that account register. They will vary+ up and down will step through all transactions listed in the previous+ account register screen. In the title bar, the numbers in parentheses+ show your position within that account register. They will vary depending on which account register you came from (remember most trans- actions appear in multiple account registers). The #N number preceding them is the transaction's position within the complete unfiltered jour- nal, which is a more stable id (at least until the next reload). Error screen- This screen will appear if there is a problem, such as a parse error,- when you press g to reload. Once you have fixed the problem, press g+ This screen will appear if there is a problem, such as a parse error,+ when you press g to reload. Once you have fixed the problem, press g again to reload and resume normal operation. (Or, you can press escape to cancel the reload attempt.) @@ -308,17 +305,17 @@ COLUMNS The screen width to use. Default: the full terminal width. LEDGER_FILE The journal file path when not specified with -f. Default:- ~/.hledger.journal (on windows, perhaps C:/Users/USER/.hledger.jour-+ ~/.hledger.journal (on windows, perhaps C:/Users/USER/.hledger.jour- nal). FILES- Reads data from one or more files in hledger journal, timeclock, time-- dot, or CSV format specified with -f, or $LEDGER_FILE, or- $HOME/.hledger.journal (on windows, perhaps+ Reads data from one or more files in hledger journal, timeclock, time-+ dot, or CSV format specified with -f, or $LEDGER_FILE, or+ $HOME/.hledger.journal (on windows, perhaps C:/Users/USER/.hledger.journal). BUGS- The need to precede options with -- when invoked from hledger is awk-+ The need to precede options with -- when invoked from hledger is awk- ward. -f- doesn't work (hledger-ui can't read from stdin).@@ -326,13 +323,13 @@ -V affects only the accounts screen. When you press g, the current and all previous screens are regenerated,- which may cause a noticeable pause with large files. Also there is no+ which may cause a noticeable pause with large files. Also there is no visual indication that this is in progress. - --watch is not yet fully robust. It works well for normal usage, but- many file changes in a short time (eg saving the file thousands of- times with an editor macro) can cause problems at least on OSX. Symp-- toms include: unresponsive UI, periodic resetting of the cursor posi-+ --watch is not yet fully robust. It works well for normal usage, but+ many file changes in a short time (eg saving the file thousands of+ times with an editor macro) can cause problems at least on OSX. Symp-+ toms include: unresponsive UI, periodic resetting of the cursor posi- tion, momentary display of parse errors, high CPU usage eventually sub- siding, and possibly a small but persistent build-up of CPU usage until the program is restarted.@@ -340,7 +337,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) @@ -354,7 +351,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) @@ -362,4 +359,4 @@ -hledger-ui 1.1 December 2016 hledger-ui(1)+hledger-ui 1.2 March 2017 hledger-ui(1)
doc/other/hledger-web.1 view
@@ -1,5 +1,5 @@ -.TH "hledger\-web" "1" "December 2016" "hledger\-web 1.1" "hledger User Manuals"+.TH "hledger\-web" "1" "March 2017" "hledger\-web 1.2" "hledger User Manuals" @@ -13,8 +13,6 @@ .P .PD \f[C]hledger\ web\ \-\-\ [OPTIONS]\f[]-.PP-.PP .SH DESCRIPTION .PP hledger is a cross\-platform program for tracking money, time, or any@@ -49,18 +47,8 @@ In this mode the web app will keep running for as long as you have it open in a browser window, and will exit after two minutes of inactivity (no requests and no browser windows viewing it).-.IP-.nf-\f[C]-$\ hledger\ web-Starting\ web\ app\ on\ port\ 5000\ with\ base\ url\ http://localhost:5000-Starting\ web\ browser\ if\ possible-Web\ app\ will\ auto\-exit\ after\ a\ few\ minutes\ with\ no\ browsers\ (or\ press\ ctrl\-c)-\f[]-.fi-.PP-With \f[C]\-\-serve\f[], it starts the web app in non\-transient mode-and logs requests to the console.+With \f[C]\-\-serve\f[], it just runs the web app without exiting, and+logs requests to the console. .PP By default the server listens on IP address 127.0.0.1, accessible only to local requests.@@ -102,19 +90,23 @@ Note: if invoking hledger\-web as a hledger subcommand, write \f[C]\-\-\f[] before options as shown above. .TP-.B \f[C]\-\-server\f[]-disable browser\-opening and auto\-exit\-on\-idle, and log all requests-to stdout+.B \f[C]\-\-serve\f[]+serve and log requests, don\[aq]t browse or auto\-exit .RS .RE .TP+.B \f[C]\-\-host=IPADDR\f[]+listen on this IP address (default: 127.0.0.1)+.RS+.RE+.TP .B \f[C]\-\-port=PORT\f[]-set the TCP port to listen on (default: 5000)+listen on this TCP port (default: 5000) .RS .RE .TP .B \f[C]\-\-base\-url=URL\f[]-set the base url (default: http://localhost:PORT).+set the base url (default: http://IPADDR:PORT). You would change this when sharing over the network, or integrating within a larger website. .RS@@ -128,57 +120,37 @@ .RS .RE .PP-hledger general options:-.TP-.B \f[C]\-h\f[]-show general usage (or after COMMAND, the command\[aq]s usage)-.RS-.RE-.TP-.B \f[C]\-\-help\f[]-show the current program\[aq]s manual as plain text (or after an add\-on-COMMAND, the add\-on\[aq]s manual)-.RS-.RE-.TP-.B \f[C]\-\-man\f[]-show the current program\[aq]s manual with man-.RS-.RE-.TP-.B \f[C]\-\-info\f[]-show the current program\[aq]s manual with info-.RS-.RE+hledger input options: .TP-.B \f[C]\-\-version\f[]-show version+.B \f[C]\-f\ FILE\ \-\-file=FILE\f[]+use a different input file.+For stdin, use \- (default: \f[C]$LEDGER_FILE\f[] or+\f[C]$HOME/.hledger.journal\f[]) .RS .RE .TP-.B \f[C]\-\-debug[=N]\f[]-show debug output (levels 1\-9, default: 1)+.B \f[C]\-\-rules\-file=RULESFILE\f[]+Conversion rules file to use when reading CSV (default: FILE.rules) .RS .RE .TP-.B \f[C]\-f\ FILE\ \-\-file=FILE\f[]-use a different input file.-For stdin, use \-+.B \f[C]\-\-alias=OLD=NEW\f[]+rename accounts named OLD to NEW .RS .RE .TP-.B \f[C]\-\-rules\-file=RULESFILE\f[]-Conversion rules file to use when reading CSV (default: FILE.rules)+.B \f[C]\-\-anon\f[]+anonymize accounts and payees .RS .RE .TP-.B \f[C]\-\-alias=OLD=NEW\f[]-display accounts named OLD as NEW+.B \f[C]\-\-pivot\ TAGNAME\f[]+use some other field/tag for account names .RS .RE .TP .B \f[C]\-I\ \-\-ignore\-assertions\f[]-ignore any failing balance assertions in the journal+ignore any failing balance assertions .RS .RE .PP@@ -266,20 +238,42 @@ .RS .RE .TP-.B \f[C]\-\-pivot\ TAG\f[]-will transform the journal before any other processing by replacing the-account name of every posting having the tag TAG with content VALUE by-the account name "TAG:VALUE".-The TAG will only match if it is a full\-length match.-The pivot will only happen if the TAG is on a posting, not if it is on-the transaction.-If the tag value is a multi:level:account:name the new account name will-be "TAG:multi:level:account:name".+.B \f[C]\-V\ \-\-value\f[]+convert amounts to their market value on the report end date (using the+most recent applicable market price, if any) .RS .RE+.PP+hledger help options: .TP-.B \f[C]\-\-anon\f[]-show anonymized accounts and payees+.B \f[C]\-h\f[]+show general usage (or after COMMAND, command usage)+.RS+.RE+.TP+.B \f[C]\-\-help\f[]+show this program\[aq]s manual as plain text (or after an add\-on+COMMAND, the add\-on\[aq]s manual)+.RS+.RE+.TP+.B \f[C]\-\-man\f[]+show this program\[aq]s manual with man+.RS+.RE+.TP+.B \f[C]\-\-info\f[]+show this program\[aq]s manual with info+.RS+.RE+.TP+.B \f[C]\-\-version\f[]+show version+.RS+.RE+.TP+.B \f[C]\-\-debug[=N]\f[]+show debug output (levels 1\-9, default: 1) .RS .RE .SH ENVIRONMENT
doc/other/hledger-web.1.info view
@@ -1,77 +1,68 @@-This is hledger-web/doc/hledger-web.1.info, produced by makeinfo-version 4.8 from stdin.+This is hledger-web.1.info, produced by makeinfo version 6.0 from stdin. -File: hledger-web.1.info, Node: Top, Up: (dir)+File: hledger-web.1.info, Node: Top, Next: OPTIONS, Up: (dir) -hledger-web(1) hledger-web 1.1+hledger-web(1) hledger-web 1.2 ****************************** -hledger-web is hledger's web interface. It starts a simple web+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 more at once-(accounts, the current account register, balance charts) and allowing-history-aware data entry, interactive searching, and bookmarking.+it in a web browser window if possible. It provides a more+user-friendly UI than the hledger CLI or hledger-ui interface, showing+more at once (accounts, the current account register, balance charts)+and allowing history-aware data entry, interactive searching, and+bookmarking. hledger-web also lets you share a ledger with multiple users, or even-the public web. There is no access control, so if you need that you-should put it behind a suitable web proxy. As a small protection against-data loss when running an unprotected instance, it writes a numbered-backup of the main journal file (only ?) on every edit.+the public web. There is no access control, so if you need that you+should put it behind a suitable web proxy. As a small protection+against data loss when running an unprotected instance, it writes a+numbered backup of the main journal file (only ?) on every edit. 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),+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. By default, hledger-web starts the web app in "transient mode" and-also opens it in your default web browser if possible. In this mode the+also opens it in your default web browser if possible. In this mode the web app will keep running for as long as you have it open in a browser window, and will exit after two minutes of inactivity (no requests and-no browser windows viewing it).---$ hledger web-Starting web app on port 5000 with base url http://localhost:5000-Starting web browser if possible-Web app will auto-exit after a few minutes with no browsers (or press ctrl-c)-- With `--serve', it starts the web app in non-transient mode and logs-requests to the console.+no browser windows viewing it). With '--serve', it just runs the web+app without exiting, and logs requests to the console. By default the server listens on IP address 127.0.0.1, accessible-only to local requests. You can use `--host' to change this, eg `--host+only to local requests. You can use '--host' to change this, eg '--host 0.0.0.0' to listen on all configured addresses. - Similarly, use `--port' to set a TCP port other than 5000, eg if you+ 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+ 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 configured host address and TCP port (or `http://HOST' if PORT+within 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,+ 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. Note there is no built-in access control (aside from listening on-127.0.0.1 by default). So you will need to hide hledger-web behind an+127.0.0.1 by default). So you will need to hide hledger-web behind an authenticating proxy (such as apache or nginx) if you want to restrict who can see and add entries to your journal. Command-line options and arguments may be used to set an initial-filter on the data. This is not shown in the web UI, but it will be+filter on the data. This is not shown in the web UI, but it will be applied in addition to any search query entered there. With journal and timeclock files (but not CSV files, currently) the web app detects changes made by other means and will show the new data-on the next request. If a change makes the file unparseable, hledger-web-will show an error until the file has been fixed.-+on the next request. If a change makes the file unparseable,+hledger-web will show an error until the file has been fixed. * Menu: * OPTIONS::@@ -82,129 +73,135 @@ 1 OPTIONS ********* -Note: if invoking hledger-web as a hledger subcommand, write `--'-before options as shown above.--`--server'- disable browser-opening and auto-exit-on-idle, and log all- requests to stdout+Note: if invoking hledger-web as a hledger subcommand, write '--' before+options as shown above. -`--port=PORT'- set the TCP port to listen on (default: 5000)+'--serve' -`--base-url=URL'- set the base url (default: http://localhost:PORT). You would- change this when sharing over the network, or integrating within a- larger website.+ serve and log requests, don't browse or auto-exit+'--host=IPADDR' -`--file-url=URL'- set the static files url (default: BASEURL/static). hledger-web- normally serves static files itself, but if you wanted to serve- them from another server for efficiency, you would set the url- with this.+ listen on this IP address (default: 127.0.0.1)+'--port=PORT' - hledger general options:+ listen on this TCP port (default: 5000)+'--base-url=URL' -`-h'- show general usage (or after COMMAND, the command's usage)+ set the base url (default: http://IPADDR:PORT). You would change+ this when sharing over the network, or integrating within a larger+ website.+'--file-url=URL' -`--help'- show the current program's manual as plain text (or after an add-on- COMMAND, the add-on's manual)+ set the static files url (default: BASEURL/static). hledger-web+ normally serves static files itself, but if you wanted to serve+ them from another server for efficiency, you would set the url with+ this. -`--man'- show the current program's manual with man+ hledger input options: -`--info'- show the current program's manual with info+'-f FILE --file=FILE' -`--version'- show version+ use a different input file. For stdin, use - (default:+ '$LEDGER_FILE' or '$HOME/.hledger.journal')+'--rules-file=RULESFILE' -`--debug[=N]'- show debug output (levels 1-9, default: 1)+ Conversion rules file to use when reading CSV (default: FILE.rules)+'--alias=OLD=NEW' -`-f FILE --file=FILE'- use a different input file. For stdin, use -+ rename accounts named OLD to NEW+'--anon' -`--rules-file=RULESFILE'- Conversion rules file to use when reading CSV (default: FILE.rules)+ anonymize accounts and payees+'--pivot TAGNAME' -`--alias=OLD=NEW'- display accounts named OLD as NEW+ use some other field/tag for account names+'-I --ignore-assertions' -`-I --ignore-assertions'- ignore any failing balance assertions in the journal+ ignore any failing balance assertions hledger reporting options: -`-b --begin=DATE'+'-b --begin=DATE'+ include postings/txns on or after this date+'-e --end=DATE' -`-e --end=DATE' include postings/txns before this date+'-D --daily' -`-D --daily' multiperiod/multicolumn report by day+'-W --weekly' -`-W --weekly' multiperiod/multicolumn report by week+'-M --monthly' -`-M --monthly' multiperiod/multicolumn report by month+'-Q --quarterly' -`-Q --quarterly' multiperiod/multicolumn report by quarter+'-Y --yearly' -`-Y --yearly' multiperiod/multicolumn report by year+'-p --period=PERIODEXP' -`-p --period=PERIODEXP' set start date, end date, and/or reporting interval all at once (overrides the flags above)+'--date2' -`--date2' show, and match with -b/-e/-p/date:, secondary dates instead+'-C --cleared' -`-C --cleared' include only cleared postings/txns+'--pending' -`--pending' include only pending postings/txns+'-U --uncleared' -`-U --uncleared' include only uncleared (and pending) postings/txns+'-R --real' -`-R --real' include only non-virtual postings+'--depth=N' -`--depth=N' hide accounts/postings deeper than N+'-E --empty' -`-E --empty' show items with zero amount, normally hidden+'-B --cost' -`-B --cost' convert amounts to their cost at transaction time (using the transaction price, if any)+'-V --value' -`--pivot TAG'- will transform the journal before any other processing by- replacing the account name of every posting having the tag TAG- with content VALUE by the account name "TAG:VALUE". The TAG will- only match if it is a full-length match. The pivot will only- happen if the TAG is on a posting, not if it is on the- transaction. If the tag value is a multi:level:account:name the- new account name will be "TAG:multi:level:account:name".+ convert amounts to their market value on the report end date (using+ the most recent applicable market price, if any) -`--anon'- show anonymized accounts and payees+ hledger help options: +'-h' + show general usage (or after COMMAND, command usage)+'--help'++ show this program's manual as plain text (or after an add-on+ COMMAND, the add-on's manual)+'--man'++ show this program's manual with man+'--info'++ show this program's manual with info+'--version'++ show version+'--debug[=N]'++ show debug output (levels 1-9, default: 1)+ Tag Table:-Node: Top90-Node: OPTIONS3343-Ref: #options3430+Node: Top74+Node: OPTIONS3156+Ref: #options3243 End Tag Table
doc/other/hledger-web.1.txt view
@@ -10,8 +10,6 @@ hledger-web [OPTIONS] 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@@ -41,15 +39,8 @@ opens it in your default web browser if possible. In this mode the web app will keep running for as long as you have it open in a browser win- dow, and will exit after two minutes of inactivity (no requests and no- browser windows viewing it).-- $ hledger web- Starting web app on port 5000 with base url http://localhost:5000- Starting web browser if possible- Web app will auto-exit after a few minutes with no browsers (or press ctrl-c)-- With --serve, it starts the web app in non-transient mode and logs- requests to the console.+ browser windows viewing it). With --serve, it just runs the web app+ without exiting, and logs requests to the console. By default the server listens on IP address 127.0.0.1, accessible only to local requests. You can use --host to change this, eg@@ -84,53 +75,46 @@ Note: if invoking hledger-web as a hledger subcommand, write -- before options as shown above. - --server- disable browser-opening and auto-exit-on-idle, and log all- requests to stdout+ --serve+ serve and log requests, don't browse or auto-exit + --host=IPADDR+ listen on this IP address (default: 127.0.0.1)+ --port=PORT- set the TCP port to listen on (default: 5000)+ listen on this TCP port (default: 5000) --base-url=URL- set the base url (default: http://localhost:PORT). You would+ set the base url (default: http://IPADDR:PORT). You would change this when sharing over the network, or integrating within a larger website. --file-url=URL set the static files url (default: BASEURL/static). hledger-web- normally serves static files itself, but if you wanted to serve- them from another server for efficiency, you would set the url+ normally serves static files itself, but if you wanted to serve+ them from another server for efficiency, you would set the url with this. - hledger general options:-- -h show general usage (or after COMMAND, the command's usage)-- --help show the current program's manual as plain text (or after an- add-on COMMAND, the add-on's manual)-- --man show the current program's manual with man-- --info show the current program's manual with info-- --version- show version-- --debug[=N]- show debug output (levels 1-9, default: 1)+ hledger input options: -f FILE --file=FILE- use a different input file. For stdin, use -+ 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:+ Conversion rules file to use when reading CSV (default: FILE.rules) --alias=OLD=NEW- display accounts named OLD as NEW+ rename accounts named OLD to NEW + --anon anonymize accounts and payees++ --pivot TAGNAME+ use some other field/tag for account names+ -I --ignore-assertions- ignore any failing balance assertions in the journal+ ignore any failing balance assertions hledger reporting options: @@ -156,7 +140,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 (overrides the flags above) --date2@@ -181,33 +165,43 @@ show items with zero amount, normally hidden -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) - --pivot TAG- will transform the journal before any other processing by- replacing the account name of every posting having the tag TAG- with content VALUE by the account name "TAG:VALUE". The TAG- will only match if it is a full-length match. The pivot will- only happen if the TAG is on a posting, not if it is on the- transaction. If the tag value is a multi:level:account:name the- new account name will be "TAG:multi:level:account:name".+ -V --value+ convert amounts to their market value on the report end date+ (using the most recent applicable market price, if any) - --anon show anonymized accounts and payees+ hledger help options: + -h show general usage (or after COMMAND, command usage)++ --help show this program's manual as plain text (or after an add-on+ COMMAND, the add-on's manual)++ --man show this program's manual with man++ --info show this program's manual with info++ --version+ show version++ --debug[=N]+ show debug output (levels 1-9, default: 1)+ 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). FILES- Reads data from one or more files in hledger journal, timeclock, time-- dot, or CSV format specified with -f, or $LEDGER_FILE, or- $HOME/.hledger.journal (on windows, perhaps+ Reads data from one or more files in hledger journal, timeclock, time-+ dot, or CSV format specified with -f, or $LEDGER_FILE, or+ $HOME/.hledger.journal (on windows, perhaps C:/Users/USER/.hledger.journal). BUGS- The need to precede options with -- when invoked from hledger is awk-+ The need to precede options with -- when invoked from hledger is awk- ward. -f- doesn't work (hledger-web can't read from stdin).@@ -221,7 +215,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) @@ -235,7 +229,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) @@ -243,4 +237,4 @@ -hledger-web 1.1 December 2016 hledger-web(1)+hledger-web 1.2 March 2017 hledger-web(1)
doc/other/hledger_csv.5 view
@@ -1,5 +1,5 @@ -.TH "hledger_csv" "5" "December 2016" "hledger 1.1" "hledger User Manuals"+.TH "hledger_csv" "5" "March 2017" "hledger 1.2" "hledger User Manuals"
doc/other/hledger_csv.5.info view
@@ -1,23 +1,21 @@-This is hledger-lib/doc/hledger_csv.5.info, produced by makeinfo-version 4.8 from stdin.+This is hledger_csv.5.info, produced by makeinfo version 6.0 from stdin. -File: hledger_csv.5.info, Node: Top, Up: (dir)+File: hledger_csv.5.info, Node: Top, Next: CSV RULES, Up: (dir) -hledger_csv(5) hledger 1.1+hledger_csv(5) hledger 1.2 ************************** hledger can read CSV files, converting each CSV record into a journal entry (transaction), if you provide some conversion hints in a "rules-file". This file should be named like the CSV file with an additional-`.rules' suffix (eg: `mybank.csv.rules'); or, you can specify the file-with `--rules-file PATH'. hledger will create it if necessary, with-some default rules which you'll need to adjust. At minimum, the rules-file must specify the `date' and `amount' fields. For an example, see+file". This file should be named like the CSV file with an additional+'.rules' suffix (eg: 'mybank.csv.rules'); or, you can specify the file+with '--rules-file PATH'. hledger will create it if necessary, with+some default rules which you'll need to adjust. At minimum, the rules+file must specify the 'date' and 'amount' fields. For an example, see How to read CSV files. To learn about _exporting_ CSV, see CSV output.- * Menu: * CSV RULES::@@ -30,8 +28,7 @@ *********** The following six kinds of rule can appear in the rules file, in any-order. Blank lines and lines beginning with `#' or `;' are ignored.-+order. Blank lines and lines beginning with '#' or ';' are ignored. * Menu: * skip::@@ -47,11 +44,10 @@ 1.1 skip ======== -`skip'_`N'_-- Skip this number of CSV records at the beginning. You'll need this-whenever your CSV data contains header lines. Eg:+'skip'_'N'_ + Skip this number of CSV records at the beginning. You'll need this+whenever your CSV data contains header lines. Eg: # ignore the first CSV line skip 1@@ -62,26 +58,22 @@ 1.2 date-format =============== -`date-format'_`DATEFMT'_+'date-format'_'DATEFMT'_ - When your CSV date fields are not formatted like `YYYY/MM/DD' (or-`YYYY-MM-DD' or `YYYY.MM.DD'), you'll need to specify the format.+ When your CSV date fields are not formatted like 'YYYY/MM/DD' (or+'YYYY-MM-DD' or 'YYYY.MM.DD'), you'll need to specify the format. DATEFMT is a strptime-like date parsing pattern, which must parse the-date field values completely. Examples:-+date field values completely. Examples: # for dates like "6/11/2013": date-format %-d/%-m/%Y - # for dates like "11/06/2013": date-format %m/%d/%Y - # for dates like "2013-Nov-06": date-format %Y-%h-%d - # for dates like "11/6/2013 11:32 PM": date-format %-m/%-d/%Y %l:%M %p @@ -91,15 +83,13 @@ 1.3 field list ============== -`fields'_`FIELDNAME1'_, _`FIELDNAME2'_...+'fields'_'FIELDNAME1'_, _'FIELDNAME2'_... This (a) names the CSV fields, in order (names may not contain whitespace; uninteresting names may be left blank), and (b) assigns them to journal entry fields if you use any of these standard field names:-`date', `date2', `status', `code', `description', `comment',-`account1', `account2', `amount', `amount-in', `amount-out',-`currency'. Eg:-+'date', 'date2', 'status', 'code', 'description', 'comment', 'account1',+'account2', 'amount', 'amount-in', 'amount-out', 'currency'. Eg: # use the 1st, 2nd and 4th CSV fields as the entry's date, description and amount, # and give the 7th and 8th fields meaningful names for later reference:@@ -115,17 +105,15 @@ 1.4 field assignment ==================== -_`ENTRYFIELDNAME'_ _`FIELDVALUE'_+_'ENTRYFIELDNAME'_ _'FIELDVALUE'_ This sets a journal entry field (one of the standard names above) to the given text value, which can include CSV field values interpolated by-name (`%CSVFIELDNAME') or 1-based position (`%N'). Eg:-+name ('%CSVFIELDNAME') or 1-based position ('%N'). Eg: # set the amount to the 4th CSV field with "USD " prepended amount USD %4 - # combine three fields to make a comment (containing two tags) comment note: %somefield - %anotherfield, date: %1 @@ -138,28 +126,26 @@ 1.5 conditional block ===================== -`if' _`PATTERN'_-_`FIELDASSIGNMENTS'_...+'if' _'PATTERN'_+ _'FIELDASSIGNMENTS'_... - `if'-_`PATTERN'_-_`PATTERN'_...-_`FIELDASSIGNMENTS'_...+ 'if'+_'PATTERN'_+_'PATTERN'_...+ _'FIELDASSIGNMENTS'_... This applies one or more field assignments, only to those CSV records-matched by one of the PATTERNs. The patterns are case-insensitive+matched by one of the PATTERNs. The patterns are case-insensitive regular expressions which match anywhere within the whole CSV record-(it's not yet possible to match within a specific field). When there are-multiple patterns they can be written on separate lines, unindented. The-field assignments are on separate lines indented by at least one space.-Examples:-+(it's not yet possible to match within a specific field). When there+are multiple patterns they can be written on separate lines, unindented.+The field assignments are on separate lines indented by at least one+space. Examples: # if the CSV record contains "groceries", set account2 to "expenses:groceries" if groceries account2 expenses:groceries - # if the CSV record contains any of these patterns, set account2 and comment as shown if monthly service fee@@ -174,13 +160,12 @@ 1.6 include =========== -`include'_`RULESFILE'_+'include'_'RULESFILE'_ - Include another rules file at this point. `RULESFILE' is either an+ Include another rules file at this point. 'RULESFILE' is either an absolute file path or a path relative to the current file's directory. Eg: - # rules reused with several CSV files include common.rules @@ -190,42 +175,41 @@ 2 TIPS ****** -Each generated journal entry will have two postings, to `account1' and-`account2' respectively. Currently it's not possible to generate+Each generated journal entry will have two postings, to 'account1' and+'account2' respectively. Currently it's not possible to generate entries with more than two postings. If the CSV has debit/credit amounts in separate fields, assign to the-`amount-in' and `amount-out' pseudo fields instead of `amount'.+'amount-in' and 'amount-out' pseudo fields instead of 'amount'. If the CSV has the currency in a separate field, assign that to the-`currency' pseudo field which will be automatically prepended to the-amount. (Or you can do the same thing with a field assignment.)+'currency' pseudo field which will be automatically prepended to the+amount. (Or you can do the same thing with a field assignment.) If an amount value is parenthesised, it will be de-parenthesised and sign-flipped automatically. - The generated journal entries will be sorted by date. The original+ The generated journal entries will be sorted by date. The original order of same-day entries will be preserved, usually. - Tag Table:-Node: Top90-Node: CSV RULES795-Ref: #csv-rules901-Node: skip1144-Ref: #skip1240-Node: date-format1411-Ref: #date-format1540-Node: field list2049-Ref: #field-list2188-Node: field assignment2883-Ref: #field-assignment3040-Node: conditional block3545-Ref: #conditional-block3701-Node: include4588-Ref: #include4699-Node: TIPS4930-Ref: #tips5014+Node: Top74+Node: CSV RULES800+Ref: #csv-rules906+Node: skip1149+Ref: #skip1245+Node: date-format1417+Ref: #date-format1546+Node: field list2052+Ref: #field-list2191+Node: field assignment2886+Ref: #field-assignment3043+Node: conditional block3547+Ref: #conditional-block3703+Node: include4599+Ref: #include4710+Node: TIPS4941+Ref: #tips5025 End Tag Table
doc/other/hledger_csv.5.txt view
@@ -166,4 +166,4 @@ -hledger 1.1 December 2016 hledger_csv(5)+hledger 1.2 March 2017 hledger_csv(5)
doc/other/hledger_journal.5 view
@@ -1,6 +1,6 @@ .\"t -.TH "hledger_journal" "5" "December 2016" "hledger 1.1" "hledger User Manuals"+.TH "hledger_journal" "5" "March 2017" "hledger 1.2" "hledger User Manuals" @@ -368,6 +368,7 @@ 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.+.SS Assertions and included files .PP With included files, things are a little more complicated. Including preserves the ordering of postings and assertions.@@ -375,6 +376,11 @@ across different files, and you also want to assert the account\[aq]s balance on the same day, you\[aq]ll have to put the assertion in the right file.+.SS Assertions and multiple \-f options+.PP+Balance assertions don\[aq]t work well across files specified with+multiple \-f options.+Use include or concatenate the files instead. .SS Assertions and commodities .PP The asserted balance must be a simple single\-commodity amount, and in@@ -548,8 +554,7 @@ .fi .PP DATE is a simple date as usual.-COMMODITYBEINGPRICED is the symbol of the commodity being priced (just-the symbol, no quantity).+COMMODITYBEINGPRICED is the symbol of the commodity being priced. UNITPRICE is an ordinary amount (symbol and quantity) in a second commodity, specifying the unit price or conversion rate for the first commodity in terms of the second, on the given date.@@ -607,32 +612,81 @@ .fi .SS Tags .PP-A \f[I]tag\f[] is a word followed by a full colon inside a transaction-or posting comment.-You can write multiple tags, comma separated.-Eg: \f[C];\ a\ comment\ containing\ sometag:,\ anothertag:\f[].-You can search for tags with the \f[C]tag:\f[] query.+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 tag can also have a value, which is any text between the colon and the-next comma or newline, excluding leading/trailing whitespace.-(So hledger tag values can not contain commas or newlines).+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[]+.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[]+.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[]+.fi+.PP+Here,+.IP \[bu] 2+"\f[C]a\ comment\ containing\f[]" is just comment text, not a tag+.IP \[bu] 2+"\f[C]tag1\f[]" is a tag with no value+.IP \[bu] 2+"\f[C]tag2\f[]" is another tag, whose value is+"\f[C]some\ value\ ...\f[]"+.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 (A, TAG2,-third\-tag) and the posting has four (A, TAG2, third\-tag,-posting\-tag):+For example, the following transaction has three tags (\f[C]A\f[],+\f[C]TAG2\f[], \f[C]third\-tag\f[]) and the posting has four (those plus+\f[C]posting\-tag\f[]): .IP .nf \f[C] 1/1\ a\ transaction\ \ ;\ A:,\ TAG2:-\ \ \ \ ;\ third\-tag:\ a\ third\ transaction\ tag,\ this\ time\ with\ a\ value+\ \ \ \ ;\ third\-tag:\ a\ third\ transaction\ tag,\ <\-\ with\ a\ value \ \ \ \ (a)\ \ $1\ \ ;\ posting\-tag: \f[] .fi .PP Tags are like Ledger\[aq]s metadata feature, except hledger\[aq]s tag values are simple strings.+.SS Implicit tags+.PP+Some predefined "implicit" tags are also provided:+.IP \[bu] 2+\f[C]code\f[] \- the transaction\[aq]s code field+.IP \[bu] 2+\f[C]description\f[] \- the transaction\[aq]s description+.IP \[bu] 2+\f[C]payee\f[] \- the part of description before \f[C]|\f[], or all of+it+.IP \[bu] 2+\f[C]note\f[] \- the part of description after \f[C]|\f[], or all of it+.PP+\f[C]payee\f[] and \f[C]note\f[] support descriptions written in a+special \f[C]PAYEE\ |\ NOTE\f[] format, accessing the parts before and+after the pipe character respectively.+For descriptions not containing a pipe character they are the same as+\f[C]description\f[]. .SS Directives .SS Account aliases .PP@@ -650,7 +704,7 @@ .IP \[bu] 2 customising reports .PP-See also How to use account aliases.+See also Cookbook: rewrite account names. .SS Basic aliases .PP To set an account alias, use the \f[C]alias\f[] directive in your
doc/other/hledger_journal.5.info view
@@ -1,33 +1,32 @@-This is hledger-lib/doc/hledger_journal.5.info, produced by makeinfo-version 4.8 from stdin.+This is hledger_journal.5.info, produced by makeinfo version 6.0 from+stdin. -File: hledger_journal.5.info, Node: Top, Up: (dir)+File: hledger_journal.5.info, Node: Top, Next: FILE FORMAT, Up: (dir) -hledger_journal(5) hledger 1.1+hledger_journal(5) hledger 1.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 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+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.+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@@ -82,31 +81,26 @@ 1.1 Transactions ================ -Transactions are represented by journal entries. Each begins with a+Transactions are represented by journal entries. Each begins with a simple date in column 0, followed by three optional fields with spaces between them: - * a status flag, which can be empty or `!' or `*' (meaning+ * a status flag, which can be empty or '!' or '*' (meaning "uncleared", "pending" and "cleared", or whatever you want)- * a transaction code (eg a check number),- * and/or a description - then some number of postings, of some amount to some account. Each+ then some number of postings, of some amount to some account. Each posting is on its own line, consisting of: * indentation of one or more spaces (or tabs)-- * optionally, a `!' or `*' status flag followed by a space-+ * optionally, a '!' or '*' status flag followed by a space * an account name, optionally containing single spaces- * optionally, two or more spaces or tabs followed by an amount Usually there are two or more postings, though one or none is also-possible. The posting amounts within a transaction must always balance,-ie add up to 0. Optionally one amount can be left blank, in which case+possible. The posting amounts within a transaction must always balance,+ie add up to 0. Optionally one amount can be left blank, in which case it will be inferred. @@ -128,11 +122,11 @@ ------------------ 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+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'.+command is run. Some examples: '2010/01/31', '1/31', '2010-01-31',+'2010.1.31'. File: hledger_journal.5.info, Node: Secondary dates, Next: Posting dates, Prev: Simple dates, Up: Dates@@ -141,40 +135,37 @@ --------------------- 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+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+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).+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+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+ 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+'--date2' flag for your reports. They are included in hledger for Ledger compatibility, but posting dates are a more powerful and less confusing alternative. @@ -186,34 +177,31 @@ 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+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+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+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. @@ -223,12 +211,13 @@ ================= 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'.+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+ 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.@@ -239,58 +228,53 @@ 1.4 Amounts =========== -After the account name, there is usually an amount. Important: between+After the account name, there is usually an amount. Important: between account name and amount, there must be *two or more spaces*. Amounts consist of a number and (usually) a currency symbol or-commodity name. Some examples:+commodity name. Some examples: - `2.00001'-`$1'-`4000 AAPL'-`3 "green apples"'-`-$1,000,000.00'-`INR 9,99,99,999.00'-`EUR -2.000.000,00'+ '2.00001'+'$1'+'4000 AAPL'+'3 "green apples"'+'-$1,000,000.00'+'INR 9,99,99,999.00'+'EUR -2.000.000,00' As you can see, the amount format is somewhat flexible: * amounts are a number (the "quantity") and optionally a currency symbol/commodity name (the "commodity").- * the commodity is a symbol, word, or phrase, on the left or right,- with or without a separating space. If the commodity contains+ with or without a separating space. If the commodity contains numbers, spaces or non-word punctuation it must be enclosed in double quotes.- * negative amounts with a commodity on the left can have the minus sign before or after it- * digit groups (thousands, or any other grouping) can be separated by commas (in which case period is used for decimal point) or periods (in which case comma is used for decimal point) You can use any of these variations when recording data, but when hledger displays amounts, it will choose a consistent format for each-commodity. (Except for price amounts, which are always formatted as-written). The display format is chosen as follows:+commodity. (Except for price amounts, which are always formatted as+written). The display format is chosen as follows: * if there is a commodity directive specifying the format, that is used- * otherwise the format is inferred from the first posting amount in- that commodity in the journal, and the precision (number of- decimal places) 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').+ that commodity in the journal, and the precision (number of decimal+ places) 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 usually don't affect amount-format inference, but in some situations they can do so indirectly. (Eg+format inference, but in some situations 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, set the desired+when -V is used.) If you find this causing problems, set the desired format with a commodity directive. @@ -303,23 +287,20 @@ _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.+ * 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:-+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+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'.-+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@@ -327,7 +308,7 @@ [assets:checking:available] $10 [assets:checking:budget:food] $-10 - Virtual postings have some legitimate uses, but those are few. You+ 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. @@ -337,11 +318,10 @@ 1.6 Balance Assertions ====================== -hledger supports Ledger-style balance assertions in journal files. These-look like `=EXPECTEDBALANCE' following a posting's amount. Eg in this-example we assert the expected dollar balance in accounts a and b after-each posting:-+hledger supports Ledger-style balance assertions in journal files.+These look like '=EXPECTEDBALANCE' following a posting's amount. Eg in+this example we assert the expected dollar balance in accounts a and b+after each posting: 2013/1/1 a $1 =$1@@ -352,71 +332,87 @@ 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+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-`--ignore-assertions' flag, which can be useful for troubleshooting or-for reading Ledger files.-+while cleaning up old entries. You can disable them temporarily with+the '--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 subaccounts:: * Assertions and virtual postings:: -File: hledger_journal.5.info, Node: Assertions and ordering, Next: Assertions and commodities, Up: Balance Assertions+File: hledger_journal.5.info, Node: Assertions and ordering, Next: Assertions and included files, Up: Balance Assertions 1.6.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+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+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.+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. - With included files, things are a little more complicated. Including-preserves the ordering of postings and assertions. If you have multiple++File: hledger_journal.5.info, Node: Assertions and included files, Next: Assertions and multiple -f options, Prev: Assertions and ordering, Up: Balance Assertions++1.6.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.5.info, Node: Assertions and commodities, Next: Assertions and subaccounts, Prev: Assertions and ordering, Up: Balance Assertions+File: hledger_journal.5.info, Node: Assertions and multiple -f options, Next: Assertions and commodities, Prev: Assertions and included files, Up: Balance Assertions -1.6.2 Assertions and commodities+1.6.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.5.info, Node: Assertions and commodities, Next: Assertions and subaccounts, Prev: Assertions and multiple -f options, Up: Balance Assertions++1.6.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. We could call this a partial-balance assertion. This is compatible with Ledger, and makes it possible-to make assertions about accounts containing multiple commodities.+(possibly multi-commodity) account balance. We could call this a+partial balance assertion. This is compatible with Ledger, and makes it+possible to make assertions about accounts containing multiple+commodities. To assert each commodity's balance in such a multi-commodity account,-you can add multiple postings (with amount 0 if necessary). But note+you can add multiple postings (with amount 0 if necessary). But note that no matter how many assertions you add, you can't be sure the-account does not contain some unexpected commodity. (We'll add support+account does not contain some unexpected commodity. (We'll add support for this kind of total balance assertion if there's demand.) File: hledger_journal.5.info, Node: Assertions and subaccounts, Next: Assertions and virtual postings, Prev: Assertions and commodities, Up: Balance Assertions -1.6.3 Assertions and subaccounts+1.6.5 Assertions and subaccounts -------------------------------- Balance assertions do not count the balance from subaccounts; they check-the posted account's exclusive balance. For example:-+the posted account's exclusive balance. For example: 1/1 checking:fund 1 = 1 ; post to this subaccount, its balance is now 1@@ -426,7 +422,6 @@ The balance report's flat mode shows these exclusive balances more clearly: - $ hledger bal checking --flat 1 checking 1 checking:fund@@ -436,11 +431,12 @@ File: hledger_journal.5.info, Node: Assertions and virtual postings, Prev: Assertions and subaccounts, Up: Balance Assertions -1.6.4 Assertions and virtual postings+1.6.6 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.+virtual. They are not affected by the '--real/-R' flag or 'real:'+query. File: hledger_journal.5.info, Node: Balance Assignments, Next: Prices, Prev: Balance Assertions, Up: FILE FORMAT@@ -448,13 +444,12 @@ 1.7 Balance Assignments ======================= -Ledger-style balance assignments are also supported. These are like+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+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@@ -464,7 +459,6 @@ 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@@ -473,7 +467,7 @@ 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+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. @@ -495,45 +489,40 @@ ------------------------ Within a transaction posting, you can record an amount's price in-another commodity. This can be used to document the cost (for a+another commodity. This can be used to document the cost (for a purchase), or selling price (for a sale), or the exchange rate that was-used, for this transaction. These transaction prices are fixed, and do+used, for this transaction. These transaction prices are fixed, and do not change over time. Amounts with transaction prices can be displayed in the transaction-price's commodity, by using the `--cost/-B' flag supported by most+price's commodity, by using the '--cost/-B' flag supported by most hledger commands (mnemonic: "cost Basis"). There are several ways to record a transaction price: - 1. Write the unit price (aka exchange rate), as `@ UNITPRICE' after+ 1. Write the unit price (aka exchange rate), as '@ UNITPRICE' after the amount: - 2009/1/1 assets:foreign currency €100 @ $1.35 ; one hundred euros at $1.35 each assets:cash - 2. Or write the total price, as `@@ TOTALPRICE' after the amount:-+ 2. Or write the total price, as '@@ TOTALPRICE' after the amount: 2009/1/1 assets:foreign currency €100 @@ $135 ; one hundred euros at $135 for the lot assets:cash - 3. Or let hledger infer the price so as to balance the transaction. To- permit this, you must fully specify all posting amounts, and their- sum must have a non-zero amount in exactly two commodities:-+ 3. Or let hledger infer the price so as to balance the transaction.+ To permit this, you must fully specify all posting amounts, and+ their sum must have a non-zero amount in exactly two commodities: 2009/1/1 assets:foreign currency €100 ; one hundred euros assets:cash $-135 ; exchanged for $135 - With any of the above examples we get: - $ hledger print -B 2009/01/01 assets:foreign currency $135.00@@ -549,28 +538,26 @@ ------------------- Market prices are not tied to a particular transaction; they represent-historical exchange rates between two commodities. (Ledger calls them-historical prices.) For example, the prices published by a stock-exchange or the foreign exchange market. Some commands (balance,+historical exchange rates between two commodities. (Ledger calls them+historical prices.) For example, the prices published by a stock+exchange or the foreign exchange market. Some commands (balance, currently) can use this information to show the market value of things at a given date. To record market prices, use P directives in the main journal or in-an included file. Their format is:-+an included file. Their format is: P DATE COMMODITYBEINGPRICED UNITPRICE - DATE is a simple date as usual. COMMODITYBEINGPRICED is the symbol of-the commodity being priced (just the symbol, no quantity). UNITPRICE is-an ordinary amount (symbol and quantity) in a second commodity,-specifying the unit price or conversion rate for the first commodity in-terms of the second, on the given date.+ DATE is a simple date as usual. COMMODITYBEINGPRICED is the symbol+of the commodity being priced. UNITPRICE is an ordinary amount (symbol+and quantity) in a second commodity, specifying the unit price or+conversion rate for the first commodity in terms of the second, on the+given date. For example, the following 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 @@ -580,22 +567,21 @@ 1.9 Comments ============ -Lines in the journal beginning with a semicolon (`;') or hash (`#') or-asterisk (`*') are comments, and will be ignored. (Asterisk comments+Lines in the journal beginning with a semicolon (';') or hash ('#') or+asterisk ('*') are comments, and will be ignored. (Asterisk comments make it easy to treat your journal like an org-mode outline in emacs.) - Also, anything between `comment' and `end comment' directives is a-(multi-line) comment. If there is no `end comment', the comment extends+ Also, anything between 'comment' and 'end comment' directives is a+(multi-line) comment. If there is no 'end comment', the comment extends to the end of the file. 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+postings). Similarly, you can attach comments to an individual posting by writing them after the amount and/or indented on the following lines. Some examples: - # a journal comment ; also a journal comment@@ -621,29 +607,65 @@ 1.10 Tags ========= -A _tag_ is a word followed by a full colon inside a transaction or-posting comment. You can write multiple tags, comma separated. Eg: `; a-comment containing sometag:, anothertag:'. You can search for tags with-the `tag:' query.+Tags are a way to add extra labels or labelled data to postings and+transactions, which you can then search or pivot on. - A tag can also have a value, which is any text between the colon and-the next comma or newline, excluding leading/trailing whitespace. (So-hledger tag values can not contain commas or newlines).+ A simple tag is a word (which may contain hyphens) followed by a full+colon, written inside a transaction or posting comment line: - 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 (A, TAG2, third-tag, posting-tag):+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, this time with a value+ ; 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.+* Menu: +* Implicit tags::+ +File: hledger_journal.5.info, Node: Implicit tags, Up: Tags++1.10.1 Implicit tags+--------------------++Some predefined "implicit" tags are also provided:++ * 'code' - the transaction's code field+ * 'description' - the transaction's description+ * 'payee' - the part of description before '|', or all of it+ * 'note' - the part of description after '|', or all of it++ 'payee' and 'note' support descriptions written in a special 'PAYEE |+NOTE' format, accessing the parts before and after the pipe character+respectively. For descriptions not containing a pipe character they are+the same as 'description'.++ File: hledger_journal.5.info, Node: Directives, Prev: Tags, Up: FILE FORMAT 1.11 Directives@@ -667,21 +689,17 @@ ---------------------- You can define aliases which rewrite your account names (after reading-the journal, before generating reports). hledger's account aliases can+the journal, before generating reports). hledger's account aliases 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 - See also How to use account aliases.-+ See also Cookbook: rewrite account names. * Menu: * Basic aliases::@@ -695,22 +713,20 @@ 1.11.1.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:-+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+ 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 full account names. hledger will replace any-occurrence of the old account name with the new one. Subaccounts are+ OLD and NEW are 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" @@ -721,21 +737,19 @@ ...................... There is also a more powerful variant that uses a regular expression,-indicated by the forward slashes. (This was the default behaviour in+indicated by the forward slashes. (This was the default behaviour in hledger 0.24-0.25): - alias /REGEX/ = REPLACEMENT - or `--alias '/REGEX/=REPLACEMENT''.+ or '--alias '/REGEX/=REPLACEMENT''. - REGEX is a case-insensitive regular expression. Anywhere it matches+ 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. Note, currently regular expression aliases may cause noticeable slow-downs.-(And if you use Ledger on your hledger file, they will be ignored.) Eg:-+(And if you use Ledger on your hledger file, they will be ignored.) Eg: alias /^(.+):bank:([^:]+)(.*)/ = \1:\2 \3 # rewrites "assets:bank:wells fargo:checking" to "assets:wells fargo checking"@@ -747,14 +761,13 @@ ......................... You can define as many aliases as you like using directives or-command-line options. Aliases are recursive - each alias sees the result-of applying previous ones. (This is different from Ledger, where aliases-are non-recursive by default). Aliases are applied in the following-order:+command-line options. Aliases are recursive - each alias sees the+result of applying previous ones. (This is different from Ledger, where+aliases are non-recursive by default). Aliases are applied in the+following order: 1. alias directives, most recently seen first (recent directives take precedence over earlier ones; directives not yet seen are ignored)- 2. alias options, in the order they appear on the command line @@ -763,10 +776,9 @@ 1.11.1.4 end aliases .................... -You can clear (forget) all currently defined aliases with the `end+You can clear (forget) all currently defined aliases with the 'end aliases' directive: - end aliases @@ -775,11 +787,10 @@ 1.11.2 account directive ------------------------ -The `account' directive predefines account names, as in Ledger and-Beancount. This may be useful for your own documentation; hledger+The 'account' directive predefines account names, as in Ledger and+Beancount. This may be useful for your own documentation; hledger doesn't make use of it yet. - ; account ACCT ; OPTIONAL COMMENTS/TAGS... @@ -798,10 +809,9 @@ ------------------------------ 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+within a section of the journal. Use the 'apply account' and 'end apply account' directives like so: - apply account home 2010/1/1@@ -812,14 +822,12 @@ 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:-+ 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@@ -827,7 +835,7 @@ apply account personal include personal.journal - Prior to hledger 1.0, legacy `account' and `end' spellings were also+ Prior to hledger 1.0, legacy 'account' and 'end' spellings were also supported. @@ -836,8 +844,8 @@ 1.11.4 Multi-line comments -------------------------- -A line containing just `comment' starts a multi-line comment, and a-line containing just `end comment' ends it. See comments.+A line containing just 'comment' starts a multi-line comment, and a line+containing just 'end comment' ends it. See comments. File: hledger_journal.5.info, Node: commodity directive, Next: Default commodity, Prev: Multi-line comments, Up: Directives@@ -845,14 +853,12 @@ 1.11.5 commodity directive -------------------------- -The `commodity' directive predefines commodities (currently this is-just informational), and also it may define the display format for-amounts in this commodity (overriding the automatically inferred-format).+The 'commodity' directive predefines commodities (currently this is just+informational), and also it may define the display format for amounts in+this commodity (overriding the automatically inferred format). It may be written on a single line, like this: - ; commodity EXAMPLEAMOUNT ; display AAAA amounts with the symbol on the right, space-separated,@@ -860,11 +866,10 @@ ; separating thousands with comma. commodity 1,000.0000 AAAA - or on multiple lines, using the "format" subdirective. In this case+ 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 @@ -881,12 +886,11 @@ ------------------------ 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+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@@ -902,10 +906,9 @@ ------------------- 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.+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@@ -931,13 +934,12 @@ You can pull in the content of additional journal 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. Glob patterns (`*') are not currently supported.+current file. Glob patterns ('*') are not currently supported. - The `include' directive can only be used in journal files. It can+ The 'include' directive can only be used in journal files. It can include journal, timeclock or timedot files, but not CSV files. @@ -947,8 +949,8 @@ **************** Add-on modes exist for various text editors, to make working with-journal files easier. They add colour, navigation aids and helpful-commands. For hledger users who edit the journal file directly (the+journal files easier. They add colour, navigation aids and helpful+commands. For hledger users who edit the journal file directly (the majority), using one of these modes is quite recommended. These were written with Ledger in mind, but also work with hledger@@ -960,77 +962,82 @@ Textmate https://github.com/ledger/ledger/wiki/Using-TextMate-2 Text Wrangler https://github.com/ledger/ledger/wiki/Editing-Ledger-files-with-TextWrangler - Tag Table:-Node: Top94-Node: FILE FORMAT2284-Ref: #file-format2410-Node: Transactions2593-Ref: #transactions2713-Node: Dates3656-Ref: #dates3784-Node: Simple dates3849-Ref: #simple-dates3977-Node: Secondary dates4341-Ref: #secondary-dates4497-Node: Posting dates6057-Ref: #posting-dates6188-Node: Account names7559-Ref: #account-names7698-Node: Amounts8183-Ref: #amounts8321-Node: Virtual Postings10420-Ref: #virtual-postings10581-Node: Balance Assertions11801-Ref: #balance-assertions11978-Node: Assertions and ordering12800-Ref: #assertions-and-ordering12985-Node: Assertions and commodities14016-Ref: #assertions-and-commodities14242-Node: Assertions and subaccounts14934-Ref: #assertions-and-subaccounts15168-Node: Assertions and virtual postings15690-Ref: #assertions-and-virtual-postings15899-Node: Balance Assignments16040-Ref: #balance-assignments16209-Node: Prices17327-Ref: #prices17460-Node: Transaction prices17511-Ref: #transaction-prices17656-Node: Market prices19236-Ref: #market-prices19371-Node: Comments20371-Ref: #comments20493-Node: Tags21605-Ref: #tags21725-Node: Directives22648-Ref: #directives22763-Node: Account aliases22956-Ref: #account-aliases23102-Node: Basic aliases23704-Ref: #basic-aliases23849-Node: Regex aliases24537-Ref: #regex-aliases24707-Node: Multiple aliases25477-Ref: #multiple-aliases25651-Node: end aliases26147-Ref: #end-aliases26289-Node: account directive26391-Ref: #account-directive26573-Node: apply account directive26869-Ref: #apply-account-directive27067-Node: Multi-line comments27727-Ref: #multi-line-comments27919-Node: commodity directive28046-Ref: #commodity-directive28232-Node: Default commodity29105-Ref: #default-commodity29280-Node: Default year29816-Ref: #default-year29983-Node: Including other files30406-Ref: #including-other-files30565-Node: EDITOR SUPPORT30961-Ref: #editor-support31081+Node: Top78+Node: FILE FORMAT2292+Ref: #file-format2418+Node: Transactions2601+Ref: #transactions2721+Node: Dates3663+Ref: #dates3791+Node: Simple dates3856+Ref: #simple-dates3984+Node: Secondary dates4350+Ref: #secondary-dates4506+Node: Posting dates6069+Ref: #posting-dates6200+Node: Account names7574+Ref: #account-names7713+Node: Amounts8200+Ref: #amounts8338+Node: Virtual Postings10439+Ref: #virtual-postings10600+Node: Balance Assertions11820+Ref: #balance-assertions11997+Node: Assertions and ordering12893+Ref: #assertions-and-ordering13081+Node: Assertions and included files13781+Ref: #assertions-and-included-files14024+Node: Assertions and multiple -f options14357+Ref: #assertions-and-multiple--f-options14613+Node: Assertions and commodities14745+Ref: #assertions-and-commodities14982+Node: Assertions and subaccounts15678+Ref: #assertions-and-subaccounts15912+Node: Assertions and virtual postings16433+Ref: #assertions-and-virtual-postings16642+Node: Balance Assignments16784+Ref: #balance-assignments16953+Node: Prices18072+Ref: #prices18205+Node: Transaction prices18256+Ref: #transaction-prices18401+Node: Market prices19978+Ref: #market-prices20113+Node: Comments21086+Ref: #comments21208+Node: Tags22321+Ref: #tags22441+Node: Implicit tags23870+Ref: #implicit-tags23978+Node: Directives24495+Ref: #directives24610+Node: Account aliases24803+Ref: #account-aliases24949+Node: Basic aliases25553+Ref: #basic-aliases25698+Node: Regex aliases26388+Ref: #regex-aliases26558+Node: Multiple aliases27329+Ref: #multiple-aliases27503+Node: end aliases28001+Ref: #end-aliases28143+Node: account directive28244+Ref: #account-directive28426+Node: apply account directive28722+Ref: #apply-account-directive28920+Node: Multi-line comments29579+Ref: #multi-line-comments29771+Node: commodity directive29899+Ref: #commodity-directive30085+Node: Default commodity30957+Ref: #default-commodity31132+Node: Default year31669+Ref: #default-year31836+Node: Including other files32259+Ref: #including-other-files32418+Node: EDITOR SUPPORT32815+Ref: #editor-support32935 End Tag Table
doc/other/hledger_journal.5.txt view
@@ -287,28 +287,33 @@ trol over the order of postings and assertions within a day, so you can assert intra-day balances. + Assertions and included files With included files, things are a little more complicated. Including preserves the ordering of postings and assertions. If you have multi- ple postings to an account on the same day, split across different files, and you also want to assert the account's balance on the same day, you'll have to put the assertion in the right file. + 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.+ 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. We could call this a par-- tial balance assertion. This is compatible with Ledger, and makes it+ 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. We could call this a par-+ tial balance assertion. This is compatible with Ledger, and makes it possible to make assertions about accounts containing multiple commodi- ties. - To assert each commodity's balance in such a multi-commodity account,- you can add multiple postings (with amount 0 if necessary). But note- that no matter how many assertions you add, you can't be sure the+ To assert each commodity's balance in such a multi-commodity account,+ you can add multiple postings (with amount 0 if necessary). But note+ that no matter how many assertions you add, you can't be sure the account does not contain some unexpected commodity. (We'll add support for this kind of total balance assertion if there's demand.) Assertions and subaccounts- Balance assertions do not count the balance from subaccounts; they+ Balance assertions do not count the balance from subaccounts; they check the posted account's exclusive balance. For example: 1/1@@ -316,7 +321,7 @@ checking 1 = 1 ; post to the parent account, its exclusive balance is now 1 equity - The balance report's flat mode shows these exclusive balances more+ The balance report's flat mode shows these exclusive balances more clearly: $ hledger bal checking --flat@@ -330,10 +335,10 @@ tual. They are not affected by the --real/-R flag or real: query. Balance Assignments- Ledger-style balance assignments are also supported. These are like- balance assertions, but with no posting amount on the left side of the- equals sign; instead it is calculated automatically so as to satisfy- the assertion. This can be a convenience during data entry, eg when+ Ledger-style balance assignments are also supported. These are like+ balance assertions, but with no posting amount on the left side of the+ equals sign; instead it is calculated automatically so as to satisfy+ the assertion. This can be a convenience during data entry, eg when setting opening balances: ; starting a new journal, set asset account balances@@ -351,27 +356,27 @@ expenses:misc The calculated amount depends on the account's balance in the commodity- at that point (which depends on the previously-dated postings of the- commodity to that account since the last balance assertion or assign-+ at that point (which depends on the previously-dated postings of the+ commodity to that account since the last balance assertion or assign- ment). Note that using balance assignments makes your journal a little less explicit; to know the exact amount posted, you have to run hledger or do the calculations yourself, instead of just reading it. Prices Transaction prices- Within a transaction posting, you can record an amount's price in- another commodity. This can be used to document the cost (for a pur-- chase), or selling price (for a sale), or the exchange rate that was+ Within a transaction posting, you can record an amount's price in+ another commodity. This can be used to document the cost (for a pur-+ chase), or selling price (for a sale), or the exchange rate that was used, for this transaction. These transaction prices are fixed, and do not change over time. - Amounts with transaction prices can be displayed in the transaction- price's commodity, by using the --cost/-B flag supported by most+ Amounts with transaction prices can be displayed in the transaction+ price's commodity, by using the --cost/-B flag supported by most hledger commands (mnemonic: "cost Basis"). There are several ways to record a transaction price: - 1. Write the unit price (aka exchange rate), as @ UNITPRICE after the+ 1. Write the unit price (aka exchange rate), as @ UNITPRICE after the amount: 2009/1/1@@ -385,7 +390,7 @@ assets:cash 3. Or let hledger infer the price so as to balance the transaction. To- permit this, you must fully specify all posting amounts, and their+ permit this, you must fully specify all posting amounts, and their sum must have a non-zero amount in exactly two commodities: 2009/1/1@@ -399,46 +404,46 @@ assets:foreign currency $135.00 assets:cash $-135.00 - Example use for transaction prices: recording the effective conversion+ Example use for transaction prices: recording the effective conversion rate of purchases made in a foreign currency. Market prices- Market prices are not tied to a particular transaction; they represent- historical exchange rates between two commodities. (Ledger calls them- historical prices.) For example, the prices published by a stock- exchange or the foreign exchange market. Some commands (balance, cur-- rently) can use this information to show the market value of things at+ Market prices are not tied to a particular transaction; they represent+ historical exchange rates between two commodities. (Ledger calls them+ historical prices.) For example, the prices published by a stock+ exchange or the foreign exchange market. Some commands (balance, cur-+ rently) can use this information to show the market value of things at a given date. - To record market prices, use P directives in the main journal or in an+ To record market prices, use P directives in the main journal or in an included file. Their format is: P DATE COMMODITYBEINGPRICED UNITPRICE - DATE is a simple date as usual. COMMODITYBEINGPRICED is the symbol of- the commodity being priced (just the symbol, no quantity). UNITPRICE- is an ordinary amount (symbol and quantity) in a second commodity,- specifying the unit price or conversion rate for the first commodity in- terms of the second, on the given date.+ DATE is a simple date as usual. COMMODITYBEINGPRICED is the symbol of+ the commodity being priced. UNITPRICE is an ordinary amount (symbol+ and quantity) in a second commodity, specifying the unit price or con-+ version rate for the first commodity in terms of the second, on the+ given date. - For example, the following directives say that one euro was worth 1.35+ For example, the following 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 Comments- Lines in the journal beginning with a semicolon (;) or hash (#) or- asterisk (*) are comments, and will be ignored. (Asterisk comments- make it easy to treat your journal like an org-mode outline in emacs.)+ Lines in the journal beginning with a semicolon (;) or hash (#) or+ asterisk (*) are comments, and will be ignored. (Asterisk comments+ make it easy to treat your journal like an org-mode outline in emacs.) - Also, anything between comment and end comment directives is a- (multi-line) comment. If there is no end comment, the comment extends+ Also, anything between comment and end comment directives is a+ (multi-line) comment. If there is no end comment, the comment extends to the end of the file. - You can attach comments to a transaction by writing them after the- description and/or indented on the following lines (before the post-- ings). Similarly, you can attach comments to an individual posting by+ You can attach comments to a transaction by writing them after the+ description and/or indented on the following lines (before the post-+ ings). Similarly, you can attach comments to an individual posting by writing them after the amount and/or indented on the following lines. Some examples:@@ -463,27 +468,61 @@ ; a journal comment (because not indented) Tags- A tag is a word followed by a full colon inside a transaction or post-- ing comment. You can write multiple tags, comma separated. Eg:- ; a comment containing sometag:, anothertag:. You can search for tags- with the tag: query.+ Tags are a way to add extra labels or labelled data to postings and+ transactions, which you can then search or pivot on. - A tag can also have a value, which is any text between the colon and- the next comma or newline, excluding leading/trailing whitespace. (So- hledger tag values can not contain commas or newlines).+ A simple tag is a word (which may contain hyphens) followed by a full+ colon, written inside a transaction or posting comment line: - 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 (A, TAG2, third-tag, posting-tag):+ 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, this time with a value+ ; 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+ Tags are like Ledger's metadata feature, except hledger's tag values are simple strings. + Implicit tags+ Some predefined "implicit" tags are also provided:++ o code - the transaction's code field++ o description - the transaction's description++ o payee - the part of description before |, or all of it++ o note - the part of description after |, or all of it++ payee and note support descriptions written in a special PAYEE | NOTE+ format, accessing the parts before and after the pipe character respec-+ tively. For descriptions not containing a pipe character they are the+ same as description.+ Directives Account aliases You can define aliases which rewrite your account names (after reading@@ -500,7 +539,7 @@ o customising reports - See also How to use account aliases.+ See also Cookbook: rewrite account names. Basic aliases To set an account alias, use the alias directive in your journal file.@@ -727,4 +766,4 @@ -hledger 1.1 December 2016 hledger_journal(5)+hledger 1.2 March 2017 hledger_journal(5)
doc/other/hledger_timeclock.5 view
@@ -1,5 +1,5 @@ -.TH "hledger_timeclock" "5" "December 2016" "hledger 1.1" "hledger User Manuals"+.TH "hledger_timeclock" "5" "March 2017" "hledger 1.2" "hledger User Manuals"
doc/other/hledger_timeclock.5.info view
@@ -1,30 +1,28 @@-This is hledger-lib/doc/hledger_timeclock.5.info, produced by makeinfo-version 4.8 from stdin.+This is hledger_timeclock.5.info, produced by makeinfo version 6.0 from+stdin. File: hledger_timeclock.5.info, Node: Top, Up: (dir) -hledger_timeclock(5) hledger 1.1+hledger_timeclock(5) hledger 1.2 ******************************** -hledger can read timeclock files. As with Ledger, these are (a subset+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+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 o 2015/04/01 02:00:34 hledger treats each clock-in/clock-out pair as a transaction posting-some number of hours to an account. Or if the session spans more than-one day, it is split into several transactions, one for each day. For-the above time log, `hledger print' generates these journal entries:-+some number of hours to an account. Or if the session spans more than+one day, it is split into several transactions, one for each day. For+the above time log, 'hledger print' generates these journal entries: $ hledger -f t.timeclock print 2015/03/30 * optional description after two spaces@@ -38,7 +36,6 @@ Here is a sample.timeclock to download and some queries to try: - $ hledger -f sample.timeclock balance # current time balances $ hledger -f sample.timeclock register -p 2009/3 # sessions in march 2009 $ hledger -f sample.timeclock register -p weekly --depth 1 --empty # time summary by week@@ -50,18 +47,16 @@ * at the command line, use these bash aliases: - alias ti="echo i `date '+%Y-%m-%d %H:%M:%S'` \$* >>$TIMELOG" alias to="echo o `date '+%Y-%m-%d %H:%M:%S'` >>$TIMELOG" - * or use the old `ti' and `to' scripts in the ledger 2.x repository.+ * or use the old 'ti' and 'to' scripts in the ledger 2.x repository. These rely on a "timeclock" executable which I think is just the ledger 2 executable renamed. - Tag Table:-Node: Top96+Node: Top80 End Tag Table
doc/other/hledger_timeclock.5.txt view
@@ -79,4 +79,4 @@ -hledger 1.1 December 2016 hledger_timeclock(5)+hledger 1.2 March 2017 hledger_timeclock(5)
doc/other/hledger_timedot.5 view
@@ -1,5 +1,5 @@ -.TH "hledger_timedot" "5" "December 2016" "hledger 1.1" "hledger User Manuals"+.TH "hledger_timedot" "5" "March 2017" "hledger 1.2" "hledger User Manuals"
doc/other/hledger_timedot.5.info view
@@ -1,24 +1,23 @@-This is hledger-lib/doc/hledger_timedot.5.info, produced by makeinfo-version 4.8 from stdin.+This is hledger_timedot.5.info, produced by makeinfo version 6.0 from+stdin. -File: hledger_timedot.5.info, Node: Top, Up: (dir)+File: hledger_timedot.5.info, Node: Top, Next: FILE FORMAT, Up: (dir) -hledger_timedot(5) hledger 1.1+hledger_timedot(5) hledger 1.2 ****************************** Timedot is a plain text format for logging dated, categorised quantities-(eg time), supported by hledger. It is convenient for approximate and+(eg time), 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+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. Though called "timedot", the format does not specify the commodity-being logged, so could represent other dated, quantifiable things. Eg+being logged, so could represent other dated, quantifiable things. Eg you could record a single-entry journal of financial transactions, perhaps slightly more conveniently than with hledger_journal(5) format.- * Menu: * FILE FORMAT::@@ -29,26 +28,24 @@ 1 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)). Categories are-hledger-style account names, optionally indented. There must be at least-two spaces between the category and the quantity. Quantities can be-written in two ways:+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. There+must be at least two spaces between the category and the quantity.+Quantities can be written in two ways: - 1. a series of dots (period characters). Each dot represents "a- quarter" - eg, a quarter hour. Spaces can be used to group dots+ 1. a series of dots (period characters). Each dot represents "a+ quarter" - eg, a quarter hour. Spaces can be used to group dots into hours, for easier counting. - 2. a number (integer or decimal), representing "units" - eg, hours. A- good alternative when dots are cumbersome. (A number also can+ 2. a number (integer or decimal), representing "units" - eg, hours. A+ good alternative when dots are cumbersome. (A number also can record negative quantities.) -- Blank lines and lines beginning with #, ; or * are ignored. An+ Blank lines and lines beginning with #, ; or * are ignored. An example: - # on this day, 6h was spent on client work, 1.5h on haskell FOSS work, etc. 2016/2/1 inc:client1 .... .... .... .... .... ....@@ -61,7 +58,6 @@ Or with numbers: - 2016/2/3 inc:client1 4 fos:hledger 3@@ -69,7 +65,6 @@ Reporting: - $ hledger -f t.timedot print date:2016/2/2 2016/02/02 * (inc:client1) 2.00@@ -77,7 +72,6 @@ 2016/02/02 * (biz:research) 0.25 - $ hledger -f t.timedot bal --daily --tree Balance changes in 2016/02/01-2016/02/03: @@ -93,15 +87,13 @@ ------------++---------------------------------------- || 7.75 2.25 8.00 - I prefer to use period for separating account components. We can make-this work with an account alias:-+ I prefer to use period for separating account components. We can+make this work with an account alias: 2016/2/4 fos.hledger.timedot 4 fos.ledger .. - $ hledger -f t.timedot --alias /\\./=: bal date:2016/2/4 4.50 fos 4.00 hledger:timedot@@ -111,11 +103,10 @@ Here is a sample.timedot. - Tag Table:-Node: Top94-Node: FILE FORMAT876-Ref: #file-format979+Node: Top78+Node: FILE FORMAT882+Ref: #file-format985 End Tag Table
doc/other/hledger_timedot.5.txt view
@@ -120,4 +120,4 @@ -hledger 1.1 December 2016 hledger_timedot(5)+hledger 1.2 March 2017 hledger_timedot(5)
hledger.cabal view
@@ -1,11 +1,9 @@--- This file has been generated from package.yaml by hpack version 0.15.0.+-- This file has been generated from package.yaml by hpack version 0.17.0. -- -- see: https://github.com/sol/hpack name: hledger-version: 1.1-stability: stable-category: Finance, Console+version: 1.2 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@@ -17,15 +15,17 @@ with ledger(1). hledger provides command-line, curses and web interfaces, and aims to be a reliable, practical tool for daily use.-license: GPL-license-file: LICENSE-author: Simon Michael <simon@joyful.com>-maintainer: Simon Michael <simon@joyful.com>+category: Finance, Console+stability: stable homepage: http://hledger.org bug-reports: http://bugs.hledger.org-cabal-version: >= 1.10-build-type: Simple+author: Simon Michael <simon@joyful.com>+maintainer: Simon Michael <simon@joyful.com>+license: GPL-3+license-file: LICENSE tested-with: GHC==7.10.3, GHC==8.0+build-type: Simple+cabal-version: >= 1.10 extra-source-files: bench/10000x1000x10.journal@@ -74,24 +74,25 @@ default: True flag threaded- default: True description: Build with support for multithreaded execution manual: False+ default: True library ghc-options: -Wall -fno-warn-unused-do-bind -fno-warn-name-shadowing -fno-warn-missing-signatures -fno-warn-type-defaults -fno-warn-orphans- cpp-options: -DVERSION="1.1"+ cpp-options: -DVERSION="1.2" build-depends: base >=4.8 && <5 , base-compat >=0.8.1 , directory , file-embed >=0.0.10 && <0.1 , filepath+ , here , pretty-show >=1.6.4 , process , temporary , tabular >=0.2 && <0.3- , hledger-lib >= 1.1 && < 1.2+ , hledger-lib >= 1.2 && < 1.3 , bytestring , containers , unordered-containers@@ -104,7 +105,7 @@ , mtl , mtl-compat , old-time- , megaparsec >=5.0 && < 5.2+ , megaparsec >=5.0 && < 5.3 , regex-tdfa , safe >=0.2 , split >=0.1 && <0.3@@ -144,6 +145,7 @@ Hledger.Cli.Accounts Hledger.Cli.Balance Hledger.Cli.Balancesheet+ Hledger.Cli.BalanceView Hledger.Cli.Cashflow Hledger.Cli.Help Hledger.Cli.Histogram@@ -163,19 +165,20 @@ 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- cpp-options: -DVERSION="1.1"+ cpp-options: -DVERSION="1.2" build-depends: base >=4.8 && <5 , base-compat >=0.8.1 , directory , file-embed >=0.0.10 && <0.1 , filepath+ , here , pretty-show >=1.6.4 , process , temporary , tabular >=0.2 && <0.3- , hledger-lib >= 1.1 && < 1.2- , hledger == 1.1+ , hledger-lib >= 1.2 && < 1.3+ , hledger == 1.2 , bytestring , containers , unordered-containers@@ -224,19 +227,20 @@ 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- cpp-options: -DVERSION="1.1"+ cpp-options: -DVERSION="1.2" build-depends: base >=4.8 && <5 , base-compat >=0.8.1 , directory , file-embed >=0.0.10 && <0.1 , filepath+ , here , pretty-show >=1.6.4 , process , temporary , tabular >=0.2 && <0.3- , hledger-lib >= 1.1 && < 1.2- , hledger == 1.1+ , hledger-lib >= 1.2 && < 1.3+ , hledger == 1.2 , bytestring , containers , unordered-containers@@ -281,23 +285,23 @@ benchmark bench type: exitcode-stdio-1.0+ main-is: bench.hs hs-source-dirs: bench- main-is: bench.hs ghc-options: -Wall -fno-warn-unused-do-bind -fno-warn-name-shadowing -fno-warn-missing-signatures -fno-warn-type-defaults -fno-warn-orphans- default-language: Haskell2010 build-depends: base >=4.8 && <5 , base-compat >=0.8.1 , directory , file-embed >=0.0.10 && <0.1 , filepath+ , here , pretty-show >=1.6.4 , process , temporary , tabular >=0.2 && <0.3- , hledger-lib >= 1.1 && < 1.2- , hledger == 1.1+ , hledger-lib >= 1.2 && < 1.3+ , hledger == 1.2 , criterion , html , timeit@@ -308,3 +312,4 @@ else build-depends: time >=1.5+ default-language: Haskell2010