mirror of
https://github.com/simonmichael/hledger.git
synced 2024-09-18 17:57:11 +03:00
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.
This commit is contained in:
parent
36246e4976
commit
c8246e7323
1
Makefile
1
Makefile
@ -582,6 +582,7 @@ SHAKEDEPS= \
|
|||||||
--package base-prelude \
|
--package base-prelude \
|
||||||
--package directory \
|
--package directory \
|
||||||
--package extra \
|
--package extra \
|
||||||
|
--package process \
|
||||||
--package safe \
|
--package safe \
|
||||||
--package shake \
|
--package shake \
|
||||||
--package time \
|
--package time \
|
||||||
|
19
Shake.hs
19
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
|
It requires stack (https://haskell-lang.org/get-started) and
|
||||||
auto-installs the packages above. Also, some rules require:
|
auto-installs the packages above. Also, some rules require:
|
||||||
|
|
||||||
|
- GNU sed
|
||||||
- groff
|
- groff
|
||||||
- m4
|
- m4
|
||||||
- makeinfo
|
- makeinfo
|
||||||
@ -43,8 +44,10 @@ not having to write :: Action ExitCode after a non-final cmd
|
|||||||
|
|
||||||
import Prelude ()
|
import Prelude ()
|
||||||
import "base-prelude" BasePrelude
|
import "base-prelude" BasePrelude
|
||||||
|
-- keep imports synced with Makefile -> SHAKEDEPS
|
||||||
import "directory" System.Directory as S (getDirectoryContents)
|
import "directory" System.Directory as S (getDirectoryContents)
|
||||||
import "extra" Data.List.Extra
|
import "extra" Data.List.Extra
|
||||||
|
import "process" System.Process
|
||||||
import "safe" Safe
|
import "safe" Safe
|
||||||
import "shake" Development.Shake
|
import "shake" Development.Shake
|
||||||
import "shake" Development.Shake.FilePath
|
import "shake" Development.Shake.FilePath
|
||||||
@ -56,6 +59,7 @@ usage = unlines
|
|||||||
,"./Shake.hs # compile this script"
|
,"./Shake.hs # compile this script"
|
||||||
,"./Shake manuals # generate the txt/man/info manuals"
|
,"./Shake manuals # generate the txt/man/info manuals"
|
||||||
,"./Shake website # generate the website and web 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 PKG # build the specified hledger package, with awareness of embedded docs"
|
||||||
,"./Shake build # build all hledger packages, with awareness of embedded docs"
|
,"./Shake build # build all hledger packages, with awareness of embedded docs"
|
||||||
,"./Shake all # generate everything"
|
,"./Shake all # generate everything"
|
||||||
@ -82,6 +86,10 @@ towebmd = "-t markdown-smart-fenced_divs --atx-headers"
|
|||||||
|
|
||||||
main = do
|
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:
|
-- hledger manual also includes the markdown files from here:
|
||||||
let commandsdir = "hledger/Hledger/Cli/Commands"
|
let commandsdir = "hledger/Hledger/Cli/Commands"
|
||||||
commandmds <- filter (".md" `isSuffixOf`) . map (commandsdir </>) <$> S.getDirectoryContents commandsdir
|
commandmds <- filter (".md" `isSuffixOf`) . map (commandsdir </>) <$> S.getDirectoryContents commandsdir
|
||||||
@ -97,7 +105,7 @@ main = do
|
|||||||
|
|
||||||
phony "help" $ liftIO $ putStrLn usage
|
phony "help" $ liftIO $ putStrLn usage
|
||||||
|
|
||||||
phony "all" $ need ["manuals", "website", "build"]
|
phony "all" $ need ["commandhelp", "manuals", "build", "website"]
|
||||||
|
|
||||||
-- phony "compile" $ need ["Shake"]
|
-- phony "compile" $ need ["Shake"]
|
||||||
-- "Shake" %> \out -> do
|
-- "Shake" %> \out -> do
|
||||||
@ -159,7 +167,7 @@ main = do
|
|||||||
-- manuals rendered to info, ready for info (hledger/hledger.info)
|
-- manuals rendered to info, ready for info (hledger/hledger.info)
|
||||||
infomanuals = [manualDir m </> m <.> "info" | m <- manualNames]
|
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]
|
webmanuals = ["site" </> manpageNameToUri m <.> "md" | m <- manpageNames]
|
||||||
|
|
||||||
-- website html pages - all manual versions plus misc pages in site/ or copied from elsewhere.
|
-- 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
|
cmd Shell "stack build " pkg
|
||||||
| pkg <- packages ]
|
| pkg <- packages ]
|
||||||
|
|
||||||
|
phony "commandhelp" $ need commandtxts
|
||||||
|
|
||||||
commandtxts |%> \out -> do
|
commandtxts |%> \out -> do
|
||||||
let src = out -<.> "md"
|
let src = out -<.> "md"
|
||||||
-- lib = "doc/lib.m4"
|
-- lib = "doc/lib.m4"
|
||||||
need [src]
|
need [src]
|
||||||
cmd Shell
|
cmd Shell
|
||||||
-- "m4 -P -DHELP -I" commandsdir lib src "|"
|
-- "m4 -P -DHELP -I" commandsdir lib src "|"
|
||||||
pandoc fromsrcmd src "-t plain" "-o" out
|
pandoc fromsrcmd src "-t plain"
|
||||||
|
"|" sed "-e" ["'s/^ //'"]
|
||||||
|
">" out
|
||||||
|
|
||||||
-- MISC
|
-- MISC
|
||||||
|
|
||||||
@ -387,6 +399,7 @@ main = do
|
|||||||
|
|
||||||
phony "clean" $ do
|
phony "clean" $ do
|
||||||
putNormal "Cleaning generated files"
|
putNormal "Cleaning generated files"
|
||||||
|
removeFilesAfter "." commandtxts
|
||||||
removeFilesAfter "." webmanuals
|
removeFilesAfter "." webmanuals
|
||||||
removeFilesAfter "." [webmancombined]
|
removeFilesAfter "." [webmancombined]
|
||||||
removeFilesAfter "." ["site/README.md", "site/CONTRIBUTING.md"]
|
removeFilesAfter "." ["site/README.md", "site/CONTRIBUTING.md"]
|
||||||
|
@ -189,6 +189,7 @@ Help:
|
|||||||
help [MANUAL] show hledger manuals in various formats
|
help [MANUAL] show hledger manuals in various formats
|
||||||
|
|
||||||
|]
|
|]
|
||||||
|
-- commands show brief commands list
|
||||||
-- edit open a text editor on some part of the journal
|
-- edit open a text editor on some part of the journal
|
||||||
-- aregister (ar, areg) show transactions in a single account
|
-- aregister (ar, areg) show transactions in a single account
|
||||||
|
|
||||||
|
@ -13,12 +13,12 @@ Account names can be depth-clipped with depth:N or --depth N or -N.
|
|||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
$ hledger accounts
|
$ hledger accounts
|
||||||
assets:bank:checking
|
assets:bank:checking
|
||||||
assets:bank:saving
|
assets:bank:saving
|
||||||
assets:cash
|
assets:cash
|
||||||
expenses:food
|
expenses:food
|
||||||
expenses:supplies
|
expenses:supplies
|
||||||
income:gifts
|
income:gifts
|
||||||
income:salary
|
income:salary
|
||||||
liabilities:debts
|
liabilities:debts
|
||||||
|
@ -9,8 +9,8 @@ default). With query arguments, it counts only matched transactions.
|
|||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
$ hledger activity --quarterly
|
$ hledger activity --quarterly
|
||||||
2008-01-01 **
|
2008-01-01 **
|
||||||
2008-04-01 *******
|
2008-04-01 *******
|
||||||
2008-07-01
|
2008-07-01
|
||||||
2008-10-01 **
|
2008-10-01 **
|
||||||
|
@ -59,3 +59,4 @@ Saved.
|
|||||||
Starting the next transaction (. or ctrl-D/ctrl-C to quit)
|
Starting the next transaction (. or ctrl-D/ctrl-C to quit)
|
||||||
Date [2015/05/22]: <CTRL-D> $
|
Date [2015/05/22]: <CTRL-D> $
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -18,45 +18,45 @@ control-d or control-c to exit.
|
|||||||
Features:
|
Features:
|
||||||
|
|
||||||
- add tries to provide useful defaults, using the most similar (by
|
- add tries to provide useful defaults, using the most similar (by
|
||||||
description) recent transaction (filtered by the query, if any) as a
|
description) recent transaction (filtered by the query, if any) as a
|
||||||
template.
|
template.
|
||||||
- You can also set the initial defaults with command line arguments.
|
- You can also set the initial defaults with command line arguments.
|
||||||
- Readline-style edit keys can be used during data entry.
|
- Readline-style edit keys can be used during data entry.
|
||||||
- The tab key will auto-complete whenever possible - accounts,
|
- The tab key will auto-complete whenever possible - accounts,
|
||||||
descriptions, dates (yesterday, today, tomorrow). If the input area
|
descriptions, dates (yesterday, today, tomorrow). If the input area
|
||||||
is empty, it will insert the default value.
|
is empty, it will insert the default value.
|
||||||
- If the journal defines a default commodity, it will be added to any
|
- 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.
|
- A parenthesised transaction code may be entered following a date.
|
||||||
- Comments and tags may be entered following a description or amount.
|
- Comments and tags may be entered following a description or amount.
|
||||||
- If you make a mistake, enter < at any prompt to restart the
|
- 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
|
- Input prompts are displayed in a different colour when the terminal
|
||||||
supports it.
|
supports it.
|
||||||
|
|
||||||
Example (see the tutorial for a detailed explanation):
|
Example (see the tutorial for a detailed explanation):
|
||||||
|
|
||||||
$ hledger add
|
$ hledger add
|
||||||
Adding transactions to journal file /src/hledger/examples/sample.journal
|
Adding transactions to journal file /src/hledger/examples/sample.journal
|
||||||
Any command line arguments will be used as defaults.
|
Any command line arguments will be used as defaults.
|
||||||
Use tab key to complete, readline keys to edit, enter to accept defaults.
|
Use tab key to complete, readline keys to edit, enter to accept defaults.
|
||||||
An optional (CODE) may follow transaction dates.
|
An optional (CODE) may follow transaction dates.
|
||||||
An optional ; COMMENT may follow descriptions or amounts.
|
An optional ; COMMENT may follow descriptions or amounts.
|
||||||
If you make a mistake, enter < at any prompt to restart the transaction.
|
If you make a mistake, enter < at any prompt to restart the transaction.
|
||||||
To end a transaction, enter . when prompted.
|
To end a transaction, enter . when prompted.
|
||||||
To quit, enter . at a date prompt or press control-d or control-c.
|
To quit, enter . at a date prompt or press control-d or control-c.
|
||||||
Date [2015/05/22]:
|
Date [2015/05/22]:
|
||||||
Description: supermarket
|
Description: supermarket
|
||||||
Account 1: expenses:food
|
Account 1: expenses:food
|
||||||
Amount 1: $10
|
Amount 1: $10
|
||||||
Account 2: assets:checking
|
Account 2: assets:checking
|
||||||
Amount 2 [$-10.0]:
|
Amount 2 [$-10.0]:
|
||||||
Account 3 (or . or enter to finish this transaction): .
|
Account 3 (or . or enter to finish this transaction): .
|
||||||
2015/05/22 supermarket
|
2015/05/22 supermarket
|
||||||
expenses:food $10
|
expenses:food $10
|
||||||
assets:checking $-10.0
|
assets:checking $-10.0
|
||||||
|
|
||||||
Save this transaction to the journal ? [y]:
|
Save this transaction to the journal ? [y]:
|
||||||
Saved.
|
Saved.
|
||||||
Starting the next transaction (. or ctrl-D/ctrl-C to quit)
|
Starting the next transaction (. or ctrl-D/ctrl-C to quit)
|
||||||
Date [2015/05/22]: <CTRL-D> $
|
Date [2015/05/22]: <CTRL-D> $
|
||||||
|
@ -30,19 +30,19 @@ Classic balance report
|
|||||||
This is the original balance report, as found in Ledger. It usually
|
This is the original balance report, as found in Ledger. It usually
|
||||||
looks like this:
|
looks like this:
|
||||||
|
|
||||||
$ hledger balance
|
$ hledger balance
|
||||||
$-1 assets
|
$-1 assets
|
||||||
$1 bank:saving
|
$1 bank:saving
|
||||||
$-2 cash
|
$-2 cash
|
||||||
$2 expenses
|
$2 expenses
|
||||||
$1 food
|
$1 food
|
||||||
$1 supplies
|
$1 supplies
|
||||||
$-2 income
|
$-2 income
|
||||||
$-1 gifts
|
$-1 gifts
|
||||||
$-1 salary
|
$-1 salary
|
||||||
$1 liabilities:debts
|
$1 liabilities:debts
|
||||||
--------------------
|
--------------------
|
||||||
0
|
0
|
||||||
|
|
||||||
By default, accounts are displayed hierarchically, with subaccounts
|
By default, accounts are displayed hierarchically, with subaccounts
|
||||||
indented below their parent. At each level of the tree, accounts are
|
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,
|
A final total is displayed by default; use -N/--no-total to suppress it,
|
||||||
eg:
|
eg:
|
||||||
|
|
||||||
$ hledger balance -p 2008/6 expenses --no-total
|
$ hledger balance -p 2008/6 expenses --no-total
|
||||||
$2 expenses
|
$2 expenses
|
||||||
$1 food
|
$1 food
|
||||||
$1 supplies
|
$1 supplies
|
||||||
|
|
||||||
Customising the classic balance report
|
Customising the classic balance report
|
||||||
|
|
||||||
You can customise the layout of classic balance reports with
|
You can customise the layout of classic balance reports with
|
||||||
--format FMT:
|
--format FMT:
|
||||||
|
|
||||||
$ hledger balance --format "%20(account) %12(total)"
|
$ hledger balance --format "%20(account) %12(total)"
|
||||||
assets $-1
|
assets $-1
|
||||||
bank:saving $1
|
bank:saving $1
|
||||||
cash $-2
|
cash $-2
|
||||||
expenses $2
|
expenses $2
|
||||||
food $1
|
food $1
|
||||||
supplies $1
|
supplies $1
|
||||||
income $-2
|
income $-2
|
||||||
gifts $-1
|
gifts $-1
|
||||||
salary $-1
|
salary $-1
|
||||||
liabilities:debts $1
|
liabilities:debts $1
|
||||||
---------------------------------
|
---------------------------------
|
||||||
0
|
0
|
||||||
|
|
||||||
The FMT format string (plus a newline) specifies the formatting applied
|
The FMT format string (plus a newline) specifies the formatting applied
|
||||||
to each account/balance pair. It may contain any suitable text, with
|
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)
|
- MAX truncates at this width (optional)
|
||||||
- FIELDNAME must be enclosed in parentheses, and can be one of:
|
- FIELDNAME must be enclosed in parentheses, and can be one of:
|
||||||
|
|
||||||
- depth_spacer - a number of spaces equal to the account's depth,
|
- depth_spacer - a number of spaces equal to the account's depth,
|
||||||
or if MIN is specified, MIN * depth spaces.
|
or if MIN is specified, MIN * depth spaces.
|
||||||
- account - the account's name
|
- account - the account's name
|
||||||
- total - the account's balance/posted total, right justified
|
- total - the account's balance/posted total, right justified
|
||||||
|
|
||||||
Also, FMT can begin with an optional prefix to control how
|
Also, FMT can begin with an optional prefix to control how
|
||||||
multi-commodity amounts are rendered:
|
multi-commodity amounts are rendered:
|
||||||
@ -117,12 +117,12 @@ Some example formats:
|
|||||||
|
|
||||||
- %(total) - the account's total
|
- %(total) - the account's total
|
||||||
- %-20.20(account) - the account's name, left justified, padded to 20
|
- %-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,
|
- %,%-50(account) %25(total) - account name padded to 50 characters,
|
||||||
total padded to 20 characters, with multiple commodities rendered on
|
total padded to 20 characters, with multiple commodities rendered on
|
||||||
one line
|
one line
|
||||||
- %20(total) %2(depth_spacer)%-(account) - the default format for the
|
- %20(total) %2(depth_spacer)%-(account) - the default format for the
|
||||||
single-column balance report
|
single-column balance report
|
||||||
|
|
||||||
Colour support
|
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
|
this mode, you can also use --drop N to omit the first few account name
|
||||||
components.
|
components.
|
||||||
|
|
||||||
$ hledger balance -p 2008/6 expenses -N --flat --drop 1
|
$ hledger balance -p 2008/6 expenses -N --flat --drop 1
|
||||||
$1 food
|
$1 food
|
||||||
$1 supplies
|
$1 supplies
|
||||||
|
|
||||||
Depth limited balance reports
|
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
|
to the specified numeric depth. This is very useful to summarise a
|
||||||
complex set of accounts and get an overview.
|
complex set of accounts and get an overview.
|
||||||
|
|
||||||
$ hledger balance -N -1
|
$ hledger balance -N -1
|
||||||
$-1 assets
|
$-1 assets
|
||||||
$2 expenses
|
$2 expenses
|
||||||
$-2 income
|
$-2 income
|
||||||
$1 liabilities
|
$1 liabilities
|
||||||
|
|
||||||
Flat-mode balance reports, which normally show exclusive balances, show
|
Flat-mode balance reports, which normally show exclusive balances, show
|
||||||
inclusive balances at the depth limit.
|
inclusive balances at the depth limit.
|
||||||
@ -169,54 +169,54 @@ There are three types of multicolumn balance report, showing different
|
|||||||
information:
|
information:
|
||||||
|
|
||||||
1. By default: each column shows the sum of postings in that period, ie
|
1. By default: each column shows the sum of postings in that period, ie
|
||||||
the account's change of balance in that period. This is useful eg
|
the account's change of balance in that period. This is useful eg
|
||||||
for a monthly income statement:
|
for a monthly income statement:
|
||||||
|
|
||||||
$ hledger balance --quarterly income expenses -E
|
$ hledger balance --quarterly income expenses -E
|
||||||
Balance changes in 2008:
|
Balance changes in 2008:
|
||||||
|
|
||||||
|| 2008q1 2008q2 2008q3 2008q4
|
|| 2008q1 2008q2 2008q3 2008q4
|
||||||
===================++=================================
|
===================++=================================
|
||||||
expenses:food || 0 $1 0 0
|
expenses:food || 0 $1 0 0
|
||||||
expenses:supplies || 0 $1 0 0
|
expenses:supplies || 0 $1 0 0
|
||||||
income:gifts || 0 $-1 0 0
|
income:gifts || 0 $-1 0 0
|
||||||
income:salary || $-1 0 0 0
|
income:salary || $-1 0 0 0
|
||||||
-------------------++---------------------------------
|
-------------------++---------------------------------
|
||||||
|| $-1 $1 0 0
|
|| $-1 $1 0 0
|
||||||
|
|
||||||
2. With --cumulative: each column shows the ending balance for that
|
2. With --cumulative: each column shows the ending balance for that
|
||||||
period, accumulating the changes across periods, starting from 0 at
|
period, accumulating the changes across periods, starting from 0 at
|
||||||
the report start date:
|
the report start date:
|
||||||
|
|
||||||
$ hledger balance --quarterly income expenses -E --cumulative
|
$ hledger balance --quarterly income expenses -E --cumulative
|
||||||
Ending balances (cumulative) in 2008:
|
Ending balances (cumulative) in 2008:
|
||||||
|
|
||||||
|| 2008/03/31 2008/06/30 2008/09/30 2008/12/31
|
|| 2008/03/31 2008/06/30 2008/09/30 2008/12/31
|
||||||
===================++=================================================
|
===================++=================================================
|
||||||
expenses:food || 0 $1 $1 $1
|
expenses:food || 0 $1 $1 $1
|
||||||
expenses:supplies || 0 $1 $1 $1
|
expenses:supplies || 0 $1 $1 $1
|
||||||
income:gifts || 0 $-1 $-1 $-1
|
income:gifts || 0 $-1 $-1 $-1
|
||||||
income:salary || $-1 $-1 $-1 $-1
|
income:salary || $-1 $-1 $-1 $-1
|
||||||
-------------------++-------------------------------------------------
|
-------------------++-------------------------------------------------
|
||||||
|| $-1 0 0 0
|
|| $-1 0 0 0
|
||||||
|
|
||||||
3. With --historical/-H: each column shows the actual historical ending
|
3. With --historical/-H: each column shows the actual historical ending
|
||||||
balance for that period, accumulating the changes across periods,
|
balance for that period, accumulating the changes across periods,
|
||||||
starting from the actual balance at the report start date. This is
|
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
|
useful eg for a multi-period balance sheet, and when you are showing
|
||||||
only the data after a certain start date:
|
only the data after a certain start date:
|
||||||
|
|
||||||
$ hledger balance ^assets ^liabilities --quarterly --historical --begin 2008/4/1
|
$ hledger balance ^assets ^liabilities --quarterly --historical --begin 2008/4/1
|
||||||
Ending balances (historical) in 2008/04/01-2008/12/31:
|
Ending balances (historical) in 2008/04/01-2008/12/31:
|
||||||
|
|
||||||
|| 2008/06/30 2008/09/30 2008/12/31
|
|| 2008/06/30 2008/09/30 2008/12/31
|
||||||
======================++=====================================
|
======================++=====================================
|
||||||
assets:bank:checking || $1 $1 0
|
assets:bank:checking || $1 $1 0
|
||||||
assets:bank:saving || $1 $1 $1
|
assets:bank:saving || $1 $1 $1
|
||||||
assets:cash || $-2 $-2 $-2
|
assets:cash || $-2 $-2 $-2
|
||||||
liabilities:debts || 0 0 $1
|
liabilities:debts || 0 0 $1
|
||||||
----------------------++-------------------------------------
|
----------------------++-------------------------------------
|
||||||
|| 0 0 0
|
|| 0 0 0
|
||||||
|
|
||||||
Multicolumn balance reports display accounts in flat mode by default; to
|
Multicolumn balance reports display accounts in flat mode by default; to
|
||||||
see the hierarchy, use --tree.
|
see the hierarchy, use --tree.
|
||||||
@ -242,21 +242,21 @@ row.
|
|||||||
|
|
||||||
Here's an example of all three:
|
Here's an example of all three:
|
||||||
|
|
||||||
$ hledger balance -Q income expenses --tree -ETA
|
$ hledger balance -Q income expenses --tree -ETA
|
||||||
Balance changes in 2008:
|
Balance changes in 2008:
|
||||||
|
|
||||||
|| 2008q1 2008q2 2008q3 2008q4 Total Average
|
|| 2008q1 2008q2 2008q3 2008q4 Total Average
|
||||||
============++===================================================
|
============++===================================================
|
||||||
expenses || 0 $2 0 0 $2 $1
|
expenses || 0 $2 0 0 $2 $1
|
||||||
food || 0 $1 0 0 $1 0
|
food || 0 $1 0 0 $1 0
|
||||||
supplies || 0 $1 0 0 $1 0
|
supplies || 0 $1 0 0 $1 0
|
||||||
income || $-1 $-1 0 0 $-2 $-1
|
income || $-1 $-1 0 0 $-2 $-1
|
||||||
gifts || 0 $-1 0 0 $-1 0
|
gifts || 0 $-1 0 0 $-1 0
|
||||||
salary || $-1 0 0 0 $-1 0
|
salary || $-1 0 0 0 $-1 0
|
||||||
------------++---------------------------------------------------
|
------------++---------------------------------------------------
|
||||||
|| $-1 $1 0 0 0 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:
|
Limitations:
|
||||||
|
|
||||||
@ -278,47 +278,47 @@ a report interval.
|
|||||||
For example, you can take average monthly expenses in the common expense
|
For example, you can take average monthly expenses in the common expense
|
||||||
categories to construct a minimal monthly budget:
|
categories to construct a minimal monthly budget:
|
||||||
|
|
||||||
;; Budget
|
;; Budget
|
||||||
~ monthly
|
~ monthly
|
||||||
income $2000
|
income $2000
|
||||||
expenses:food $400
|
expenses:food $400
|
||||||
expenses:bus $50
|
expenses:bus $50
|
||||||
expenses:movies $30
|
expenses:movies $30
|
||||||
assets:bank:checking
|
assets:bank:checking
|
||||||
|
|
||||||
;; Two months worth of expenses
|
;; Two months worth of expenses
|
||||||
2017-11-01
|
2017-11-01
|
||||||
income $1950
|
income $1950
|
||||||
expenses:food $396
|
expenses:food $396
|
||||||
expenses:bus $49
|
expenses:bus $49
|
||||||
expenses:movies $30
|
expenses:movies $30
|
||||||
expenses:supplies $20
|
expenses:supplies $20
|
||||||
assets:bank:checking
|
assets:bank:checking
|
||||||
|
|
||||||
2017-12-01
|
2017-12-01
|
||||||
income $2100
|
income $2100
|
||||||
expenses:food $412
|
expenses:food $412
|
||||||
expenses:bus $53
|
expenses:bus $53
|
||||||
expenses:gifts $100
|
expenses:gifts $100
|
||||||
assets:bank:checking
|
assets:bank:checking
|
||||||
|
|
||||||
You can now see a monthly budget report:
|
You can now see a monthly budget report:
|
||||||
|
|
||||||
$ hledger balance -M --budget
|
$ hledger balance -M --budget
|
||||||
Budget performance in 2017/11/01-2017/12/31:
|
Budget performance in 2017/11/01-2017/12/31:
|
||||||
|
|
||||||
|| Nov Dec
|
|| Nov Dec
|
||||||
======================++====================================================
|
======================++====================================================
|
||||||
assets || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480]
|
assets || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480]
|
||||||
assets:bank || $-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]
|
assets:bank:checking || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480]
|
||||||
expenses || $495 [ 103% of $480] $565 [ 118% of $480]
|
expenses || $495 [ 103% of $480] $565 [ 118% of $480]
|
||||||
expenses:bus || $49 [ 98% of $50] $53 [ 106% of $50]
|
expenses:bus || $49 [ 98% of $50] $53 [ 106% of $50]
|
||||||
expenses:food || $396 [ 99% of $400] $412 [ 103% of $400]
|
expenses:food || $396 [ 99% of $400] $412 [ 103% of $400]
|
||||||
expenses:movies || $30 [ 100% of $30] 0 [ 0% of $30]
|
expenses:movies || $30 [ 100% of $30] 0 [ 0% of $30]
|
||||||
income || $1950 [ 98% of $2000] $2100 [ 105% of $2000]
|
income || $1950 [ 98% of $2000] $2100 [ 105% of $2000]
|
||||||
----------------------++----------------------------------------------------
|
----------------------++----------------------------------------------------
|
||||||
|| 0 [ 0] 0 [ 0]
|
|| 0 [ 0] 0 [ 0]
|
||||||
|
|
||||||
By default, only accounts with budget goals during the report period are
|
By default, only accounts with budget goals during the report period are
|
||||||
shown. In the example above, transactions in expenses:gifts and
|
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:
|
You can use --empty shows unbudgeted accounts as well:
|
||||||
|
|
||||||
$ hledger balance -M --budget --empty
|
$ hledger balance -M --budget --empty
|
||||||
Budget performance in 2017/11/01-2017/12/31:
|
Budget performance in 2017/11/01-2017/12/31:
|
||||||
|
|
||||||
|| Nov Dec
|
|| Nov Dec
|
||||||
======================++====================================================
|
======================++====================================================
|
||||||
assets || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480]
|
assets || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480]
|
||||||
assets:bank || $-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]
|
assets:bank:checking || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480]
|
||||||
expenses || $495 [ 103% of $480] $565 [ 118% of $480]
|
expenses || $495 [ 103% of $480] $565 [ 118% of $480]
|
||||||
expenses:bus || $49 [ 98% of $50] $53 [ 106% of $50]
|
expenses:bus || $49 [ 98% of $50] $53 [ 106% of $50]
|
||||||
expenses:food || $396 [ 99% of $400] $412 [ 103% of $400]
|
expenses:food || $396 [ 99% of $400] $412 [ 103% of $400]
|
||||||
expenses:gifts || 0 $100
|
expenses:gifts || 0 $100
|
||||||
expenses:movies || $30 [ 100% of $30] 0 [ 0% of $30]
|
expenses:movies || $30 [ 100% of $30] 0 [ 0% of $30]
|
||||||
expenses:supplies || $20 0
|
expenses:supplies || $20 0
|
||||||
income || $1950 [ 98% of $2000] $2100 [ 105% of $2000]
|
income || $1950 [ 98% of $2000] $2100 [ 105% of $2000]
|
||||||
----------------------++----------------------------------------------------
|
----------------------++----------------------------------------------------
|
||||||
|| 0 [ 0] 0 [ 0]
|
|| 0 [ 0] 0 [ 0]
|
||||||
|
|
||||||
You can roll over unspent budgets to next period with --cumulative:
|
You can roll over unspent budgets to next period with --cumulative:
|
||||||
|
|
||||||
$ hledger balance -M --budget --cumulative
|
$ hledger balance -M --budget --cumulative
|
||||||
Budget performance in 2017/11/01-2017/12/31:
|
Budget performance in 2017/11/01-2017/12/31:
|
||||||
|
|
||||||
|| Nov Dec
|
|| Nov Dec
|
||||||
======================++====================================================
|
======================++====================================================
|
||||||
assets || $-2445 [ 99% of $-2480] $-5110 [ 103% of $-4960]
|
assets || $-2445 [ 99% of $-2480] $-5110 [ 103% of $-4960]
|
||||||
assets:bank || $-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]
|
assets:bank:checking || $-2445 [ 99% of $-2480] $-5110 [ 103% of $-4960]
|
||||||
expenses || $495 [ 103% of $480] $1060 [ 110% of $960]
|
expenses || $495 [ 103% of $480] $1060 [ 110% of $960]
|
||||||
expenses:bus || $49 [ 98% of $50] $102 [ 102% of $100]
|
expenses:bus || $49 [ 98% of $50] $102 [ 102% of $100]
|
||||||
expenses:food || $396 [ 99% of $400] $808 [ 101% of $800]
|
expenses:food || $396 [ 99% of $400] $808 [ 101% of $800]
|
||||||
expenses:movies || $30 [ 100% of $30] $30 [ 50% of $60]
|
expenses:movies || $30 [ 100% of $30] $30 [ 50% of $60]
|
||||||
income || $1950 [ 98% of $2000] $4050 [ 101% of $4000]
|
income || $1950 [ 98% of $2000] $4050 [ 101% of $4000]
|
||||||
----------------------++----------------------------------------------------
|
----------------------++----------------------------------------------------
|
||||||
|| 0 [ 0] 0 [ 0]
|
|| 0 [ 0] 0 [ 0]
|
||||||
|
|
||||||
Note, the -S/--sort-amount flag is not yet fully supported with
|
Note, the -S/--sort-amount flag is not yet fully supported with
|
||||||
--budget.
|
--budget.
|
||||||
@ -381,10 +381,10 @@ account, all its parents would have budget as well.
|
|||||||
|
|
||||||
To illustrate this, consider the following budget:
|
To illustrate this, consider the following budget:
|
||||||
|
|
||||||
~ monthly from 2019/01
|
~ monthly from 2019/01
|
||||||
expenses:personal $1,000.00
|
expenses:personal $1,000.00
|
||||||
expenses:personal:electronics $100.00
|
expenses:personal:electronics $100.00
|
||||||
liabilities
|
liabilities
|
||||||
|
|
||||||
With this, monthly budget for electronics is defined to be $100 and
|
With this, monthly budget for electronics is defined to be $100 and
|
||||||
budget for personal expenses is an additional $1000, which implicity
|
budget for personal expenses is an additional $1000, which implicity
|
||||||
@ -397,26 +397,26 @@ counted towards only towards the budget of expenses:personal.
|
|||||||
|
|
||||||
For example, let's consider these transactions:
|
For example, let's consider these transactions:
|
||||||
|
|
||||||
~ monthly from 2019/01
|
~ monthly from 2019/01
|
||||||
expenses:personal $1,000.00
|
expenses:personal $1,000.00
|
||||||
expenses:personal:electronics $100.00
|
expenses:personal:electronics $100.00
|
||||||
liabilities
|
liabilities
|
||||||
|
|
||||||
2019/01/01 Google home hub
|
2019/01/01 Google home hub
|
||||||
expenses:personal:electronics $90.00
|
expenses:personal:electronics $90.00
|
||||||
liabilities $-90.00
|
liabilities $-90.00
|
||||||
|
|
||||||
2019/01/02 Phone screen protector
|
2019/01/02 Phone screen protector
|
||||||
expenses:personal:electronics:upgrades $10.00
|
expenses:personal:electronics:upgrades $10.00
|
||||||
liabilities
|
liabilities
|
||||||
|
|
||||||
2019/01/02 Weekly train ticket
|
2019/01/02 Weekly train ticket
|
||||||
expenses:personal:train tickets $153.00
|
expenses:personal:train tickets $153.00
|
||||||
liabilities
|
liabilities
|
||||||
|
|
||||||
2019/01/03 Flowers
|
2019/01/03 Flowers
|
||||||
expenses:personal $30.00
|
expenses:personal $30.00
|
||||||
liabilities
|
liabilities
|
||||||
|
|
||||||
As you can see, we have transactions in
|
As you can see, we have transactions in
|
||||||
expenses:personal:electronics:upgrades and
|
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
|
towards budgets of expenses:personal:electronics and expenses:personal
|
||||||
accordingly:
|
accordingly:
|
||||||
|
|
||||||
$ hledger balance --budget -M
|
$ hledger balance --budget -M
|
||||||
Budget performance in 2019/01:
|
Budget performance in 2019/01:
|
||||||
|
|
||||||
|| Jan
|
|| Jan
|
||||||
===============================++===============================
|
===============================++===============================
|
||||||
expenses || $283.00 [ 26% of $1100.00]
|
expenses || $283.00 [ 26% of $1100.00]
|
||||||
expenses:personal || $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 || $100.00 [ 100% of $100.00]
|
||||||
liabilities || $-283.00 [ 26% of $-1100.00]
|
liabilities || $-283.00 [ 26% of $-1100.00]
|
||||||
-------------------------------++-------------------------------
|
-------------------------------++-------------------------------
|
||||||
|| 0 [ 0]
|
|| 0 [ 0]
|
||||||
|
|
||||||
And with --empty, we can get a better picture of budget allocation and
|
And with --empty, we can get a better picture of budget allocation and
|
||||||
consumption:
|
consumption:
|
||||||
|
|
||||||
$ hledger balance --budget -M --empty
|
$ hledger balance --budget -M --empty
|
||||||
Budget performance in 2019/01:
|
Budget performance in 2019/01:
|
||||||
|
|
||||||
|| Jan
|
|| Jan
|
||||||
========================================++===============================
|
========================================++===============================
|
||||||
expenses || $283.00 [ 26% of $1100.00]
|
expenses || $283.00 [ 26% of $1100.00]
|
||||||
expenses:personal || $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 || $100.00 [ 100% of $100.00]
|
||||||
expenses:personal:electronics:upgrades || $10.00
|
expenses:personal:electronics:upgrades || $10.00
|
||||||
expenses:personal:train tickets || $153.00
|
expenses:personal:train tickets || $153.00
|
||||||
liabilities || $-283.00 [ 26% of $-1100.00]
|
liabilities || $-283.00 [ 26% of $-1100.00]
|
||||||
----------------------------------------++-------------------------------
|
----------------------------------------++-------------------------------
|
||||||
|| 0 [ 0]
|
|| 0 [ 0]
|
||||||
|
|
||||||
Output format
|
Output format
|
||||||
|
|
||||||
|
@ -12,24 +12,24 @@ _FLAGS_
|
|||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
$ hledger balancesheet
|
$ hledger balancesheet
|
||||||
Balance Sheet
|
Balance Sheet
|
||||||
|
|
||||||
Assets:
|
Assets:
|
||||||
$-1 assets
|
$-1 assets
|
||||||
$1 bank:saving
|
$1 bank:saving
|
||||||
$-2 cash
|
$-2 cash
|
||||||
--------------------
|
--------------------
|
||||||
$-1
|
$-1
|
||||||
|
|
||||||
Liabilities:
|
Liabilities:
|
||||||
$1 liabilities:debts
|
$1 liabilities:debts
|
||||||
--------------------
|
--------------------
|
||||||
$1
|
$1
|
||||||
|
|
||||||
Total:
|
Total:
|
||||||
--------------------
|
--------------------
|
||||||
0
|
0
|
||||||
|
|
||||||
With a reporting interval, multiple columns will be shown, one for each
|
With a reporting interval, multiple columns will be shown, one for each
|
||||||
report period. As with multicolumn balance reports, you can alter the
|
report period. As with multicolumn balance reports, you can alter the
|
||||||
|
@ -6,26 +6,26 @@ _FLAGS_
|
|||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
$ hledger balancesheetequity
|
$ hledger balancesheetequity
|
||||||
Balance Sheet With Equity
|
Balance Sheet With Equity
|
||||||
|
|
||||||
Assets:
|
Assets:
|
||||||
$-2 assets
|
$-2 assets
|
||||||
$1 bank:saving
|
$1 bank:saving
|
||||||
$-3 cash
|
$-3 cash
|
||||||
--------------------
|
--------------------
|
||||||
$-2
|
$-2
|
||||||
|
|
||||||
Liabilities:
|
Liabilities:
|
||||||
$1 liabilities:debts
|
$1 liabilities:debts
|
||||||
--------------------
|
--------------------
|
||||||
$1
|
$1
|
||||||
|
|
||||||
Equity:
|
Equity:
|
||||||
$1 equity:owner
|
$1 equity:owner
|
||||||
--------------------
|
--------------------
|
||||||
$1
|
$1
|
||||||
|
|
||||||
Total:
|
Total:
|
||||||
--------------------
|
--------------------
|
||||||
0
|
0
|
||||||
|
@ -10,19 +10,19 @@ _FLAGS_
|
|||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
$ hledger cashflow
|
$ hledger cashflow
|
||||||
Cashflow Statement
|
Cashflow Statement
|
||||||
|
|
||||||
Cash flows:
|
Cash flows:
|
||||||
$-1 assets
|
$-1 assets
|
||||||
$1 bank:saving
|
$1 bank:saving
|
||||||
$-2 cash
|
$-2 cash
|
||||||
--------------------
|
--------------------
|
||||||
$-1
|
$-1
|
||||||
|
|
||||||
Total:
|
Total:
|
||||||
--------------------
|
--------------------
|
||||||
$-1
|
$-1
|
||||||
|
|
||||||
With a reporting interval, multiple columns will be shown, one for each
|
With a reporting interval, multiple columns will be shown, one for each
|
||||||
report period. Normally cashflow shows changes in assets per period,
|
report period. Normally cashflow shows changes in assets per period,
|
||||||
|
@ -49,30 +49,30 @@ command line:
|
|||||||
_Warning: we use >> here to append; be careful not to type a single >
|
_Warning: we use >> here to append; be careful not to type a single >
|
||||||
which would wipe your journal!_
|
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 --opening >>2019.journal
|
||||||
$ hledger close -f 2018.journal -e 2019 assets liabilities --closing >>2018.journal
|
$ hledger close -f 2018.journal -e 2019 assets liabilities --closing >>2018.journal
|
||||||
|
|
||||||
Now:
|
Now:
|
||||||
|
|
||||||
$ hledger bs -f 2019.journal # one file - balances are correct
|
$ 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 -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 2018.journal not:desc:closing # to see year-end balances, must exclude closing txn
|
||||||
|
|
||||||
Transactions spanning the closing date can complicate matters, breaking
|
Transactions spanning the closing date can complicate matters, breaking
|
||||||
balance assertions:
|
balance assertions:
|
||||||
|
|
||||||
2018/12/30 a purchase made in 2018, clearing the following year
|
2018/12/30 a purchase made in 2018, clearing the following year
|
||||||
expenses:food 5
|
expenses:food 5
|
||||||
assets:bank:checking -5 ; [2019/1/2]
|
assets:bank:checking -5 ; [2019/1/2]
|
||||||
|
|
||||||
Here's one way to resolve that:
|
Here's one way to resolve that:
|
||||||
|
|
||||||
; in 2018.journal:
|
; in 2018.journal:
|
||||||
2018/12/30 a purchase made in 2018, clearing the following year
|
2018/12/30 a purchase made in 2018, clearing the following year
|
||||||
expenses:food 5
|
expenses:food 5
|
||||||
liabilities:pending
|
liabilities:pending
|
||||||
|
|
||||||
; in 2019.journal:
|
; in 2019.journal:
|
||||||
2019/1/2 clearance of last year's pending transactions
|
2019/1/2 clearance of last year's pending transactions
|
||||||
liabilities:pending 5 = 0
|
liabilities:pending 5 = 0
|
||||||
assets:checking
|
assets:checking
|
||||||
|
@ -14,22 +14,22 @@ particular viewer with the --info, --man, --pager, --cat flags.
|
|||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
$ hledger help
|
$ hledger help
|
||||||
Please choose a manual by typing "hledger help MANUAL" (a substring is ok).
|
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
|
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
|
NAME
|
||||||
hledger - a command-line accounting tool
|
hledger - a command-line accounting tool
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
hledger [-f FILE] COMMAND [OPTIONS] [ARGS]
|
hledger [-f FILE] COMMAND [OPTIONS] [ARGS]
|
||||||
hledger [-f FILE] ADDONCMD -- [OPTIONS] [ARGS]
|
hledger [-f FILE] ADDONCMD -- [OPTIONS] [ARGS]
|
||||||
hledger
|
hledger
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
hledger is a cross-platform program for tracking money, time, or any
|
hledger is a cross-platform program for tracking money, time, or any
|
||||||
...
|
...
|
||||||
|
@ -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
|
The --dry-run output is in journal format, so you can filter it, eg to
|
||||||
see only uncategorised transactions:
|
see only uncategorised transactions:
|
||||||
|
|
||||||
$ hledger import --dry ... | hledger -f- print unknown --ignore-assertions
|
$ hledger import --dry ... | hledger -f- print unknown --ignore-assertions
|
||||||
|
@ -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
|
that you have top-level accounts named income (or revenue) and expense
|
||||||
(plural forms also allowed.)
|
(plural forms also allowed.)
|
||||||
|
|
||||||
$ hledger incomestatement
|
$ hledger incomestatement
|
||||||
Income Statement
|
Income Statement
|
||||||
|
|
||||||
Revenues:
|
Revenues:
|
||||||
$-2 income
|
$-2 income
|
||||||
$-1 gifts
|
$-1 gifts
|
||||||
$-1 salary
|
$-1 salary
|
||||||
--------------------
|
--------------------
|
||||||
$-2
|
$-2
|
||||||
|
|
||||||
Expenses:
|
Expenses:
|
||||||
$2 expenses
|
$2 expenses
|
||||||
$1 food
|
$1 food
|
||||||
$1 supplies
|
$1 supplies
|
||||||
--------------------
|
--------------------
|
||||||
$2
|
$2
|
||||||
|
|
||||||
Total:
|
Total:
|
||||||
--------------------
|
--------------------
|
||||||
0
|
0
|
||||||
|
|
||||||
With a reporting interval, multiple columns will be shown, one for each
|
With a reporting interval, multiple columns will be shown, one for each
|
||||||
report period. Normally incomestatement shows revenues/expenses per
|
report period. Normally incomestatement shows revenues/expenses per
|
||||||
|
@ -11,27 +11,27 @@ print's output is always a valid hledger journal.
|
|||||||
It preserves all transaction information, but it does not preserve
|
It preserves all transaction information, but it does not preserve
|
||||||
directives or inter-transaction comments
|
directives or inter-transaction comments
|
||||||
|
|
||||||
$ hledger print
|
$ hledger print
|
||||||
2008/01/01 income
|
2008/01/01 income
|
||||||
assets:bank:checking $1
|
assets:bank:checking $1
|
||||||
income:salary $-1
|
income:salary $-1
|
||||||
|
|
||||||
2008/06/01 gift
|
2008/06/01 gift
|
||||||
assets:bank:checking $1
|
assets:bank:checking $1
|
||||||
income:gifts $-1
|
income:gifts $-1
|
||||||
|
|
||||||
2008/06/02 save
|
2008/06/02 save
|
||||||
assets:bank:saving $1
|
assets:bank:saving $1
|
||||||
assets:bank:checking $-1
|
assets:bank:checking $-1
|
||||||
|
|
||||||
2008/06/03 * eat & shop
|
2008/06/03 * eat & shop
|
||||||
expenses:food $1
|
expenses:food $1
|
||||||
expenses:supplies $1
|
expenses:supplies $1
|
||||||
assets:cash $-2
|
assets:cash $-2
|
||||||
|
|
||||||
2008/12/31 * pay off
|
2008/12/31 * pay off
|
||||||
liabilities:debts $1
|
liabilities:debts $1
|
||||||
assets:bank:checking $-1
|
assets:bank:checking $-1
|
||||||
|
|
||||||
Normally, the journal entry's explicit or implicit amount style is
|
Normally, the journal entry's explicit or implicit amount style is
|
||||||
preserved. Ie when an amount is omitted in the journal, it will be
|
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
|
ignoring already-seen entries in import data, such as downloaded CSV
|
||||||
files. Eg:
|
files. Eg:
|
||||||
|
|
||||||
$ hledger -f bank1.csv print --new
|
$ hledger -f bank1.csv print --new
|
||||||
# shows transactions added since last print --new on this file
|
# shows transactions added since last print --new on this file
|
||||||
|
|
||||||
This assumes that transactions added to FILE always have same or
|
This assumes that transactions added to FILE always have same or
|
||||||
increasing dates, and that transactions on the same day do not get
|
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
|
This command also supports output destination and output format
|
||||||
selection. Here's an example of print's CSV output:
|
selection. Here's an example of print's CSV output:
|
||||||
|
|
||||||
$ hledger print -Ocsv
|
$ hledger print -Ocsv
|
||||||
"txnidx","date","date2","status","code","description","comment","account","amount","commodity","credit","debit","posting-status","posting-comment"
|
"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","","assets:bank:checking","1","$","","1","",""
|
||||||
"1","2008/01/01","","","","income","","income:salary","-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","","assets:bank:checking","1","$","","1","",""
|
||||||
"2","2008/06/01","","","","gift","","income:gifts","-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:saving","1","$","","1","",""
|
||||||
"3","2008/06/02","","","","save","","assets:bank:checking","-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:food","1","$","","1","",""
|
||||||
"4","2008/06/03","","*","","eat & shop","","expenses:supplies","1","$","","1","",""
|
"4","2008/06/03","","*","","eat & shop","","expenses:supplies","1","$","","1","",""
|
||||||
"4","2008/06/03","","*","","eat & shop","","assets:cash","-2","$","2","","",""
|
"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","","liabilities:debts","1","$","","1","",""
|
||||||
"5","2008/12/31","","*","","pay off","","assets:bank:checking","-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
|
- 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
|
- The "txnidx" (transaction index) field shows which postings belong
|
||||||
to the same transaction. (This number might change if transactions
|
to the same transaction. (This number might change if transactions
|
||||||
are reordered within the file, files are parsed/included in a
|
are reordered within the file, files are parsed/included in a
|
||||||
different order, etc.)
|
different order, etc.)
|
||||||
- The amount is separated into "commodity" (the symbol) and "amount"
|
- 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"
|
- The numeric amount is repeated in either the "credit" or "debit"
|
||||||
column, for convenience. (Those names are not accurate in the
|
column, for convenience. (Those names are not accurate in the
|
||||||
accounting sense; it just puts negative amounts under credit and
|
accounting sense; it just puts negative amounts under credit and
|
||||||
zero or greater amounts under debit.)
|
zero or greater amounts under debit.)
|
||||||
|
@ -5,12 +5,12 @@ _FLAGS_
|
|||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
$ cat unique.journal
|
$ cat unique.journal
|
||||||
1/1 test
|
1/1 test
|
||||||
(acct:one) 1
|
(acct:one) 1
|
||||||
2/2 test
|
2/2 test
|
||||||
(acct:two) 2
|
(acct:two) 2
|
||||||
$ LEDGER_FILE=unique.journal hledger print-unique
|
$ LEDGER_FILE=unique.journal hledger print-unique
|
||||||
(-f option not supported)
|
(-f option not supported)
|
||||||
2015/01/01 test
|
2015/01/01 test
|
||||||
(acct:one) 1
|
(acct:one) 1
|
||||||
|
@ -10,10 +10,10 @@ account's activity:
|
|||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ hledger register checking
|
$ hledger register checking
|
||||||
2008/01/01 income assets:bank:checking $1 $1
|
2008/01/01 income assets:bank:checking $1 $1
|
||||||
2008/06/01 gift assets:bank:checking $1 $2
|
2008/06/01 gift assets:bank:checking $1 $2
|
||||||
2008/06/02 save assets:bank:checking $-1 $1
|
2008/06/02 save assets:bank:checking $-1 $1
|
||||||
2008/12/31 pay off assets:bank:checking $-1 0
|
2008/12/31 pay off assets:bank:checking $-1 0
|
||||||
```
|
```
|
||||||
|
|
||||||
With --date2, it shows and sorts by secondary date instead.
|
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
|
```shell
|
||||||
$ hledger register checking -b 2008/6 --historical
|
$ hledger register checking -b 2008/6 --historical
|
||||||
2008/06/01 gift assets:bank:checking $1 $2
|
2008/06/01 gift assets:bank:checking $1 $2
|
||||||
2008/06/02 save assets:bank:checking $-1 $1
|
2008/06/02 save assets:bank:checking $-1 $1
|
||||||
2008/12/31 pay off assets:bank:checking $-1 0
|
2008/12/31 pay off assets:bank:checking $-1 0
|
||||||
```
|
```
|
||||||
|
|
||||||
The `--depth` option limits the amount of sub-account detail displayed.
|
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
|
```shell
|
||||||
$ hledger register --monthly income
|
$ hledger register --monthly income
|
||||||
2008/01 income:salary $-1 $-1
|
2008/01 income:salary $-1 $-1
|
||||||
2008/06 income:gifts $-1 $-2
|
2008/06 income:gifts $-1 $-2
|
||||||
```
|
```
|
||||||
Periods with no activity, and summary postings with a zero amount, are
|
Periods with no activity, and summary postings with a zero amount, are
|
||||||
not shown by default; use the `--empty`/`-E` flag to see them:
|
not shown by default; use the `--empty`/`-E` flag to see them:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ hledger register --monthly income -E
|
$ hledger register --monthly income -E
|
||||||
2008/01 income:salary $-1 $-1
|
2008/01 income:salary $-1 $-1
|
||||||
2008/02 0 $-1
|
2008/02 0 $-1
|
||||||
2008/03 0 $-1
|
2008/03 0 $-1
|
||||||
2008/04 0 $-1
|
2008/04 0 $-1
|
||||||
2008/05 0 $-1
|
2008/05 0 $-1
|
||||||
2008/06 income:gifts $-1 $-2
|
2008/06 income:gifts $-1 $-2
|
||||||
2008/07 0 $-2
|
2008/07 0 $-2
|
||||||
2008/08 0 $-2
|
2008/08 0 $-2
|
||||||
2008/09 0 $-2
|
2008/09 0 $-2
|
||||||
2008/10 0 $-2
|
2008/10 0 $-2
|
||||||
2008/11 0 $-2
|
2008/11 0 $-2
|
||||||
2008/12 0 $-2
|
2008/12 0 $-2
|
||||||
```
|
```
|
||||||
|
|
||||||
Often, you'll want to see just one line per interval.
|
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
|
```shell
|
||||||
$ hledger register --monthly assets --depth 1h
|
$ hledger register --monthly assets --depth 1h
|
||||||
2008/01 assets $1 $1
|
2008/01 assets $1 $1
|
||||||
2008/06 assets $-1 0
|
2008/06 assets $-1 0
|
||||||
2008/12 assets $-1 $-1
|
2008/12 assets $-1 $-1
|
||||||
```
|
```
|
||||||
|
|
||||||
Note when using report intervals, if you specify start/end dates these
|
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
|
The description and account columns normally share the space equally
|
||||||
(about half of (width - 40) each). You can adjust this by adding a
|
(about half of (width - 40) each). You can adjust this by adding a
|
||||||
description width as part of --width's argument, comma-separated:
|
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) ---------------------------------->
|
<--------------------------------- width (W) ---------------------------------->
|
||||||
date (10) description (D) account (W-41-D) amount (12) balance (12)
|
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
|
$ COLUMNS=100 hledger reg # set with one-time environment variable
|
||||||
$ export COLUMNS=100; hledger reg # set till session end (or window resize)
|
$ 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 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
|
This command also supports
|
||||||
|
@ -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
|
their running total. This is typically used with a query selecting a
|
||||||
particular account, to see that account's activity:
|
particular account, to see that account's activity:
|
||||||
|
|
||||||
$ hledger register checking
|
$ hledger register checking
|
||||||
2008/01/01 income assets:bank:checking $1 $1
|
2008/01/01 income assets:bank:checking $1 $1
|
||||||
2008/06/01 gift assets:bank:checking $1 $2
|
2008/06/01 gift assets:bank:checking $1 $2
|
||||||
2008/06/02 save assets:bank:checking $-1 $1
|
2008/06/02 save assets:bank:checking $-1 $1
|
||||||
2008/12/31 pay off assets:bank:checking $-1 0
|
2008/12/31 pay off assets:bank:checking $-1 0
|
||||||
|
|
||||||
With --date2, it shows and sorts by secondary date instead.
|
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
|
postings to the running total. This is useful when you want to see only
|
||||||
recent activity, with a historically accurate running balance:
|
recent activity, with a historically accurate running balance:
|
||||||
|
|
||||||
$ hledger register checking -b 2008/6 --historical
|
$ hledger register checking -b 2008/6 --historical
|
||||||
2008/06/01 gift assets:bank:checking $1 $2
|
2008/06/01 gift assets:bank:checking $1 $2
|
||||||
2008/06/02 save assets:bank:checking $-1 $1
|
2008/06/02 save assets:bank:checking $-1 $1
|
||||||
2008/12/31 pay off assets:bank:checking $-1 0
|
2008/12/31 pay off assets:bank:checking $-1 0
|
||||||
|
|
||||||
The --depth option limits the amount of sub-account detail displayed.
|
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
|
With a reporting interval, register shows summary postings, one per
|
||||||
interval, aggregating the postings to each account:
|
interval, aggregating the postings to each account:
|
||||||
|
|
||||||
$ hledger register --monthly income
|
$ hledger register --monthly income
|
||||||
2008/01 income:salary $-1 $-1
|
2008/01 income:salary $-1 $-1
|
||||||
2008/06 income:gifts $-1 $-2
|
2008/06 income:gifts $-1 $-2
|
||||||
|
|
||||||
Periods with no activity, and summary postings with a zero amount, are
|
Periods with no activity, and summary postings with a zero amount, are
|
||||||
not shown by default; use the --empty/-E flag to see them:
|
not shown by default; use the --empty/-E flag to see them:
|
||||||
|
|
||||||
$ hledger register --monthly income -E
|
$ hledger register --monthly income -E
|
||||||
2008/01 income:salary $-1 $-1
|
2008/01 income:salary $-1 $-1
|
||||||
2008/02 0 $-1
|
2008/02 0 $-1
|
||||||
2008/03 0 $-1
|
2008/03 0 $-1
|
||||||
2008/04 0 $-1
|
2008/04 0 $-1
|
||||||
2008/05 0 $-1
|
2008/05 0 $-1
|
||||||
2008/06 income:gifts $-1 $-2
|
2008/06 income:gifts $-1 $-2
|
||||||
2008/07 0 $-2
|
2008/07 0 $-2
|
||||||
2008/08 0 $-2
|
2008/08 0 $-2
|
||||||
2008/09 0 $-2
|
2008/09 0 $-2
|
||||||
2008/10 0 $-2
|
2008/10 0 $-2
|
||||||
2008/11 0 $-2
|
2008/11 0 $-2
|
||||||
2008/12 0 $-2
|
2008/12 0 $-2
|
||||||
|
|
||||||
Often, you'll want to see just one line per interval. The --depth option
|
Often, you'll want to see just one line per interval. The --depth option
|
||||||
helps with this, causing subaccounts to be aggregated:
|
helps with this, causing subaccounts to be aggregated:
|
||||||
|
|
||||||
$ hledger register --monthly assets --depth 1h
|
$ hledger register --monthly assets --depth 1h
|
||||||
2008/01 assets $1 $1
|
2008/01 assets $1 $1
|
||||||
2008/06 assets $-1 0
|
2008/06 assets $-1 0
|
||||||
2008/12 assets $-1 $-1
|
2008/12 assets $-1 $-1
|
||||||
|
|
||||||
Note when using report intervals, if you specify start/end dates these
|
Note when using report intervals, if you specify start/end dates these
|
||||||
will be adjusted outward if necessary to contain a whole number of
|
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
|
The description and account columns normally share the space equally
|
||||||
(about half of (width - 40) each). You can adjust this by adding a
|
(about half of (width - 40) each). You can adjust this by adding a
|
||||||
description width as part of --width's argument, comma-separated:
|
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) ---------------------------------->
|
<--------------------------------- width (W) ---------------------------------->
|
||||||
date (10) description (D) account (W-41-D) amount (12) balance (12)
|
date (10) description (D) account (W-41-D) amount (12) balance (12)
|
||||||
DDDDDDDDDD dddddddddddddddddddd aaaaaaaaaaaaaaaaaaa AAAAAAAAAAAA AAAAAAAAAAAA
|
DDDDDDDDDD dddddddddddddddddddd aaaaaaaaaaaaaaaaaaa AAAAAAAAAAAA AAAAAAAAAAAA
|
||||||
|
|
||||||
and some examples:
|
and some examples:
|
||||||
|
|
||||||
$ hledger reg # use terminal width (or 80 on windows)
|
$ hledger reg # use terminal width (or 80 on windows)
|
||||||
$ hledger reg -w 100 # use width 100
|
$ hledger reg -w 100 # use width 100
|
||||||
$ COLUMNS=100 hledger reg # set with one-time environment variable
|
$ COLUMNS=100 hledger reg # set with one-time environment variable
|
||||||
$ export COLUMNS=100; hledger reg # set till session end (or window resize)
|
$ 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 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 output destination and output format
|
This command also supports output destination and output format
|
||||||
selection.
|
selection.
|
||||||
|
@ -13,26 +13,26 @@ transaction's first posting amount.
|
|||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
hledger-rewrite.hs ^income --add-posting '(liabilities:tax) *.33 ; income tax' --add-posting '(reserve:gifts) $100'
|
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 expenses:gifts --add-posting '(reserve:gifts) *-1"'
|
||||||
hledger-rewrite.hs -f rewrites.hledger
|
hledger-rewrite.hs -f rewrites.hledger
|
||||||
|
|
||||||
rewrites.hledger may consist of entries like:
|
rewrites.hledger may consist of entries like:
|
||||||
|
|
||||||
= ^income amt:<0 date:2017
|
= ^income amt:<0 date:2017
|
||||||
(liabilities:tax) *0.33 ; tax on income
|
(liabilities:tax) *0.33 ; tax on income
|
||||||
(reserve:grocery) *0.25 ; reserve 25% for grocery
|
(reserve:grocery) *0.25 ; reserve 25% for grocery
|
||||||
(reserve:) *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
|
Note the single quotes to protect the dollar sign from bash, and the two
|
||||||
spaces between account and amount.
|
spaces between account and amount.
|
||||||
|
|
||||||
More:
|
More:
|
||||||
|
|
||||||
$ hledger rewrite -- [QUERY] --add-posting "ACCT AMTEXPR" ...
|
$ hledger rewrite -- [QUERY] --add-posting "ACCT AMTEXPR" ...
|
||||||
$ hledger rewrite -- ^income --add-posting '(liabilities:tax) *.33'
|
$ hledger rewrite -- ^income --add-posting '(liabilities:tax) *.33'
|
||||||
$ hledger rewrite -- expenses:gifts --add-posting '(budget:gifts) *-1"'
|
$ hledger rewrite -- expenses:gifts --add-posting '(budget:gifts) *-1"'
|
||||||
$ hledger rewrite -- ^income --add-posting '(budget:foreign currency) *0.25 JPY; diversify'
|
$ hledger rewrite -- ^income --add-posting '(budget:foreign currency) *0.25 JPY; diversify'
|
||||||
|
|
||||||
Argument for --add-posting option is a usual posting of transaction with
|
Argument for --add-posting option is a usual posting of transaction with
|
||||||
an exception for amount specification. More precisely, you can use '*'
|
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
|
found in any journal it process. I.e instead of specifying this
|
||||||
operations in command line you can put them in a journal file.
|
operations in command line you can put them in a journal file.
|
||||||
|
|
||||||
$ rewrite-rules.journal
|
$ rewrite-rules.journal
|
||||||
|
|
||||||
Make contents look like this:
|
Make contents look like this:
|
||||||
|
|
||||||
= ^income
|
= ^income
|
||||||
(liabilities:tax) *.33
|
(liabilities:tax) *.33
|
||||||
|
|
||||||
= expenses:gifts
|
= expenses:gifts
|
||||||
budget:gifts *-1
|
budget:gifts *-1
|
||||||
assets:budget *1
|
assets:budget *1
|
||||||
|
|
||||||
Note that '=' (equality symbol) that is used instead of date in
|
Note that '=' (equality symbol) that is used instead of date in
|
||||||
transactions you usually write. It indicates the query by which you want
|
transactions you usually write. It indicates the query by which you want
|
||||||
to match the posting to add new ones.
|
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:
|
This is something similar to the commands pipeline:
|
||||||
|
|
||||||
$ hledger rewrite -- -f input.journal '^income' --add-posting '(liabilities:tax) *.33' \
|
$ hledger rewrite -- -f input.journal '^income' --add-posting '(liabilities:tax) *.33' \
|
||||||
| hledger rewrite -- -f - expenses:gifts --add-posting 'budget:gifts *-1' \
|
| hledger rewrite -- -f - expenses:gifts --add-posting 'budget:gifts *-1' \
|
||||||
--add-posting 'assets:budget *1' \
|
--add-posting 'assets:budget *1' \
|
||||||
> rewritten-tidy-output.journal
|
> rewritten-tidy-output.journal
|
||||||
|
|
||||||
It is important to understand that relative order of such entries in
|
It is important to understand that relative order of such entries in
|
||||||
journal is important. You can re-use result of previously added
|
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
|
To use this tool for batch modification of your journal files you may
|
||||||
find useful output in form of unified diff.
|
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:
|
Output might look like:
|
||||||
|
|
||||||
--- /tmp/examples/sample.journal
|
--- /tmp/examples/sample.journal
|
||||||
+++ /tmp/examples/sample.journal
|
+++ /tmp/examples/sample.journal
|
||||||
@@ -18,3 +18,4 @@
|
@@ -18,3 +18,4 @@
|
||||||
2008/01/01 income
|
2008/01/01 income
|
||||||
- assets:bank:checking $1
|
- assets:bank:checking $1
|
||||||
+ assets:bank:checking $1
|
+ assets:bank:checking $1
|
||||||
income:salary
|
income:salary
|
||||||
+ (liabilities:tax) 0
|
+ (liabilities:tax) 0
|
||||||
@@ -22,3 +23,4 @@
|
@@ -22,3 +23,4 @@
|
||||||
2008/06/01 gift
|
2008/06/01 gift
|
||||||
- assets:bank:checking $1
|
- assets:bank:checking $1
|
||||||
+ assets:bank:checking $1
|
+ assets:bank:checking $1
|
||||||
income:gifts
|
income:gifts
|
||||||
+ (liabilities:tax) 0
|
+ (liabilities:tax) 0
|
||||||
|
|
||||||
If you'll pass this through patch tool you'll get transactions
|
If you'll pass this through patch tool you'll get transactions
|
||||||
containing the posting that matches your query be updated. Note that
|
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:
|
thing, but with these differences:
|
||||||
|
|
||||||
- with multiple files, rewrite lets rules in any file affect all other
|
- with multiple files, rewrite lets rules in any file affect all other
|
||||||
files. print --auto uses standard directive scoping; rules affect
|
files. print --auto uses standard directive scoping; rules affect
|
||||||
only child files.
|
only child files.
|
||||||
|
|
||||||
- rewrite's query limits which transactions can be rewritten; all are
|
- 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.
|
- 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.
|
||||||
|
@ -9,17 +9,17 @@ each report period.
|
|||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
$ hledger stats
|
$ hledger stats
|
||||||
Main journal file : /src/hledger/examples/sample.journal
|
Main journal file : /src/hledger/examples/sample.journal
|
||||||
Included journal files :
|
Included journal files :
|
||||||
Transactions span : 2008-01-01 to 2009-01-01 (366 days)
|
Transactions span : 2008-01-01 to 2009-01-01 (366 days)
|
||||||
Last transaction : 2008-12-31 (2333 days ago)
|
Last transaction : 2008-12-31 (2333 days ago)
|
||||||
Transactions : 5 (0.0 per day)
|
Transactions : 5 (0.0 per day)
|
||||||
Transactions last 30 days: 0 (0.0 per day)
|
Transactions last 30 days: 0 (0.0 per day)
|
||||||
Transactions last 7 days : 0 (0.0 per day)
|
Transactions last 7 days : 0 (0.0 per day)
|
||||||
Payees/descriptions : 5
|
Payees/descriptions : 5
|
||||||
Accounts : 8 (depth 3)
|
Accounts : 8 (depth 3)
|
||||||
Commodities : 1 ($)
|
Commodities : 1 ($)
|
||||||
|
|
||||||
This command also supports output destination and output format
|
This command also supports output destination and output format
|
||||||
selection.
|
selection.
|
||||||
|
Loading…
Reference in New Issue
Block a user