From c8246e7323df24a1a6c4b5b196196d0822cd4329 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Wed, 30 Jan 2019 17:55:56 -0800 Subject: [PATCH] cli: command help: reduce width, line wrapping cmdargs wraps any lines longer than 78 characters. To (mostly) avoid this, we now display verbatim blocks unindented, and some of register's examples have been altered to make them fit. --- Makefile | 1 + Shake.hs | 19 +- hledger/Hledger/Cli/Commands.hs | 1 + hledger/Hledger/Cli/Commands/Accounts.txt | 18 +- hledger/Hledger/Cli/Commands/Activity.txt | 10 +- hledger/Hledger/Cli/Commands/Add.md | 1 + hledger/Hledger/Cli/Commands/Add.txt | 60 +-- hledger/Hledger/Cli/Commands/Balance.txt | 408 +++++++++--------- hledger/Hledger/Cli/Commands/Balancesheet.txt | 30 +- .../Cli/Commands/Balancesheetequity.txt | 38 +- hledger/Hledger/Cli/Commands/Cashflow.txt | 22 +- hledger/Hledger/Cli/Commands/Close.txt | 32 +- hledger/Hledger/Cli/Commands/Help.txt | 28 +- hledger/Hledger/Cli/Commands/Import.txt | 2 +- .../Hledger/Cli/Commands/Incomestatement.txt | 34 +- hledger/Hledger/Cli/Commands/Print.txt | 80 ++-- hledger/Hledger/Cli/Commands/Printunique.txt | 18 +- hledger/Hledger/Cli/Commands/Register.md | 52 +-- hledger/Hledger/Cli/Commands/Register.txt | 78 ++-- hledger/Hledger/Cli/Commands/Rewrite.txt | 82 ++-- hledger/Hledger/Cli/Commands/Stats.txt | 22 +- 21 files changed, 526 insertions(+), 510 deletions(-) diff --git a/Makefile b/Makefile index a1eb109e7..059e08a3c 100644 --- a/Makefile +++ b/Makefile @@ -582,6 +582,7 @@ SHAKEDEPS= \ --package base-prelude \ --package directory \ --package extra \ + --package process \ --package safe \ --package shake \ --package time \ diff --git a/Shake.hs b/Shake.hs index b392e2131..6b5b367ef 100755 --- a/Shake.hs +++ b/Shake.hs @@ -20,6 +20,7 @@ compiling is recommended; run the script in interpreted mode to do that. It requires stack (https://haskell-lang.org/get-started) and auto-installs the packages above. Also, some rules require: +- GNU sed - groff - m4 - makeinfo @@ -43,8 +44,10 @@ not having to write :: Action ExitCode after a non-final cmd import Prelude () import "base-prelude" BasePrelude +-- keep imports synced with Makefile -> SHAKEDEPS import "directory" System.Directory as S (getDirectoryContents) import "extra" Data.List.Extra +import "process" System.Process import "safe" Safe import "shake" Development.Shake import "shake" Development.Shake.FilePath @@ -56,6 +59,7 @@ usage = unlines ,"./Shake.hs # compile this script" ,"./Shake manuals # generate the txt/man/info manuals" ,"./Shake website # generate the website and web manuals" + ,"./Shake commandhelp # generate the help text for hledger commands" ,"./Shake PKG # build the specified hledger package, with awareness of embedded docs" ,"./Shake build # build all hledger packages, with awareness of embedded docs" ,"./Shake all # generate everything" @@ -82,6 +86,10 @@ towebmd = "-t markdown-smart-fenced_divs --atx-headers" main = do + -- try to ensure we have a modern sed + sed' <- readCreateProcess (shell "which gsed || which sed") "" + let sed = sed' ++ " -E" + -- hledger manual also includes the markdown files from here: let commandsdir = "hledger/Hledger/Cli/Commands" commandmds <- filter (".md" `isSuffixOf`) . map (commandsdir ) <$> S.getDirectoryContents commandsdir @@ -97,7 +105,7 @@ main = do phony "help" $ liftIO $ putStrLn usage - phony "all" $ need ["manuals", "website", "build"] + phony "all" $ need ["commandhelp", "manuals", "build", "website"] -- phony "compile" $ need ["Shake"] -- "Shake" %> \out -> do @@ -159,7 +167,7 @@ main = do -- manuals rendered to info, ready for info (hledger/hledger.info) infomanuals = [manualDir m m <.> "info" | m <- manualNames] - -- manuals rendered to markdown, ready for conversion to html (site/hledger.md) + -- individual manuals rendered to markdown, ready for conversion to html (site/hledger.md) webmanuals = ["site" manpageNameToUri m <.> "md" | m <- manpageNames] -- website html pages - all manual versions plus misc pages in site/ or copied from elsewhere. @@ -362,13 +370,17 @@ main = do cmd Shell "stack build " pkg | pkg <- packages ] + phony "commandhelp" $ need commandtxts + commandtxts |%> \out -> do let src = out -<.> "md" -- lib = "doc/lib.m4" need [src] cmd Shell -- "m4 -P -DHELP -I" commandsdir lib src "|" - pandoc fromsrcmd src "-t plain" "-o" out + pandoc fromsrcmd src "-t plain" + "|" sed "-e" ["'s/^ //'"] + ">" out -- MISC @@ -387,6 +399,7 @@ main = do phony "clean" $ do putNormal "Cleaning generated files" + removeFilesAfter "." commandtxts removeFilesAfter "." webmanuals removeFilesAfter "." [webmancombined] removeFilesAfter "." ["site/README.md", "site/CONTRIBUTING.md"] diff --git a/hledger/Hledger/Cli/Commands.hs b/hledger/Hledger/Cli/Commands.hs index c577bbd52..acd4d2b8f 100644 --- a/hledger/Hledger/Cli/Commands.hs +++ b/hledger/Hledger/Cli/Commands.hs @@ -189,6 +189,7 @@ Help: help [MANUAL] show hledger manuals in various formats |] +-- commands show brief commands list -- edit open a text editor on some part of the journal -- aregister (ar, areg) show transactions in a single account diff --git a/hledger/Hledger/Cli/Commands/Accounts.txt b/hledger/Hledger/Cli/Commands/Accounts.txt index b8bd68a84..3530770a9 100644 --- a/hledger/Hledger/Cli/Commands/Accounts.txt +++ b/hledger/Hledger/Cli/Commands/Accounts.txt @@ -13,12 +13,12 @@ Account names can be depth-clipped with depth:N or --depth N or -N. Examples: - $ hledger accounts - assets:bank:checking - assets:bank:saving - assets:cash - expenses:food - expenses:supplies - income:gifts - income:salary - liabilities:debts +$ hledger accounts +assets:bank:checking +assets:bank:saving +assets:cash +expenses:food +expenses:supplies +income:gifts +income:salary +liabilities:debts diff --git a/hledger/Hledger/Cli/Commands/Activity.txt b/hledger/Hledger/Cli/Commands/Activity.txt index 818a4a7a5..d520726a5 100644 --- a/hledger/Hledger/Cli/Commands/Activity.txt +++ b/hledger/Hledger/Cli/Commands/Activity.txt @@ -9,8 +9,8 @@ default). With query arguments, it counts only matched transactions. Examples: - $ hledger activity --quarterly - 2008-01-01 ** - 2008-04-01 ******* - 2008-07-01 - 2008-10-01 ** +$ hledger activity --quarterly +2008-01-01 ** +2008-04-01 ******* +2008-07-01 +2008-10-01 ** diff --git a/hledger/Hledger/Cli/Commands/Add.md b/hledger/Hledger/Cli/Commands/Add.md index aab759347..0bb8c469d 100644 --- a/hledger/Hledger/Cli/Commands/Add.md +++ b/hledger/Hledger/Cli/Commands/Add.md @@ -59,3 +59,4 @@ Saved. Starting the next transaction (. or ctrl-D/ctrl-C to quit) Date [2015/05/22]: $ ``` + diff --git a/hledger/Hledger/Cli/Commands/Add.txt b/hledger/Hledger/Cli/Commands/Add.txt index 8e1a7201e..a90ea38a4 100644 --- a/hledger/Hledger/Cli/Commands/Add.txt +++ b/hledger/Hledger/Cli/Commands/Add.txt @@ -18,45 +18,45 @@ control-d or control-c to exit. Features: - add tries to provide useful defaults, using the most similar (by - description) recent transaction (filtered by the query, if any) as a - template. +description) recent transaction (filtered by the query, if any) as a +template. - You can also set the initial defaults with command line arguments. - Readline-style edit keys can be used during data entry. - The tab key will auto-complete whenever possible - accounts, - descriptions, dates (yesterday, today, tomorrow). If the input area - is empty, it will insert the default value. +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. +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. +transaction. - Input prompts are displayed in a different colour when the terminal - supports it. +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 +$ 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]: $ +Save this transaction to the journal ? [y]: +Saved. +Starting the next transaction (. or ctrl-D/ctrl-C to quit) +Date [2015/05/22]: $ diff --git a/hledger/Hledger/Cli/Commands/Balance.txt b/hledger/Hledger/Cli/Commands/Balance.txt index a74283f47..b94e340b2 100644 --- a/hledger/Hledger/Cli/Commands/Balance.txt +++ b/hledger/Hledger/Cli/Commands/Balance.txt @@ -30,19 +30,19 @@ Classic balance report This is the original balance report, as found in Ledger. It usually looks like this: - $ hledger balance - $-1 assets - $1 bank:saving - $-2 cash - $2 expenses - $1 food - $1 supplies - $-2 income - $-1 gifts - $-1 salary - $1 liabilities:debts - -------------------- - 0 +$ hledger balance + $-1 assets + $1 bank:saving + $-2 cash + $2 expenses + $1 food + $1 supplies + $-2 income + $-1 gifts + $-1 salary + $1 liabilities:debts +-------------------- + 0 By default, accounts are displayed hierarchically, with subaccounts indented below their parent. At each level of the tree, accounts are @@ -63,29 +63,29 @@ omitted. Use -E/--empty to show them. A final total is displayed by default; use -N/--no-total to suppress it, eg: - $ hledger balance -p 2008/6 expenses --no-total - $2 expenses - $1 food - $1 supplies +$ hledger balance -p 2008/6 expenses --no-total + $2 expenses + $1 food + $1 supplies Customising the classic balance report You can customise the layout of classic balance reports with --format FMT: - $ hledger balance --format "%20(account) %12(total)" - assets $-1 - bank:saving $1 - cash $-2 - expenses $2 - food $1 - supplies $1 - income $-2 - gifts $-1 - salary $-1 - liabilities:debts $1 - --------------------------------- - 0 +$ 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 @@ -97,10 +97,10 @@ data fields interpolated like so: - 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 +- 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: @@ -117,12 +117,12 @@ 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 +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 +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 +single-column balance report Colour support @@ -139,9 +139,9 @@ names and "exclusive" balance, excluding any subaccount balances. In this mode, you can also use --drop N to omit the first few account name components. - $ hledger balance -p 2008/6 expenses -N --flat --drop 1 - $1 food - $1 supplies +$ hledger balance -p 2008/6 expenses -N --flat --drop 1 + $1 food + $1 supplies Depth limited balance reports @@ -149,11 +149,11 @@ With --depth N or depth:N or just -N, balance reports show accounts only to the specified numeric depth. This is very useful to summarise a complex set of accounts and get an overview. - $ hledger balance -N -1 - $-1 assets - $2 expenses - $-2 income - $1 liabilities +$ hledger balance -N -1 + $-1 assets + $2 expenses + $-2 income + $1 liabilities Flat-mode balance reports, which normally show exclusive balances, show inclusive balances at the depth limit. @@ -169,54 +169,54 @@ There are three types of multicolumn balance report, showing different information: 1. By default: each column shows the sum of postings in that period, ie - the account's change of balance in that period. This is useful eg - for a monthly income statement: +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: + $ 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 + || 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: +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: + $ 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 + || 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: +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: + $ 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 + || 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 Multicolumn balance reports display accounts in flat mode by default; to see the hierarchy, use --tree. @@ -242,21 +242,21 @@ row. Here's an example of all three: - $ hledger balance -Q income expenses --tree -ETA - Balance changes in 2008: +$ 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 + || 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 +# Average is rounded to the dollar here since all journal amounts are Limitations: @@ -278,47 +278,47 @@ a report interval. For example, you can take average monthly expenses in the common expense categories to construct a minimal monthly budget: - ;; Budget - ~ monthly - income $2000 - expenses:food $400 - expenses:bus $50 - expenses:movies $30 - assets:bank:checking +;; Budget +~ monthly + income $2000 + expenses:food $400 + expenses:bus $50 + expenses:movies $30 + assets:bank:checking - ;; Two months worth of expenses - 2017-11-01 - income $1950 - expenses:food $396 - expenses:bus $49 - expenses:movies $30 - expenses:supplies $20 - assets:bank:checking +;; Two months worth of expenses +2017-11-01 + income $1950 + expenses:food $396 + expenses:bus $49 + expenses:movies $30 + expenses:supplies $20 + assets:bank:checking - 2017-12-01 - income $2100 - expenses:food $412 - expenses:bus $53 - expenses:gifts $100 - assets:bank:checking +2017-12-01 + income $2100 + expenses:food $412 + expenses:bus $53 + expenses:gifts $100 + assets:bank:checking You can now see a monthly budget report: - $ hledger balance -M --budget - Budget performance in 2017/11/01-2017/12/31: +$ hledger balance -M --budget +Budget performance in 2017/11/01-2017/12/31: - || Nov Dec - ======================++==================================================== - assets || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] - assets:bank || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] - assets:bank:checking || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] - expenses || $495 [ 103% of $480] $565 [ 118% of $480] - expenses:bus || $49 [ 98% of $50] $53 [ 106% of $50] - expenses:food || $396 [ 99% of $400] $412 [ 103% of $400] - expenses:movies || $30 [ 100% of $30] 0 [ 0% of $30] - income || $1950 [ 98% of $2000] $2100 [ 105% of $2000] - ----------------------++---------------------------------------------------- - || 0 [ 0] 0 [ 0] + || Nov Dec +======================++==================================================== + assets || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] + assets:bank || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] + assets:bank:checking || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] + expenses || $495 [ 103% of $480] $565 [ 118% of $480] + expenses:bus || $49 [ 98% of $50] $53 [ 106% of $50] + expenses:food || $396 [ 99% of $400] $412 [ 103% of $400] + expenses:movies || $30 [ 100% of $30] 0 [ 0% of $30] + income || $1950 [ 98% of $2000] $2100 [ 105% of $2000] +----------------------++---------------------------------------------------- + || 0 [ 0] 0 [ 0] By default, only accounts with budget goals during the report period are shown. In the example above, transactions in expenses:gifts and @@ -328,41 +328,41 @@ any budgets. You can use --empty shows unbudgeted accounts as well: - $ hledger balance -M --budget --empty - Budget performance in 2017/11/01-2017/12/31: +$ hledger balance -M --budget --empty +Budget performance in 2017/11/01-2017/12/31: - || Nov Dec - ======================++==================================================== - assets || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] - assets:bank || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] - assets:bank:checking || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] - expenses || $495 [ 103% of $480] $565 [ 118% of $480] - expenses:bus || $49 [ 98% of $50] $53 [ 106% of $50] - expenses:food || $396 [ 99% of $400] $412 [ 103% of $400] - expenses:gifts || 0 $100 - expenses:movies || $30 [ 100% of $30] 0 [ 0% of $30] - expenses:supplies || $20 0 - income || $1950 [ 98% of $2000] $2100 [ 105% of $2000] - ----------------------++---------------------------------------------------- - || 0 [ 0] 0 [ 0] + || Nov Dec +======================++==================================================== + assets || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] + assets:bank || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] + assets:bank:checking || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] + expenses || $495 [ 103% of $480] $565 [ 118% of $480] + expenses:bus || $49 [ 98% of $50] $53 [ 106% of $50] + expenses:food || $396 [ 99% of $400] $412 [ 103% of $400] + expenses:gifts || 0 $100 + expenses:movies || $30 [ 100% of $30] 0 [ 0% of $30] + expenses:supplies || $20 0 + income || $1950 [ 98% of $2000] $2100 [ 105% of $2000] +----------------------++---------------------------------------------------- + || 0 [ 0] 0 [ 0] You can roll over unspent budgets to next period with --cumulative: - $ hledger balance -M --budget --cumulative - Budget performance in 2017/11/01-2017/12/31: +$ hledger balance -M --budget --cumulative +Budget performance in 2017/11/01-2017/12/31: - || Nov Dec - ======================++==================================================== - assets || $-2445 [ 99% of $-2480] $-5110 [ 103% of $-4960] - assets:bank || $-2445 [ 99% of $-2480] $-5110 [ 103% of $-4960] - assets:bank:checking || $-2445 [ 99% of $-2480] $-5110 [ 103% of $-4960] - expenses || $495 [ 103% of $480] $1060 [ 110% of $960] - expenses:bus || $49 [ 98% of $50] $102 [ 102% of $100] - expenses:food || $396 [ 99% of $400] $808 [ 101% of $800] - expenses:movies || $30 [ 100% of $30] $30 [ 50% of $60] - income || $1950 [ 98% of $2000] $4050 [ 101% of $4000] - ----------------------++---------------------------------------------------- - || 0 [ 0] 0 [ 0] + || Nov Dec +======================++==================================================== + assets || $-2445 [ 99% of $-2480] $-5110 [ 103% of $-4960] + assets:bank || $-2445 [ 99% of $-2480] $-5110 [ 103% of $-4960] + assets:bank:checking || $-2445 [ 99% of $-2480] $-5110 [ 103% of $-4960] + expenses || $495 [ 103% of $480] $1060 [ 110% of $960] + expenses:bus || $49 [ 98% of $50] $102 [ 102% of $100] + expenses:food || $396 [ 99% of $400] $808 [ 101% of $800] + expenses:movies || $30 [ 100% of $30] $30 [ 50% of $60] + income || $1950 [ 98% of $2000] $4050 [ 101% of $4000] +----------------------++---------------------------------------------------- + || 0 [ 0] 0 [ 0] Note, the -S/--sort-amount flag is not yet fully supported with --budget. @@ -381,10 +381,10 @@ account, all its parents would have budget as well. To illustrate this, consider the following budget: - ~ monthly from 2019/01 - expenses:personal $1,000.00 - expenses:personal:electronics $100.00 - liabilities +~ monthly from 2019/01 + expenses:personal $1,000.00 + expenses:personal:electronics $100.00 + liabilities With this, monthly budget for electronics is defined to be $100 and budget for personal expenses is an additional $1000, which implicity @@ -397,26 +397,26 @@ counted towards only towards the budget of expenses:personal. For example, let's consider these transactions: - ~ monthly from 2019/01 - expenses:personal $1,000.00 - expenses:personal:electronics $100.00 - liabilities +~ monthly from 2019/01 + expenses:personal $1,000.00 + expenses:personal:electronics $100.00 + liabilities - 2019/01/01 Google home hub - expenses:personal:electronics $90.00 - liabilities $-90.00 +2019/01/01 Google home hub + expenses:personal:electronics $90.00 + liabilities $-90.00 - 2019/01/02 Phone screen protector - expenses:personal:electronics:upgrades $10.00 - liabilities +2019/01/02 Phone screen protector + expenses:personal:electronics:upgrades $10.00 + liabilities - 2019/01/02 Weekly train ticket - expenses:personal:train tickets $153.00 - liabilities +2019/01/02 Weekly train ticket + expenses:personal:train tickets $153.00 + liabilities - 2019/01/03 Flowers - expenses:personal $30.00 - liabilities +2019/01/03 Flowers + expenses:personal $30.00 + liabilities As you can see, we have transactions in expenses:personal:electronics:upgrades and @@ -425,34 +425,34 @@ without explicitly defined budget, these transactions would be counted towards budgets of expenses:personal:electronics and expenses:personal accordingly: - $ hledger balance --budget -M - Budget performance in 2019/01: +$ hledger balance --budget -M +Budget performance in 2019/01: - || Jan - ===============================++=============================== - expenses || $283.00 [ 26% of $1100.00] - expenses:personal || $283.00 [ 26% of $1100.00] - expenses:personal:electronics || $100.00 [ 100% of $100.00] - liabilities || $-283.00 [ 26% of $-1100.00] - -------------------------------++------------------------------- - || 0 [ 0] + || Jan +===============================++=============================== + expenses || $283.00 [ 26% of $1100.00] + expenses:personal || $283.00 [ 26% of $1100.00] + expenses:personal:electronics || $100.00 [ 100% of $100.00] + liabilities || $-283.00 [ 26% of $-1100.00] +-------------------------------++------------------------------- + || 0 [ 0] And with --empty, we can get a better picture of budget allocation and consumption: - $ hledger balance --budget -M --empty - Budget performance in 2019/01: +$ hledger balance --budget -M --empty +Budget performance in 2019/01: - || Jan - ========================================++=============================== - expenses || $283.00 [ 26% of $1100.00] - expenses:personal || $283.00 [ 26% of $1100.00] - expenses:personal:electronics || $100.00 [ 100% of $100.00] - expenses:personal:electronics:upgrades || $10.00 - expenses:personal:train tickets || $153.00 - liabilities || $-283.00 [ 26% of $-1100.00] - ----------------------------------------++------------------------------- - || 0 [ 0] + || Jan +========================================++=============================== + expenses || $283.00 [ 26% of $1100.00] + expenses:personal || $283.00 [ 26% of $1100.00] + expenses:personal:electronics || $100.00 [ 100% of $100.00] + expenses:personal:electronics:upgrades || $10.00 + expenses:personal:train tickets || $153.00 + liabilities || $-283.00 [ 26% of $-1100.00] +----------------------------------------++------------------------------- + || 0 [ 0] Output format diff --git a/hledger/Hledger/Cli/Commands/Balancesheet.txt b/hledger/Hledger/Cli/Commands/Balancesheet.txt index 68fb235d5..c5bd87bdf 100644 --- a/hledger/Hledger/Cli/Commands/Balancesheet.txt +++ b/hledger/Hledger/Cli/Commands/Balancesheet.txt @@ -12,24 +12,24 @@ _FLAGS_ Example: - $ hledger balancesheet - Balance Sheet +$ hledger balancesheet +Balance Sheet - Assets: - $-1 assets - $1 bank:saving - $-2 cash - -------------------- - $-1 +Assets: + $-1 assets + $1 bank:saving + $-2 cash +-------------------- + $-1 - Liabilities: - $1 liabilities:debts - -------------------- - $1 +Liabilities: + $1 liabilities:debts +-------------------- + $1 - Total: - -------------------- - 0 +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 diff --git a/hledger/Hledger/Cli/Commands/Balancesheetequity.txt b/hledger/Hledger/Cli/Commands/Balancesheetequity.txt index 821b080c3..2a1503bb2 100644 --- a/hledger/Hledger/Cli/Commands/Balancesheetequity.txt +++ b/hledger/Hledger/Cli/Commands/Balancesheetequity.txt @@ -6,26 +6,26 @@ _FLAGS_ Example: - $ hledger balancesheetequity - Balance Sheet With Equity +$ hledger balancesheetequity +Balance Sheet With Equity - Assets: - $-2 assets - $1 bank:saving - $-3 cash - -------------------- - $-2 +Assets: + $-2 assets + $1 bank:saving + $-3 cash +-------------------- + $-2 - Liabilities: - $1 liabilities:debts - -------------------- - $1 +Liabilities: + $1 liabilities:debts +-------------------- + $1 - Equity: - $1 equity:owner - -------------------- - $1 +Equity: + $1 equity:owner +-------------------- + $1 - Total: - -------------------- - 0 +Total: +-------------------- + 0 diff --git a/hledger/Hledger/Cli/Commands/Cashflow.txt b/hledger/Hledger/Cli/Commands/Cashflow.txt index 177a6725d..7e26e0884 100644 --- a/hledger/Hledger/Cli/Commands/Cashflow.txt +++ b/hledger/Hledger/Cli/Commands/Cashflow.txt @@ -10,19 +10,19 @@ _FLAGS_ Example: - $ hledger cashflow - Cashflow Statement +$ hledger cashflow +Cashflow Statement - Cash flows: - $-1 assets - $1 bank:saving - $-2 cash - -------------------- - $-1 +Cash flows: + $-1 assets + $1 bank:saving + $-2 cash +-------------------- + $-1 - Total: - -------------------- - $-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, diff --git a/hledger/Hledger/Cli/Commands/Close.txt b/hledger/Hledger/Cli/Commands/Close.txt index 67546d73c..ef63cf4d3 100644 --- a/hledger/Hledger/Cli/Commands/Close.txt +++ b/hledger/Hledger/Cli/Commands/Close.txt @@ -49,30 +49,30 @@ command line: _Warning: we use >> here to append; be careful not to type a single > which would wipe your journal!_ - $ hledger close -f 2018.journal -e 2019 assets liabilities --opening >>2019.journal - $ hledger close -f 2018.journal -e 2019 assets liabilities --closing >>2018.journal +$ hledger close -f 2018.journal -e 2019 assets liabilities --opening >>2019.journal +$ hledger close -f 2018.journal -e 2019 assets liabilities --closing >>2018.journal Now: - $ hledger bs -f 2019.journal # one file - balances are correct - $ hledger bs -f 2018.journal -f 2019.journal # two files - balances still correct - $ hledger bs -f 2018.journal not:desc:closing # to see year-end balances, must exclude closing txn +$ hledger bs -f 2019.journal # one file - balances are correct +$ hledger bs -f 2018.journal -f 2019.journal # two files - balances still correct +$ hledger bs -f 2018.journal not:desc:closing # to see year-end balances, must exclude closing txn Transactions spanning the closing date can complicate matters, breaking balance assertions: - 2018/12/30 a purchase made in 2018, clearing the following year - expenses:food 5 - assets:bank:checking -5 ; [2019/1/2] +2018/12/30 a purchase made in 2018, clearing the following year + expenses:food 5 + assets:bank:checking -5 ; [2019/1/2] Here's one way to resolve that: - ; in 2018.journal: - 2018/12/30 a purchase made in 2018, clearing the following year - expenses:food 5 - liabilities:pending +; in 2018.journal: +2018/12/30 a purchase made in 2018, clearing the following year + expenses:food 5 + liabilities:pending - ; in 2019.journal: - 2019/1/2 clearance of last year's pending transactions - liabilities:pending 5 = 0 - assets:checking +; in 2019.journal: +2019/1/2 clearance of last year's pending transactions + liabilities:pending 5 = 0 + assets:checking diff --git a/hledger/Hledger/Cli/Commands/Help.txt b/hledger/Hledger/Cli/Commands/Help.txt index 35271cd6e..1c116c678 100644 --- a/hledger/Hledger/Cli/Commands/Help.txt +++ b/hledger/Hledger/Cli/Commands/Help.txt @@ -14,22 +14,22 @@ particular viewer with the --info, --man, --pager, --cat flags. Examples: - $ hledger help - Please choose a manual by typing "hledger help MANUAL" (a substring is ok). - Manuals: hledger hledger-ui hledger-web hledger-api journal csv timeclock timedot +$ hledger help +Please choose a manual by typing "hledger help MANUAL" (a substring is ok). +Manuals: hledger hledger-ui hledger-web hledger-api journal csv timeclock timedot - $ hledger help h --man +$ hledger help h --man - hledger(1) hledger User Manuals hledger(1) +hledger(1) hledger User Manuals hledger(1) - NAME - hledger - a command-line accounting tool +NAME + hledger - a command-line accounting tool - SYNOPSIS - hledger [-f FILE] COMMAND [OPTIONS] [ARGS] - hledger [-f FILE] ADDONCMD -- [OPTIONS] [ARGS] - hledger +SYNOPSIS + hledger [-f FILE] COMMAND [OPTIONS] [ARGS] + hledger [-f FILE] ADDONCMD -- [OPTIONS] [ARGS] + hledger - DESCRIPTION - hledger is a cross-platform program for tracking money, time, or any - ... +DESCRIPTION + hledger is a cross-platform program for tracking money, time, or any +... diff --git a/hledger/Hledger/Cli/Commands/Import.txt b/hledger/Hledger/Cli/Commands/Import.txt index 1fa99f039..bb7f8a930 100644 --- a/hledger/Hledger/Cli/Commands/Import.txt +++ b/hledger/Hledger/Cli/Commands/Import.txt @@ -16,4 +16,4 @@ date order, and by saving .latest.FILE state files. The --dry-run output is in journal format, so you can filter it, eg to see only uncategorised transactions: - $ hledger import --dry ... | hledger -f- print unknown --ignore-assertions +$ hledger import --dry ... | hledger -f- print unknown --ignore-assertions diff --git a/hledger/Hledger/Cli/Commands/Incomestatement.txt b/hledger/Hledger/Cli/Commands/Incomestatement.txt index 6fa3afc55..c220e0b20 100644 --- a/hledger/Hledger/Cli/Commands/Incomestatement.txt +++ b/hledger/Hledger/Cli/Commands/Incomestatement.txt @@ -12,26 +12,26 @@ 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 +$ hledger incomestatement +Income Statement - Revenues: - $-2 income - $-1 gifts - $-1 salary - -------------------- - $-2 +Revenues: + $-2 income + $-1 gifts + $-1 salary +-------------------- + $-2 - Expenses: - $2 expenses - $1 food - $1 supplies - -------------------- - $2 +Expenses: + $2 expenses + $1 food + $1 supplies +-------------------- + $2 - Total: - -------------------- - 0 +Total: +-------------------- + 0 With a reporting interval, multiple columns will be shown, one for each report period. Normally incomestatement shows revenues/expenses per diff --git a/hledger/Hledger/Cli/Commands/Print.txt b/hledger/Hledger/Cli/Commands/Print.txt index cb2205efb..db13e447c 100644 --- a/hledger/Hledger/Cli/Commands/Print.txt +++ b/hledger/Hledger/Cli/Commands/Print.txt @@ -11,27 +11,27 @@ print's output is always a valid hledger journal. It preserves all transaction information, but it does not preserve directives or inter-transaction comments - $ hledger print - 2008/01/01 income - assets:bank:checking $1 - income:salary $-1 +$ 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/01 gift + assets:bank:checking $1 + income:gifts $-1 - 2008/06/02 save - assets:bank:saving $1 - assets:bank:checking $-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/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 +2008/12/31 * pay off + liabilities:debts $1 + assets:bank:checking $-1 Normally, the journal entry's explicit or implicit amount style is preserved. Ie when an amount is omitted in the journal, it will be @@ -58,8 +58,8 @@ transactions on the latest date) are printed. This is useful for ignoring already-seen entries in import data, such as downloaded CSV files. Eg: - $ hledger -f bank1.csv print --new - # shows transactions added since last print --new on this file +$ hledger -f bank1.csv print --new +# shows transactions added since last print --new on this file This assumes that transactions added to FILE always have same or increasing dates, and that transactions on the same day do not get @@ -68,29 +68,29 @@ reordered. See also the import command. This command also supports output destination and output format selection. Here's an example of print's CSV output: - $ hledger print -Ocsv - "txnidx","date","date2","status","code","description","comment","account","amount","commodity","credit","debit","posting-status","posting-comment" - "1","2008/01/01","","","","income","","assets:bank:checking","1","$","","1","","" - "1","2008/01/01","","","","income","","income:salary","-1","$","1","","","" - "2","2008/06/01","","","","gift","","assets:bank:checking","1","$","","1","","" - "2","2008/06/01","","","","gift","","income:gifts","-1","$","1","","","" - "3","2008/06/02","","","","save","","assets:bank:saving","1","$","","1","","" - "3","2008/06/02","","","","save","","assets:bank:checking","-1","$","1","","","" - "4","2008/06/03","","*","","eat & shop","","expenses:food","1","$","","1","","" - "4","2008/06/03","","*","","eat & shop","","expenses:supplies","1","$","","1","","" - "4","2008/06/03","","*","","eat & shop","","assets:cash","-2","$","2","","","" - "5","2008/12/31","","*","","pay off","","liabilities:debts","1","$","","1","","" - "5","2008/12/31","","*","","pay off","","assets:bank:checking","-1","$","1","","","" +$ 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. +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.) +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. +(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.) +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.) diff --git a/hledger/Hledger/Cli/Commands/Printunique.txt b/hledger/Hledger/Cli/Commands/Printunique.txt index 498e38ad7..e4315295e 100644 --- a/hledger/Hledger/Cli/Commands/Printunique.txt +++ b/hledger/Hledger/Cli/Commands/Printunique.txt @@ -5,12 +5,12 @@ _FLAGS_ Example: - $ cat unique.journal - 1/1 test - (acct:one) 1 - 2/2 test - (acct:two) 2 - $ LEDGER_FILE=unique.journal hledger print-unique - (-f option not supported) - 2015/01/01 test - (acct:one) 1 +$ 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 diff --git a/hledger/Hledger/Cli/Commands/Register.md b/hledger/Hledger/Cli/Commands/Register.md index 7ddfac203..01f67c814 100644 --- a/hledger/Hledger/Cli/Commands/Register.md +++ b/hledger/Hledger/Cli/Commands/Register.md @@ -10,10 +10,10 @@ account's activity: ```shell $ 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 +2008/01/01 income assets:bank:checking $1 $1 +2008/06/01 gift assets:bank:checking $1 $2 +2008/06/02 save assets:bank:checking $-1 $1 +2008/12/31 pay off assets:bank:checking $-1 0 ``` With --date2, it shows and sorts by secondary date instead. @@ -24,9 +24,9 @@ see only recent activity, with a historically accurate running balance: ```shell $ 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 +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. @@ -45,26 +45,26 @@ summary postings, one per interval, aggregating the postings to each account: ```shell $ hledger register --monthly income -2008/01 income:salary $-1 $-1 -2008/06 income:gifts $-1 $-2 +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: ```shell $ 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 +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. @@ -72,9 +72,9 @@ The `--depth` option helps with this, causing subaccounts to be aggregated: ```shell $ hledger register --monthly assets --depth 1h -2008/01 assets $1 $1 -2008/06 assets $-1 0 -2008/12 assets $-1 $-1 +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 @@ -91,7 +91,7 @@ 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,D` . Here's a diagram (won't display correctly in --help): ``` <--------------------------------- width (W) ----------------------------------> date (10) description (D) account (W-41-D) amount (12) balance (12) @@ -104,7 +104,7 @@ $ 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 +$ hledger reg -w $COLUMNS,40 # use terminal width, & description width 40 ``` This command also supports diff --git a/hledger/Hledger/Cli/Commands/Register.txt b/hledger/Hledger/Cli/Commands/Register.txt index 1e42e9300..1e945af0d 100644 --- a/hledger/Hledger/Cli/Commands/Register.txt +++ b/hledger/Hledger/Cli/Commands/Register.txt @@ -7,11 +7,11 @@ The register command displays postings in date order, one per line, and their running total. This is typically used with a query selecting a particular account, to see that account's activity: - $ hledger register checking - 2008/01/01 income assets:bank:checking $1 $1 - 2008/06/01 gift assets:bank:checking $1 $2 - 2008/06/02 save assets:bank:checking $-1 $1 - 2008/12/31 pay off assets:bank:checking $-1 0 +$ hledger register checking +2008/01/01 income assets:bank:checking $1 $1 +2008/06/01 gift assets:bank:checking $1 $2 +2008/06/02 save assets:bank:checking $-1 $1 +2008/12/31 pay off assets:bank:checking $-1 0 With --date2, it shows and sorts by secondary date instead. @@ -19,10 +19,10 @@ 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 +$ 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. @@ -38,34 +38,34 @@ 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 +$ 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 +$ 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 +$ 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 @@ -81,20 +81,20 @@ 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,D . Here's a diagram (won't display correctly in --help): - <--------------------------------- width (W) ----------------------------------> - date (10) description (D) account (W-41-D) amount (12) balance (12) - DDDDDDDDDD dddddddddddddddddddd aaaaaaaaaaaaaaaaaaa AAAAAAAAAAAA AAAAAAAAAAAA +<--------------------------------- 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 +$ hledger reg # use terminal width (or 80 on windows) +$ hledger reg -w 100 # use width 100 +$ COLUMNS=100 hledger reg # set with one-time environment variable +$ export COLUMNS=100; hledger reg # set till session end (or window resize) +$ hledger reg -w 100,40 # set overall width 100, description width 40 +$ hledger reg -w $COLUMNS,40 # use terminal width, & description width 40 This command also supports output destination and output format selection. diff --git a/hledger/Hledger/Cli/Commands/Rewrite.txt b/hledger/Hledger/Cli/Commands/Rewrite.txt index 0e5e94162..5bd638eb6 100644 --- a/hledger/Hledger/Cli/Commands/Rewrite.txt +++ b/hledger/Hledger/Cli/Commands/Rewrite.txt @@ -13,26 +13,26 @@ transaction's first posting amount. Examples: - hledger-rewrite.hs ^income --add-posting '(liabilities:tax) *.33 ; income tax' --add-posting '(reserve:gifts) $100' - hledger-rewrite.hs expenses:gifts --add-posting '(reserve:gifts) *-1"' - hledger-rewrite.hs -f rewrites.hledger +hledger-rewrite.hs ^income --add-posting '(liabilities:tax) *.33 ; income tax' --add-posting '(reserve:gifts) $100' +hledger-rewrite.hs expenses:gifts --add-posting '(reserve:gifts) *-1"' +hledger-rewrite.hs -f rewrites.hledger rewrites.hledger may consist of entries like: - = ^income amt:<0 date:2017 - (liabilities:tax) *0.33 ; tax on income - (reserve:grocery) *0.25 ; reserve 25% for grocery - (reserve:) *0.25 ; reserve 25% for grocery += ^income amt:<0 date:2017 + (liabilities:tax) *0.33 ; tax on income + (reserve:grocery) *0.25 ; reserve 25% for grocery + (reserve:) *0.25 ; reserve 25% for grocery Note the single quotes to protect the dollar sign from bash, and the two spaces between account and amount. More: - $ hledger rewrite -- [QUERY] --add-posting "ACCT AMTEXPR" ... - $ hledger rewrite -- ^income --add-posting '(liabilities:tax) *.33' - $ hledger rewrite -- expenses:gifts --add-posting '(budget:gifts) *-1"' - $ hledger rewrite -- ^income --add-posting '(budget:foreign currency) *0.25 JPY; diversify' +$ hledger rewrite -- [QUERY] --add-posting "ACCT AMTEXPR" ... +$ hledger rewrite -- ^income --add-posting '(liabilities:tax) *.33' +$ hledger rewrite -- expenses:gifts --add-posting '(budget:gifts) *-1"' +$ hledger rewrite -- ^income --add-posting '(budget:foreign currency) *0.25 JPY; diversify' Argument for --add-posting option is a usual posting of transaction with an exception for amount specification. More precisely, you can use '*' @@ -47,29 +47,29 @@ During the run this tool will execute so called "Automated Transactions" found in any journal it process. I.e instead of specifying this operations in command line you can put them in a journal file. - $ rewrite-rules.journal +$ rewrite-rules.journal Make contents look like this: - = ^income - (liabilities:tax) *.33 += ^income + (liabilities:tax) *.33 - = expenses:gifts - budget:gifts *-1 - assets:budget *1 += expenses:gifts + budget:gifts *-1 + assets:budget *1 Note that '=' (equality symbol) that is used instead of date in transactions you usually write. It indicates the query by which you want to match the posting to add new ones. - $ hledger rewrite -- -f input.journal -f rewrite-rules.journal > rewritten-tidy-output.journal +$ hledger rewrite -- -f input.journal -f rewrite-rules.journal > rewritten-tidy-output.journal This is something similar to the commands pipeline: - $ hledger rewrite -- -f input.journal '^income' --add-posting '(liabilities:tax) *.33' \ - | hledger rewrite -- -f - expenses:gifts --add-posting 'budget:gifts *-1' \ - --add-posting 'assets:budget *1' \ - > rewritten-tidy-output.journal +$ hledger rewrite -- -f input.journal '^income' --add-posting '(liabilities:tax) *.33' \ + | hledger rewrite -- -f - expenses:gifts --add-posting 'budget:gifts *-1' \ + --add-posting 'assets:budget *1' \ + > rewritten-tidy-output.journal It is important to understand that relative order of such entries in journal is important. You can re-use result of previously added @@ -80,24 +80,24 @@ Diff output format To use this tool for batch modification of your journal files you may find useful output in form of unified diff. - $ hledger rewrite -- --diff -f examples/sample.journal '^income' --add-posting '(liabilities:tax) *.33' +$ hledger rewrite -- --diff -f examples/sample.journal '^income' --add-posting '(liabilities:tax) *.33' Output might look like: - --- /tmp/examples/sample.journal - +++ /tmp/examples/sample.journal - @@ -18,3 +18,4 @@ - 2008/01/01 income - - assets:bank:checking $1 - + assets:bank:checking $1 - income:salary - + (liabilities:tax) 0 - @@ -22,3 +23,4 @@ - 2008/06/01 gift - - assets:bank:checking $1 - + assets:bank:checking $1 - income:gifts - + (liabilities:tax) 0 +--- /tmp/examples/sample.journal ++++ /tmp/examples/sample.journal +@@ -18,3 +18,4 @@ + 2008/01/01 income +- assets:bank:checking $1 ++ assets:bank:checking $1 + income:salary ++ (liabilities:tax) 0 +@@ -22,3 +23,4 @@ + 2008/06/01 gift +- assets:bank:checking $1 ++ assets:bank:checking $1 + income:gifts ++ (liabilities:tax) 0 If you'll pass this through patch tool you'll get transactions containing the posting that matches your query be updated. Note that @@ -118,11 +118,11 @@ This command predates print --auto, and currently does much the same thing, but with these differences: - with multiple files, rewrite lets rules in any file affect all other - files. print --auto uses standard directive scoping; rules affect - only child files. +files. print --auto uses standard directive scoping; rules affect +only child files. - rewrite's query limits which transactions can be rewritten; all are - printed. print --auto's query limits which transactions are printed. +printed. print --auto's query limits which transactions are printed. - rewrite applies rules specified on command line or in the journal. - print --auto applies rules specified in the journal. +print --auto applies rules specified in the journal. diff --git a/hledger/Hledger/Cli/Commands/Stats.txt b/hledger/Hledger/Cli/Commands/Stats.txt index 4443212eb..f97ef0c7a 100644 --- a/hledger/Hledger/Cli/Commands/Stats.txt +++ b/hledger/Hledger/Cli/Commands/Stats.txt @@ -9,17 +9,17 @@ each report period. Example: - $ hledger stats - Main journal file : /src/hledger/examples/sample.journal - Included journal files : - Transactions span : 2008-01-01 to 2009-01-01 (366 days) - Last transaction : 2008-12-31 (2333 days ago) - Transactions : 5 (0.0 per day) - Transactions last 30 days: 0 (0.0 per day) - Transactions last 7 days : 0 (0.0 per day) - Payees/descriptions : 5 - Accounts : 8 (depth 3) - Commodities : 1 ($) +$ 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 ($) This command also supports output destination and output format selection.