update embedded manuals

This commit is contained in:
Simon Michael 2017-12-31 10:08:44 -08:00
parent 0d8ac2cd6f
commit 7921f0cf44
12 changed files with 680 additions and 645 deletions

View File

@ -365,6 +365,10 @@ Some examples:
.P
.PD
\f[C]EUR\ \-2.000.000,00\f[]
.PD 0
.P
.PD
\f[C]1\ 999\ 999.9455\f[]
.PP
As you can see, the amount format is somewhat flexible:
.IP \[bu] 2
@ -380,8 +384,11 @@ negative amounts with a commodity on the left can have the minus sign
before or after it
.IP \[bu] 2
digit groups (thousands, or any other grouping) can be separated by
commas (in which case period is used for decimal point) or periods (in
which case comma is used for decimal point)
space or comma or period and should be used as separator between all
groups
.IP \[bu] 2
decimal part can be separated by comma or period and should be different
from digit groups separator
.PP
You can use any of these variations when recording data.
However, there is some ambiguous way of representing numbers like
@ -1116,13 +1123,22 @@ followed by a period expression:
\f[]
.fi
.PP
Periodic transactions are used for budgeting and forecasting only, they
have no effect without the \f[C]\-\-forecast\f[] or \f[C]\-\-budget\f[]
option specified.
For examples and details, see Budgeting and Forecasting.
Periodic transactions are used for forecasting and budgeting only, they
have no effect unless the \f[C]\-\-forecast\f[] or \f[C]\-\-budget\f[]
flag is used.
With \f[C]\-\-forecast\f[], each periodic transaction rule generates
recurring forecast transactions at the specified interval, beginning the
day after the last recorded journal transaction and ending 6 months from
today, or at the specified report end date.
With \f[C]balance\ \-\-budget\f[], each periodic transaction declares
recurring budget goals for one or more accounts.
.PD 0
.P
.PD
For more details, see: balance > Budgeting, Budgeting and Forecasting.
.SH Automated posting rules
.PP
Autopated posting rule starts with an equal sign `=' in place of a date,
Automated posting rule starts with an equal sign `=' in place of a date,
followed by a query:
.IP
.nf

View File

@ -348,6 +348,7 @@ commodity name. Some examples:
'-$1,000,000.00'
'INR 9,99,99,999.00'
'EUR -2.000.000,00'
'1 999 999.9455'
As you can see, the amount format is somewhat flexible:
@ -360,8 +361,10 @@ commodity name. Some examples:
* negative amounts with a commodity on the left can have the minus
sign before or after it
* digit groups (thousands, or any other grouping) can be separated by
commas (in which case period is used for decimal point) or periods
(in which case comma is used for decimal point)
space or comma or period and should be used as separator between
all groups
* decimal part can be separated by comma or period and should be
different from digit groups separator
You can use any of these variations when recording data. However,
there is some ambiguous way of representing numbers like '$1.000' and
@ -1068,9 +1071,15 @@ followed by a period expression:
assets:bank:checking $400 ; paycheck
income:acme inc
Periodic transactions are used for budgeting and forecasting only,
they have no effect without the '--forecast' or '--budget' option
specified. For examples and details, see Budgeting and Forecasting.
Periodic transactions are used for forecasting and budgeting only,
they have no effect unless the '--forecast' or '--budget' flag is used.
With '--forecast', each periodic transaction rule generates recurring
forecast transactions at the specified interval, beginning the day after
the last recorded journal transaction and ending 6 months from today, or
at the specified report end date. With 'balance --budget', each
periodic transaction declares recurring budget goals for one or more
accounts.
For more details, see: balance > Budgeting, Budgeting and Forecasting.

File: hledger_journal.info, Node: Automated posting rules, Next: EDITOR SUPPORT, Prev: Periodic transactions, Up: Top
@ -1078,7 +1087,7 @@ File: hledger_journal.info, Node: Automated posting rules, Next: EDITOR SUPPOR
3 Automated posting rules
*************************
Autopated posting rule starts with an equal sign '=' in place of a date,
Automated posting rule starts with an equal sign '=' in place of a date,
followed by a query:
= expenses:gifts
@ -1162,65 +1171,65 @@ Node: Account names11244
Ref: #account-names11387
Node: Amounts11874
Ref: #amounts12010
Node: Virtual Postings14601
Ref: #virtual-postings14760
Node: Balance Assertions15980
Ref: #balance-assertions16155
Node: Assertions and ordering17051
Ref: #assertions-and-ordering17237
Node: Assertions and included files17937
Ref: #assertions-and-included-files18178
Node: Assertions and multiple -f options18511
Ref: #assertions-and-multiple--f-options18765
Node: Assertions and commodities18897
Ref: #assertions-and-commodities19132
Node: Assertions and subaccounts19828
Ref: #assertions-and-subaccounts20060
Node: Assertions and virtual postings20581
Ref: #assertions-and-virtual-postings20788
Node: Balance Assignments20930
Ref: #balance-assignments21099
Node: Prices22219
Ref: #prices22352
Node: Transaction prices22403
Ref: #transaction-prices22548
Node: Market prices24704
Ref: #market-prices24839
Node: Comments25799
Ref: #comments25921
Node: Tags27163
Ref: #tags27281
Node: Directives28683
Ref: #directives28796
Node: Account aliases28989
Ref: #account-aliases29133
Node: Basic aliases29737
Ref: #basic-aliases29880
Node: Regex aliases30570
Ref: #regex-aliases30738
Node: Multiple aliases31456
Ref: #multiple-aliases31628
Node: end aliases32126
Ref: #end-aliases32266
Node: account directive32367
Ref: #account-directive32547
Node: apply account directive32843
Ref: #apply-account-directive33039
Node: Multi-line comments33698
Ref: #multi-line-comments33888
Node: commodity directive34016
Ref: #commodity-directive34200
Node: Default commodity35072
Ref: #default-commodity35245
Node: Default year35782
Ref: #default-year35947
Node: Including other files36370
Ref: #including-other-files36527
Node: Periodic transactions36924
Ref: #periodic-transactions37095
Node: Automated posting rules37470
Ref: #automated-posting-rules37648
Node: EDITOR SUPPORT38757
Ref: #editor-support38887
Node: Virtual Postings14690
Ref: #virtual-postings14849
Node: Balance Assertions16069
Ref: #balance-assertions16244
Node: Assertions and ordering17140
Ref: #assertions-and-ordering17326
Node: Assertions and included files18026
Ref: #assertions-and-included-files18267
Node: Assertions and multiple -f options18600
Ref: #assertions-and-multiple--f-options18854
Node: Assertions and commodities18986
Ref: #assertions-and-commodities19221
Node: Assertions and subaccounts19917
Ref: #assertions-and-subaccounts20149
Node: Assertions and virtual postings20670
Ref: #assertions-and-virtual-postings20877
Node: Balance Assignments21019
Ref: #balance-assignments21188
Node: Prices22308
Ref: #prices22441
Node: Transaction prices22492
Ref: #transaction-prices22637
Node: Market prices24793
Ref: #market-prices24928
Node: Comments25888
Ref: #comments26010
Node: Tags27252
Ref: #tags27370
Node: Directives28772
Ref: #directives28885
Node: Account aliases29078
Ref: #account-aliases29222
Node: Basic aliases29826
Ref: #basic-aliases29969
Node: Regex aliases30659
Ref: #regex-aliases30827
Node: Multiple aliases31545
Ref: #multiple-aliases31717
Node: end aliases32215
Ref: #end-aliases32355
Node: account directive32456
Ref: #account-directive32636
Node: apply account directive32932
Ref: #apply-account-directive33128
Node: Multi-line comments33787
Ref: #multi-line-comments33977
Node: commodity directive34105
Ref: #commodity-directive34289
Node: Default commodity35161
Ref: #default-commodity35334
Node: Default year35871
Ref: #default-year36036
Node: Including other files36459
Ref: #including-other-files36616
Node: Periodic transactions37013
Ref: #periodic-transactions37184
Node: Automated posting rules37927
Ref: #automated-posting-rules38105
Node: EDITOR SUPPORT39214
Ref: #editor-support39344

End Tag Table

View File

@ -260,6 +260,7 @@ FILE FORMAT
-$1,000,000.00
INR 9,99,99,999.00
EUR -2.000.000,00
1 999 999.9455
As you can see, the amount format is somewhat flexible:
@ -275,14 +276,17 @@ FILE FORMAT
before or after it
o digit groups (thousands, or any other grouping) can be separated by
commas (in which case period is used for decimal point) or periods
(in which case comma is used for decimal point)
space or comma or period and should be used as separator between all
groups
You can use any of these variations when recording data. However,
there is some ambiguous way of representing numbers like $1.000 and
$1,000 both may mean either one thousand or one dollar. By default
hledger will assume that this is sole delimiter is used only for deci-
mals. On the other hand commodity format declared prior to that line
o decimal part can be separated by comma or period and should be dif-
ferent from digit groups separator
You can use any of these variations when recording data. However,
there is some ambiguous way of representing numbers like $1.000 and
$1,000 both may mean either one thousand or one dollar. By default
hledger will assume that this is sole delimiter is used only for deci-
mals. On the other hand commodity format declared prior to that line
will help to resolve that ambiguity differently:
commodity $1,000.00
@ -291,38 +295,38 @@ FILE FORMAT
expenses:gifts $1,000
assets
Though journal may contain mixed styles to represent amount, when
hledger displays amounts, it will choose a consistent format for each
commodity. (Except for price amounts, which are always formatted as
Though journal may contain mixed styles to represent amount, when
hledger displays amounts, it will choose a consistent format for each
commodity. (Except for price amounts, which are always formatted as
written). The display format is chosen as follows:
o if there is a commodity directive specifying the format, that is used
o otherwise the format is inferred from the first posting amount in
that commodity in the journal, and the precision (number of decimal
o otherwise the format is inferred from the first posting amount in
that commodity in the journal, and the precision (number of decimal
places) will be the maximum from all posting amounts in that commmod-
ity
o or if there are no such amounts in the journal, a default format is
o or if there are no such amounts in the journal, a default format is
used (like $1000.00).
Price amounts and amounts in D directives usually don't affect amount
format inference, but in some situations they can do so indirectly.
(Eg when D's default commodity is applied to a commodity-less amount,
Price amounts and amounts in D directives usually don't affect amount
format inference, but in some situations they can do so indirectly.
(Eg when D's default commodity is applied to a commodity-less amount,
or when an amountless posting is balanced using a price's commodity, or
when -V is used.) If you find this causing problems, set the desired
when -V is used.) If you find this causing problems, set the desired
format with a commodity directive.
Virtual Postings
When you parenthesise the account name in a posting, we call that a
When you parenthesise the account name in a posting, we call that a
virtual posting, which means:
o it is ignored when checking that the transaction is balanced
o it is excluded from reports when the --real/-R flag is used, or the
o it is excluded from reports when the --real/-R flag is used, or the
real:1 query.
You could use this, eg, to set an account's opening balance without
You could use this, eg, to set an account's opening balance without
needing to use the equity:opening balances account:
1/1 special unbalanced posting to set initial balance
@ -330,8 +334,8 @@ FILE FORMAT
When the account name is bracketed, we call it a balanced virtual post-
ing. This is like an ordinary virtual posting except the balanced vir-
tual postings in a transaction must balance to 0, like the real post-
ings (but separately from them). Balanced virtual postings are also
tual postings in a transaction must balance to 0, like the real post-
ings (but separately from them). Balanced virtual postings are also
excluded by --real/-R or real:1.
1/1 buy food with cash, and update some budget-tracking subaccounts elsewhere
@ -341,13 +345,13 @@ FILE FORMAT
[assets:checking:budget:food] $-10
Virtual postings have some legitimate uses, but those are few. You can
usually find an equivalent journal entry using real postings, which is
usually find an equivalent journal entry using real postings, which is
more correct and provides better error checking.
Balance Assertions
hledger supports Ledger-style balance assertions in journal files.
These look like =EXPECTEDBALANCE following a posting's amount. Eg in
this example we assert the expected dollar balance in accounts a and b
hledger supports Ledger-style balance assertions in journal files.
These look like =EXPECTEDBALANCE following a posting's amount. Eg in
this example we assert the expected dollar balance in accounts a and b
after each posting:
2013/1/1
@ -359,31 +363,31 @@ FILE FORMAT
b $-1 =$-2
After reading a journal file, hledger will check all balance assertions
and report an error if any of them fail. Balance assertions can pro-
tect you from, eg, inadvertently disrupting reconciled balances while
cleaning up old entries. You can disable them temporarily with the
--ignore-assertions flag, which can be useful for troubleshooting or
and report an error if any of them fail. Balance assertions can pro-
tect you from, eg, inadvertently disrupting reconciled balances while
cleaning up old entries. You can disable them temporarily with the
--ignore-assertions flag, which can be useful for troubleshooting or
for reading Ledger files.
Assertions and ordering
hledger sorts an account's postings and assertions first by date and
then (for postings on the same day) by parse order. Note this is dif-
hledger sorts an account's postings and assertions first by date and
then (for postings on the same day) by parse order. Note this is dif-
ferent from Ledger, which sorts assertions only by parse order. (Also,
Ledger assertions do not see the accumulated effect of repeated post-
Ledger assertions do not see the accumulated effect of repeated post-
ings to the same account within a transaction.)
So, hledger balance assertions keep working if you reorder differ-
ently-dated transactions within the journal. But if you reorder
So, hledger balance assertions keep working if you reorder differ-
ently-dated transactions within the journal. But if you reorder
same-dated transactions or postings, assertions might break and require
updating. This order dependence does bring an advantage: precise con-
updating. This order dependence does bring an advantage: precise con-
trol over the order of postings and assertions within a day, so you can
assert intra-day balances.
Assertions and included files
With included files, things are a little more complicated. Including
preserves the ordering of postings and assertions. If you have multi-
ple postings to an account on the same day, split across different
files, and you also want to assert the account's balance on the same
With included files, things are a little more complicated. Including
preserves the ordering of postings and assertions. If you have multi-
ple postings to an account on the same day, split across different
files, and you also want to assert the account's balance on the same
day, you'll have to put the assertion in the right file.
Assertions and multiple -f options
@ -391,21 +395,21 @@ FILE FORMAT
-f options. Use include or concatenate the files instead.
Assertions and commodities
The asserted balance must be a simple single-commodity amount, and in
fact the assertion checks only this commodity's balance within the
(possibly multi-commodity) account balance. We could call this a par-
tial balance assertion. This is compatible with Ledger, and makes it
The asserted balance must be a simple single-commodity amount, and in
fact the assertion checks only this commodity's balance within the
(possibly multi-commodity) account balance. We could call this a par-
tial balance assertion. This is compatible with Ledger, and makes it
possible to make assertions about accounts containing multiple commodi-
ties.
To assert each commodity's balance in such a multi-commodity account,
you can add multiple postings (with amount 0 if necessary). But note
that no matter how many assertions you add, you can't be sure the
To assert each commodity's balance in such a multi-commodity account,
you can add multiple postings (with amount 0 if necessary). But note
that no matter how many assertions you add, you can't be sure the
account does not contain some unexpected commodity. (We'll add support
for this kind of total balance assertion if there's demand.)
Assertions and subaccounts
Balance assertions do not count the balance from subaccounts; they
Balance assertions do not count the balance from subaccounts; they
check the posted account's exclusive balance. For example:
1/1
@ -413,7 +417,7 @@ FILE FORMAT
checking 1 = 1 ; post to the parent account, its exclusive balance is now 1
equity
The balance report's flat mode shows these exclusive balances more
The balance report's flat mode shows these exclusive balances more
clearly:
$ hledger bal checking --flat
@ -427,10 +431,10 @@ FILE FORMAT
tual. They are not affected by the --real/-R flag or real: query.
Balance Assignments
Ledger-style balance assignments are also supported. These are like
balance assertions, but with no posting amount on the left side of the
equals sign; instead it is calculated automatically so as to satisfy
the assertion. This can be a convenience during data entry, eg when
Ledger-style balance assignments are also supported. These are like
balance assertions, but with no posting amount on the left side of the
equals sign; instead it is calculated automatically so as to satisfy
the assertion. This can be a convenience during data entry, eg when
setting opening balances:
; starting a new journal, set asset account balances
@ -448,8 +452,8 @@ FILE FORMAT
expenses:misc
The calculated amount depends on the account's balance in the commodity
at that point (which depends on the previously-dated postings of the
commodity to that account since the last balance assertion or assign-
at that point (which depends on the previously-dated postings of the
commodity to that account since the last balance assertion or assign-
ment). Note that using balance assignments makes your journal a little
less explicit; to know the exact amount posted, you have to run hledger
or do the calculations yourself, instead of just reading it.
@ -457,12 +461,12 @@ FILE FORMAT
Prices
Transaction prices
Within a transaction, you can note an amount's price in another commod-
ity. This can be used to document the cost (in a purchase) or selling
price (in a sale). For example, transaction prices are useful to
ity. This can be used to document the cost (in a purchase) or selling
price (in a sale). For example, transaction prices are useful to
record purchases of a foreign currency.
Transaction prices are fixed, and do not change over time. (Ledger
users: Ledger uses a different syntax for fixed prices, {=UNITPRICE},
Transaction prices are fixed, and do not change over time. (Ledger
users: Ledger uses a different syntax for fixed prices, {=UNITPRICE},
which hledger currently ignores).
There are several ways to record a transaction price:
@ -486,9 +490,9 @@ FILE FORMAT
assets:euros 100 ; one hundred euros purchased
assets:dollars $-135 ; for $135
Amounts with transaction prices can be displayed in the transaction
Amounts with transaction prices can be displayed in the transaction
price's commodity by using the -B/--cost flag (except for #551) ("B" is
from "cost Basis"). Eg for the above, here is how -B affects the bal-
from "cost Basis"). Eg for the above, here is how -B affects the bal-
ance report:
$ hledger bal -N --flat
@ -498,8 +502,8 @@ FILE FORMAT
$-135 assets:dollars
$135 assets:euros # <- the euros' cost
Note -B is sensitive to the order of postings when a transaction price
is inferred: the inferred price will be in the commodity of the last
Note -B is sensitive to the order of postings when a transaction price
is inferred: the inferred price will be in the commodity of the last
amount. So if example 3's postings are reversed, while the transaction
is equivalent, -B shows something different:
@ -512,24 +516,24 @@ FILE FORMAT
100 assets:euros
Market prices
Market prices are not tied to a particular transaction; they represent
historical exchange rates between two commodities. (Ledger calls them
historical prices.) For example, the prices published by a stock
exchange or the foreign exchange market. hledger can use these prices
Market prices are not tied to a particular transaction; they represent
historical exchange rates between two commodities. (Ledger calls them
historical prices.) For example, the prices published by a stock
exchange or the foreign exchange market. hledger can use these prices
to show the market value of things at a given date, see market value.
To record market prices, use P directives in the main journal or in an
To record market prices, use P directives in the main journal or in an
included file. Their format is:
P DATE COMMODITYBEINGPRICED UNITPRICE
DATE is a simple date as usual. COMMODITYBEINGPRICED is the symbol of
the commodity being priced. UNITPRICE is an ordinary amount (symbol
and quantity) in a second commodity, specifying the unit price or con-
version rate for the first commodity in terms of the second, on the
DATE is a simple date as usual. COMMODITYBEINGPRICED is the symbol of
the commodity being priced. UNITPRICE is an ordinary amount (symbol
and quantity) in a second commodity, specifying the unit price or con-
version rate for the first commodity in terms of the second, on the
given date.
For example, the following directives say that one euro was worth 1.35
For example, the following directives say that one euro was worth 1.35
US dollars during 2009, and $1.40 from 2010 onward:
P 2009/1/1 $1.35
@ -537,18 +541,18 @@ FILE FORMAT
Comments
Lines in the journal beginning with a semicolon (;) or hash (#) or star
(*) are comments, and will be ignored. (Star comments cause org-mode
nodes to be ignored, allowing emacs users to fold and navigate their
(*) are comments, and will be ignored. (Star comments cause org-mode
nodes to be ignored, allowing emacs users to fold and navigate their
journals with org-mode or orgstruct-mode.)
Also, anything between comment and end comment directives is a
(multi-line) comment. If there is no end comment, the comment extends
Also, anything between comment and end comment directives is a
(multi-line) comment. If there is no end comment, the comment extends
to the end of the file.
You can attach comments to a transaction by writing them after the
description and/or indented on the following lines (before the post-
ings). Similarly, you can attach comments to an individual posting by
writing them after the amount and/or indented on the following lines.
You can attach comments to a transaction by writing them after the
description and/or indented on the following lines (before the post-
ings). Similarly, you can attach comments to an individual posting by
writing them after the amount and/or indented on the following lines.
Transaction and posting comments must begin with a semicolon (;).
Some examples:
@ -573,20 +577,20 @@ FILE FORMAT
; a file comment (because not indented)
Tags
Tags are a way to add extra labels or labelled data to postings and
Tags are a way to add extra labels or labelled data to postings and
transactions, which you can then search or pivot on.
A simple tag is a word (which may contain hyphens) followed by a full
A simple tag is a word (which may contain hyphens) followed by a full
colon, written inside a transaction or posting comment line:
2017/1/16 bought groceries ; sometag:
Tags can have a value, which is the text after the colon, up to the
Tags can have a value, which is the text after the colon, up to the
next comma or end of line, with leading/trailing whitespace removed:
expenses:food $10 ; a-posting-tag: the tag value
Note this means hledger's tag values can not contain commas or new-
Note this means hledger's tag values can not contain commas or new-
lines. Ending at commas means you can write multiple short tags on one
line, comma separated:
@ -600,21 +604,21 @@ FILE FORMAT
o "tag2" is another tag, whose value is "some value ..."
Tags in a transaction comment affect the transaction and all of its
postings, while tags in a posting comment affect only that posting.
For example, the following transaction has three tags (A, TAG2,
Tags in a transaction comment affect the transaction and all of its
postings, while tags in a posting comment affect only that posting.
For example, the following transaction has three tags (A, TAG2,
third-tag) and the posting has four (those plus posting-tag):
1/1 a transaction ; A:, TAG2:
; third-tag: a third transaction tag, <- with a value
(a) $1 ; posting-tag:
Tags are like Ledger's metadata feature, except hledger's tag values
Tags are like Ledger's metadata feature, except hledger's tag values
are simple strings.
Directives
Account aliases
You can define aliases which rewrite your account names (after reading
You can define aliases which rewrite your account names (after reading
the journal, before generating reports). hledger's account aliases can
be useful for:
@ -631,8 +635,8 @@ FILE FORMAT
See also Cookbook: rewrite account names.
Basic aliases
To set an account alias, use the alias directive in your journal file.
This affects all subsequent journal entries in the current file or its
To set an account alias, use the alias directive in your journal file.
This affects all subsequent journal entries in the current file or its
included files. The spaces around the = are optional:
alias OLD = NEW
@ -640,54 +644,54 @@ FILE FORMAT
Or, you can use the --alias 'OLD=NEW' option on the command line. This
affects all entries. It's useful for trying out aliases interactively.
OLD and NEW are full account names. hledger will replace any occur-
rence of the old account name with the new one. Subaccounts are also
OLD and NEW are full account names. hledger will replace any occur-
rence of the old account name with the new one. Subaccounts are also
affected. Eg:
alias checking = assets:bank:wells fargo:checking
# rewrites "checking" to "assets:bank:wells fargo:checking", or "checking:a" to "assets:bank:wells fargo:checking:a"
Regex aliases
There is also a more powerful variant that uses a regular expression,
There is also a more powerful variant that uses a regular expression,
indicated by the forward slashes:
alias /REGEX/ = REPLACEMENT
or --alias '/REGEX/=REPLACEMENT'.
REGEX is a case-insensitive regular expression. Anywhere it matches
inside an account name, the matched part will be replaced by REPLACE-
MENT. If REGEX contains parenthesised match groups, these can be ref-
REGEX is a case-insensitive regular expression. Anywhere it matches
inside an account name, the matched part will be replaced by REPLACE-
MENT. If REGEX contains parenthesised match groups, these can be ref-
erenced by the usual numeric backreferences in REPLACEMENT. Eg:
alias /^(.+):bank:([^:]+)(.*)/ = \1:\2 \3
# rewrites "assets:bank:wells fargo:checking" to "assets:wells fargo checking"
Also note that REPLACEMENT continues to the end of line (or on command
line, to end of option argument), so it can contain trailing white-
Also note that REPLACEMENT continues to the end of line (or on command
line, to end of option argument), so it can contain trailing white-
space.
Multiple aliases
You can define as many aliases as you like using directives or com-
mand-line options. Aliases are recursive - each alias sees the result
of applying previous ones. (This is different from Ledger, where
You can define as many aliases as you like using directives or com-
mand-line options. Aliases are recursive - each alias sees the result
of applying previous ones. (This is different from Ledger, where
aliases are non-recursive by default). Aliases are applied in the fol-
lowing order:
1. alias directives, most recently seen first (recent directives take
1. alias directives, most recently seen first (recent directives take
precedence over earlier ones; directives not yet seen are ignored)
2. alias options, in the order they appear on the command line
end aliases
You can clear (forget) all currently defined aliases with the
You can clear (forget) all currently defined aliases with the
end aliases directive:
end aliases
account directive
The account directive predefines account names, as in Ledger and Bean-
count. This may be useful for your own documentation; hledger doesn't
The account directive predefines account names, as in Ledger and Bean-
count. This may be useful for your own documentation; hledger doesn't
make use of it yet.
; account ACCT
@ -702,8 +706,8 @@ FILE FORMAT
; etc.
apply account directive
You can specify a parent account which will be prepended to all
accounts within a section of the journal. Use the apply account and
You can specify a parent account which will be prepended to all
accounts within a section of the journal. Use the apply account and
end apply account directives like so:
apply account home
@ -720,7 +724,7 @@ FILE FORMAT
home:food $10
home:cash $-10
If end apply account is omitted, the effect lasts to the end of the
If end apply account is omitted, the effect lasts to the end of the
file. Included files are also affected, eg:
apply account business
@ -729,16 +733,16 @@ FILE FORMAT
apply account personal
include personal.journal
Prior to hledger 1.0, legacy account and end spellings were also sup-
Prior to hledger 1.0, legacy account and end spellings were also sup-
ported.
Multi-line comments
A line containing just comment starts a multi-line comment, and a line
A line containing just comment starts a multi-line comment, and a line
containing just end comment ends it. See comments.
commodity directive
The commodity directive predefines commodities (currently this is just
informational), and also it may define the display format for amounts
The commodity directive predefines commodities (currently this is just
informational), and also it may define the display format for amounts
in this commodity (overriding the automatically inferred format).
It may be written on a single line, like this:
@ -750,8 +754,8 @@ FILE FORMAT
; separating thousands with comma.
commodity 1,000.0000 AAAA
or on multiple lines, using the "format" subdirective. In this case
the commodity symbol appears twice and should be the same in both
or on multiple lines, using the "format" subdirective. In this case
the commodity symbol appears twice and should be the same in both
places:
; commodity SYMBOL
@ -764,10 +768,10 @@ FILE FORMAT
format INR 9,99,99,999.00
Default commodity
The D directive sets a default commodity (and display format), to be
The D directive sets a default commodity (and display format), to be
used for amounts without a commodity symbol (ie, plain numbers). (Note
this differs from Ledger's default commodity directive.) The commodity
and display format will be applied to all subsequent commodity-less
this differs from Ledger's default commodity directive.) The commodity
and display format will be applied to all subsequent commodity-less
amounts, or until the next D directive.
# commodity-less amounts should be treated as dollars
@ -779,8 +783,8 @@ FILE FORMAT
b
Default year
You can set a default year to be used for subsequent dates which don't
specify a year. This is a line beginning with Y followed by the year.
You can set a default year to be used for subsequent dates which don't
specify a year. This is a line beginning with Y followed by the year.
Eg:
Y2009 ; set default year to 2009
@ -800,31 +804,36 @@ FILE FORMAT
assets
Including other files
You can pull in the content of additional journal files by writing an
You can pull in the content of additional journal files by writing an
include directive, like this:
include path/to/file.journal
If the path does not begin with a slash, it is relative to the current
If the path does not begin with a slash, it is relative to the current
file. Glob patterns (*) are not currently supported.
The include directive can only be used in journal files. It can
The include directive can only be used in journal files. It can
include journal, timeclock or timedot files, but not CSV files.
Periodic transactions
A periodic transaction starts with a tilde `~' in place of a date fol-
A periodic transaction starts with a tilde `~' in place of a date fol-
lowed by a period expression:
~ weekly
assets:bank:checking $400 ; paycheck
income:acme inc
Periodic transactions are used for budgeting and forecasting only, they
have no effect without the --forecast or --budget option specified.
For examples and details, see Budgeting and Forecasting.
Periodic transactions are used for forecasting and budgeting only, they
have no effect unless the --forecast or --budget flag is used. With
--forecast, each periodic transaction rule generates recurring forecast
transactions at the specified interval, beginning the day after the
last recorded journal transaction and ending 6 months from today, or at
the specified report end date. With balance --budget, each periodic
transaction declares recurring budget goals for one or more accounts.
For more details, see: balance > Budgeting, Budgeting and Forecasting.
Automated posting rules
Autopated posting rule starts with an equal sign `=' in place of a
Automated posting rule starts with an equal sign `=' in place of a
date, followed by a query:
= expenses:gifts
@ -870,13 +879,14 @@ EDITOR SUPPORT
Emacs http://www.ledger-cli.org/3.0/doc/ledger-mode.html
Vim https://github.com/ledger/ledger/wiki/Getting-started
Sublime Text https://github.com/ledger/ledger/wiki/Using-Sub-
lime-Text
Textmate https://github.com/ledger/ledger/wiki/Using-Text-
Mate-2
Text Wrangler https://github.com/ledger/ledger/wiki/Edit-
ing-Ledger-files-with-TextWrangler
Visual Studio https://marketplace.visualstudio.com/items?item-
Code Name=mark-hansen.hledger-vscode

View File

@ -188,18 +188,14 @@ most recent applicable market price, if any)
.RS
.RE
.TP
.B \f[C]\-\-forecast\f[]
generate forecast transactions from [periodic
transaction]((journal.html#periodic\-transactions) rules.
Each periodic transaction rule will generate forecast transactions,
beginning the day after the last recorded journal transaction, and
ending 6 months from today, or at the specified report end date.
.B \f[C]\-\-auto\f[]
apply automated posting rules to modify transactions.
.RS
.RE
.TP
.B \f[C]\-\-auto\f[]
apply automated posting rules to modify transactions where applicable
(can combine with \[en]forecast).
.B \f[C]\-\-forecast\f[]
apply periodic transaction rules to generate future transactions, to 6
months from now or report end date.
.RS
.RE
.PP

View File

@ -131,17 +131,13 @@ the data.
convert amounts to their market value on the report end date (using
the most recent applicable market price, if any)
'--forecast'
generate forecast transactions from [periodic
transaction]((journal.html#periodic-transactions) rules. Each
periodic transaction rule will generate forecast transactions,
beginning the day after the last recorded journal transaction, and
ending 6 months from today, or at the specified report end date.
'--auto'
apply automated posting rules to modify transactions where
applicable (can combine with -forecast).
apply automated posting rules to modify transactions.
'--forecast'
apply periodic transaction rules to generate future transactions,
to 6 months from now or report end date.
When a reporting option appears more than once in the command line,
the last one takes precedence.
@ -382,17 +378,17 @@ Tag Table:
Node: Top71
Node: OPTIONS827
Ref: #options924
Node: KEYS4356
Ref: #keys4451
Node: SCREENS7410
Ref: #screens7495
Node: Accounts screen7585
Ref: #accounts-screen7713
Node: Register screen9943
Ref: #register-screen10098
Node: Transaction screen12172
Ref: #transaction-screen12330
Node: Error screen13200
Ref: #error-screen13322
Node: KEYS4093
Ref: #keys4188
Node: SCREENS7147
Ref: #screens7232
Node: Accounts screen7322
Ref: #accounts-screen7450
Node: Register screen9680
Ref: #register-screen9835
Node: Transaction screen11909
Ref: #transaction-screen12067
Node: Error screen12937
Ref: #error-screen13059

End Tag Table

View File

@ -128,15 +128,11 @@ OPTIONS
convert amounts to their market value on the report end date
(using the most recent applicable market price, if any)
--forecast
generate forecast transactions from [periodic transac-
tion]((journal.html#periodic-transactions) rules. Each periodic
transaction rule will generate forecast transactions, beginning
the day after the last recorded journal transaction, and ending
6 months from today, or at the specified report end date.
--auto apply automated posting rules to modify transactions.
--auto apply automated posting rules to modify transactions where
applicable (can combine with -forecast).
--forecast
apply periodic transaction rules to generate future transac-
tions, to 6 months from now or report end date.
When a reporting option appears more than once in the command line, the
last one takes precedence.

View File

@ -243,18 +243,14 @@ most recent applicable market price, if any)
.RS
.RE
.TP
.B \f[C]\-\-forecast\f[]
generate forecast transactions from [periodic
transaction]((journal.html#periodic\-transactions) rules.
Each periodic transaction rule will generate forecast transactions,
beginning the day after the last recorded journal transaction, and
ending 6 months from today, or at the specified report end date.
.B \f[C]\-\-auto\f[]
apply automated posting rules to modify transactions.
.RS
.RE
.TP
.B \f[C]\-\-auto\f[]
apply automated posting rules to modify transactions where applicable
(can combine with \[en]forecast).
.B \f[C]\-\-forecast\f[]
apply periodic transaction rules to generate future transactions, to 6
months from now or report end date.
.RS
.RE
.PP

View File

@ -176,17 +176,13 @@ options as shown above.
convert amounts to their market value on the report end date (using
the most recent applicable market price, if any)
'--forecast'
generate forecast transactions from [periodic
transaction]((journal.html#periodic-transactions) rules. Each
periodic transaction rule will generate forecast transactions,
beginning the day after the last recorded journal transaction, and
ending 6 months from today, or at the specified report end date.
'--auto'
apply automated posting rules to modify transactions where
applicable (can combine with -forecast).
apply automated posting rules to modify transactions.
'--forecast'
apply periodic transaction rules to generate future transactions,
to 6 months from now or report end date.
When a reporting option appears more than once in the command line,
the last one takes precedence.

View File

@ -173,15 +173,11 @@ OPTIONS
convert amounts to their market value on the report end date
(using the most recent applicable market price, if any)
--forecast
generate forecast transactions from [periodic transac-
tion]((journal.html#periodic-transactions) rules. Each periodic
transaction rule will generate forecast transactions, beginning
the day after the last recorded journal transaction, and ending
6 months from today, or at the specified report end date.
--auto apply automated posting rules to modify transactions.
--auto apply automated posting rules to modify transactions where
applicable (can combine with -forecast).
--forecast
apply periodic transaction rules to generate future transac-
tions, to 6 months from now or report end date.
When a reporting option appears more than once in the command line, the
last one takes precedence.

View File

@ -298,18 +298,14 @@ most recent applicable market price, if any)
.RS
.RE
.TP
.B \f[C]\-\-forecast\f[]
generate forecast transactions from [periodic
transaction]((journal.html#periodic\-transactions) rules.
Each periodic transaction rule will generate forecast transactions,
beginning the day after the last recorded journal transaction, and
ending 6 months from today, or at the specified report end date.
.B \f[C]\-\-auto\f[]
apply automated posting rules to modify transactions.
.RS
.RE
.TP
.B \f[C]\-\-auto\f[]
apply automated posting rules to modify transactions where applicable
(can combine with \[en]forecast).
.B \f[C]\-\-forecast\f[]
apply periodic transaction rules to generate future transactions, to 6
months from now or report end date.
.RS
.RE
.PP
@ -739,19 +735,29 @@ Note that \f[C]weekly\f[], \f[C]monthly\f[], \f[C]quarterly\f[] and
month, quarter or year accordingly, and will end on the last day of same
period, even if associated period expression specifies different
explicit start and end date.
.SS For example:
.PP
For example:
.PP
.TS
tab(@);
l.
T{
\f[C]\-p\ "weekly\ from\ 2009/1/1\ to\ 2009/4/1"\f[] \[en] starts on
2008/12/29, closest preceeding Monday
T}
T{
\f[C]\-p\ "monthly\ in\ 2008/11/25"\f[] \[en] starts on 2018/11/01
.PD 0
.P
.PD
T}
T{
\f[C]\-p\ "quarterly\ from\ 2009\-05\-05\ to\ 2009\-06\-01"\f[] \-
starts on 2009/04/01, ends on 2009/06/30, which are first and last days
of Q2 2009 \f[C]\-p\ "yearly\ from\ 2009\-12\-29"\f[] \- starts on
2009/01/01, first day of 2009
\[em]\[em]\[em]\[em]\[em]\[em]\[em]\[em]\[em]\[em]\[em]\[em]\[em]\[em]
of Q2 2009
T}
T{
\f[C]\-p\ "yearly\ from\ 2009\-12\-29"\f[] \- starts on 2009/01/01,
first day of 2009
T}
.TE
.PP
The following more complex report intervals are also supported:
\f[C]biweekly\f[], \f[C]bimonthly\f[],
@ -919,15 +925,15 @@ The \f[C]\-B/\-\-cost\f[] flag converts amounts to their cost at
transaction time, if they have a transaction price specified.
.SS Market value
.PP
The \f[C]\-V/\-\-value\f[] flag converts the reported amounts to their
market value on the report end date, using the most recent applicable
market prices, when known.
The \f[C]\-V/\-\-value\f[] flag converts reported amounts to their
current market value.
Specifically, when there is a market price (P directive) for the
amount's commodity, dated on or before the report end date (see hledger
\-> Report start & end date), the amount will be converted to the
price's commodity.
If multiple applicable prices are defined, the latest\-dated one is used
(and if dates are equal, the one last parsed).
amount's commodity, dated on or before today's date (or the report end
date if specified), the amount will be converted to the price's
commodity.
.PP
When there are multiple applicable P directives, \-V chooses the most
recent one, or in case of equal dates, the last\-parsed one.
.PP
For example:
.IP
@ -976,8 +982,11 @@ $\ hledger\ \-f\ t.j\ bal\ euros\ \-V\ \-e\ 2016/12/21
.PP
Currently, hledger's \-V only uses market prices recorded with P
directives, not transaction prices (unlike Ledger).
.SS Combining \-B and \-V
.PP
Using \-B and \-V together is allowed.
Using \-B/\[en]cost and \-V/\[en]value together is currently allowed,
but the results are probably not meaningful.
Let us know if you find a use for this.
.SS Regular expressions
.PP
hledger uses regular expressions in a number of places:
@ -1439,26 +1448,25 @@ A file extension matching one of the above formats selects that format.
.RE
.TP
.B \f[C]\-\-pretty\-tables\f[]
Use unicode to display prettier tables.
use unicode to display prettier tables.
.RS
.RE
.TP
.B \f[C]\-\-sort\-amount\f[]
Sort by amount (total row amount, or by average if that is displayed),
instead of account name (in flat mode)
sort by amount instead of account name (in flat mode).
With multiple columns, sorts by the row total, or by row average if that
is displayed.
.RS
.RE
.TP
.B \f[C]\-\-budget\f[]
Treat periodic transaction as definition of a budget.
Compare real balances to budget balances and show percentage of budget
consumed.
show performance compared to budget goals defined by periodic
transactions
.RS
.RE
.TP
.B \f[C]\-\-show\-unbudgeted\f[]
When \[en]budget is used, display accounts that do not have budget
defined
with \[en]budget, show unbudgeted accounts also
.RS
.RE
.PP
@ -1671,10 +1679,11 @@ Balance\ changes\ in\ 2008:
.fi
.SS Budgets
.PP
The \f[C]\-\-budget\f[] flag will treat all [periodic
transaction]((journal.html#periodic\-transactions) in your journal as
definition of the budget and allow you to compare real balances versus
budgeted amounts.
With \f[C]\-\-budget\f[] and a report interval, all periodic
transactions in your journal with that interval, active during the
requested report period, are interpreted as recurring budget goals for
the specified accounts (and subaccounts), and the report will show the
difference between actual and budgeted balances.
.PP
For example, you can take average monthly expenses in the common expense
categories to construct a minimal monthly budget:
@ -1707,11 +1716,11 @@ categories to construct a minimal monthly budget:
\f[]
.fi
.PP
You can now compare real balances with budget:
You can now see a monthly budget performance report:
.IP
.nf
\f[C]
$\ hledge\ balance\ \-M\ \-\-budget
$\ hledger\ balance\ \-M\ \-\-budget
Balance\ changes\ in\ 2017/11/01\-2017/12/31:
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 2017/11\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 2017/12\
@ -1748,8 +1757,9 @@ Ending\ balances\ (cumulative)\ in\ 2017/11/01\-2017/12/31:
\f[]
.fi
.PP
Adding \f[C]\-\-show\-unbudgeted\f[] will allow you to see all the
accounts for which budgets:
Accounts with no budget goals (not mentioned in the periodic
transactions) will be aggregated under \f[C]<unbudgeted>\f[], unless you
add the \f[C]\-\-show\-unbudgeted\f[] flag to display them normally:
.IP
.nf
\f[C]
@ -2387,6 +2397,7 @@ valid journal output.
.PP
With \f[C]\-B\f[]/\f[C]\-\-cost\f[], amounts with transaction prices are
converted to cost using that price.
This can be used for troubleshooting.
.PP
With \f[C]\-m\f[]/\f[C]\-\-match\f[] and a STR argument, print will show
at most one transaction: the one one whose description is most similar

View File

@ -125,11 +125,11 @@ File: hledger.info, Node: OPTIONS, Next: QUERIES, Prev: EXAMPLES, Up: Top
* Report start & end date::
* Report intervals::
* Period expressions::
* For example::
* Depth limiting::
* Pivoting::
* Cost::
* Market value::
* Combining -B and -V::
* Regular expressions::

@ -232,17 +232,13 @@ by most hledger commands, run 'hledger -h'.
convert amounts to their market value on the report end date (using
the most recent applicable market price, if any)
'--forecast'
generate forecast transactions from [periodic
transaction]((journal.html#periodic-transactions) rules. Each
periodic transaction rule will generate forecast transactions,
beginning the day after the last recorded journal transaction, and
ending 6 months from today, or at the specified report end date.
'--auto'
apply automated posting rules to modify transactions where
applicable (can combine with -forecast).
apply automated posting rules to modify transactions.
'--forecast'
apply periodic transaction rules to generate future transactions,
to 6 months from now or report end date.
When a reporting option appears more than once in the command line,
the last one takes precedence.
@ -444,7 +440,7 @@ complex intervals may be specified with a period expression. Report
intervals can not be specified with a query, currently.

File: hledger.info, Node: Period expressions, Next: For example, Prev: Report intervals, Up: OPTIONS
File: hledger.info, Node: Period expressions, Next: Depth limiting, Prev: Report intervals, Up: OPTIONS
2.10 Period expressions
=======================
@ -504,18 +500,12 @@ accordingly, and will end on the last day of same period, even if
associated period expression specifies different explicit start and end
date.

File: hledger.info, Node: For example, Next: Depth limiting, Prev: Period expressions, Up: OPTIONS
For example:
2.11 For example:
=================
'-p "weekly from 2009/1/1 to 2009/4/1"' - starts on 2008/12/29, closest
preceeding Monday '-p "monthly in 2008/11/25"' - starts on 2018/11/01
'-p "quarterly from 2009-05-05 to 2009-06-01"' - starts on 2009/04/01,
ends on 2009/06/30, which are first and last days of Q2 2009 '-p "yearly
from 2009-12-29"' - starts on 2009/01/01, first day of 2009
----------------------------
'-p "weekly from 2009/1/1 to 2009/4/1"' - starts on 2008/12/29, closest preceeding Monday
'-p "monthly in 2008/11/25"' - starts on 2018/11/01
'-p "quarterly from 2009-05-05 to 2009-06-01"' - starts on 2009/04/01, ends on 2009/06/30, which are first and last days of Q2 2009
'-p "yearly from 2009-12-29"' - starts on 2009/01/01, first day of 2009
The following more complex report intervals are also supported:
'biweekly', 'bimonthly', 'every day|week|month|quarter|year', 'every N
@ -558,9 +548,9 @@ start date and exclusive end date):
'hledger register checking -p "every 3rd day of week"'

File: hledger.info, Node: Depth limiting, Next: Pivoting, Prev: For example, Up: OPTIONS
File: hledger.info, Node: Depth limiting, Next: Pivoting, Prev: Period expressions, Up: OPTIONS
2.12 Depth limiting
2.11 Depth limiting
===================
With the '--depth N' option (short form: '-N'), commands like account,
@ -572,7 +562,7 @@ less detail. This flag has the same effect as a 'depth:' query argument

File: hledger.info, Node: Pivoting, Next: Cost, Prev: Depth limiting, Up: OPTIONS
2.13 Pivoting
2.12 Pivoting
=============
Normally hledger sums amounts, and organizes them in a hierarchy, based
@ -629,26 +619,26 @@ $ hledger balance --pivot member acct:.

File: hledger.info, Node: Cost, Next: Market value, Prev: Pivoting, Up: OPTIONS
2.14 Cost
2.13 Cost
=========
The '-B/--cost' flag converts amounts to their cost at transaction time,
if they have a transaction price specified.

File: hledger.info, Node: Market value, Next: Regular expressions, Prev: Cost, Up: OPTIONS
File: hledger.info, Node: Market value, Next: Combining -B and -V, Prev: Cost, Up: OPTIONS
2.15 Market value
2.14 Market value
=================
The '-V/--value' flag converts the reported amounts to their market
value on the report end date, using the most recent applicable market
prices, when known. Specifically, when there is a market price (P
directive) for the amount's commodity, dated on or before the report end
date (see hledger -> Report start & end date), the amount will be
converted to the price's commodity. If multiple applicable prices are
defined, the latest-dated one is used (and if dates are equal, the one
last parsed).
The '-V/--value' flag converts reported amounts to their current market
value. Specifically, when there is a market price (P directive) for the
amount's commodity, dated on or before today's date (or the report end
date if specified), the amount will be converted to the price's
commodity.
When there are multiple applicable P directives, -V chooses the most
recent one, or in case of equal dates, the last-parsed one.
For example:
@ -682,10 +672,18 @@ $ hledger -f t.j bal euros -V -e 2016/12/21
Currently, hledger's -V only uses market prices recorded with P
directives, not transaction prices (unlike Ledger).
Using -B and -V together is allowed.

File: hledger.info, Node: Combining -B and -V, Next: Regular expressions, Prev: Market value, Up: OPTIONS
2.15 Combining -B and -V
========================
Using -B/-cost and -V/-value together is currently allowed, but the
results are probably not meaningful. Let us know if you find a use for
this.

File: hledger.info, Node: Regular expressions, Prev: Market value, Up: OPTIONS
File: hledger.info, Node: Regular expressions, Prev: Combining -B and -V, Up: OPTIONS
2.16 Regular expressions
========================
@ -1088,19 +1086,19 @@ Show accounts and their balances. Aliases: b, bal.
formats selects that format.
'--pretty-tables'
Use unicode to display prettier tables.
use unicode to display prettier tables.
'--sort-amount'
Sort by amount (total row amount, or by average if that is
displayed), instead of account name (in flat mode)
sort by amount instead of account name (in flat mode). With
multiple columns, sorts by the row total, or by row average if that
is displayed.
'--budget'
Treat periodic transaction as definition of a budget. Compare real
balances to budget balances and show percentage of budget consumed.
show performance compared to budget goals defined by periodic
transactions
'--show-unbudgeted'
When -budget is used, display accounts that do not have budget
defined
with -budget, show unbudgeted accounts also
The balance command displays accounts and balances. It is hledger's
most featureful and versatile command.
@ -1295,10 +1293,11 @@ File: hledger.info, Node: Budgets, Next: Custom balance output, Prev: Multico
4.4.4 Budgets
-------------
The '--budget' flag will treat all [periodic
transaction]((journal.html#periodic-transactions) in your journal as
definition of the budget and allow you to compare real balances versus
budgeted amounts.
With '--budget' and a report interval, all periodic transactions in your
journal with that interval, active during the requested report period,
are interpreted as recurring budget goals for the specified accounts
(and subaccounts), and the report will show the difference between
actual and budgeted balances.
For example, you can take average monthly expenses in the common
expense categories to construct a minimal monthly budget:
@ -1327,9 +1326,9 @@ expense categories to construct a minimal monthly budget:
expenses:gifts $100
assets:bank:checking
You can now compare real balances with budget:
You can now see a monthly budget performance report:
$ hledge balance -M --budget
$ hledger balance -M --budget
Balance changes in 2017/11/01-2017/12/31:
|| 2017/11 2017/12
@ -1359,8 +1358,9 @@ Ending balances (cumulative) in 2017/11/01-2017/12/31:
-----------------------++-------------------------------------------------
|| 0 0
Adding '--show-unbudgeted' will allow you to see all the accounts for
which budgets:
Accounts with no budget goals (not mentioned in the periodic
transactions) will be aggregated under '<unbudgeted>', unless you add
the '--show-unbudgeted' flag to display them normally:
$ hledger balance --budget --show-unbudgeted
Balance changes in 2017/11/01-2017/12/31:
@ -1913,7 +1913,7 @@ arise when a multi-commodity transaction has an implicit amount) will be
split into multiple single-commodity postings, for valid journal output.
With '-B'/'--cost', amounts with transaction prices are converted to
cost using that price.
cost using that price. This can be used for troubleshooting.
With '-m'/'--match' and a STR argument, print will show at most one
transaction: the one one whose description is most similar to STR, and
@ -2372,88 +2372,88 @@ Node: EXAMPLES1888
Ref: #examples1988
Node: OPTIONS3634
Ref: #options3736
Node: General options4052
Ref: #general-options4177
Node: Command options6991
Ref: #command-options7142
Node: Command arguments7540
Ref: #command-arguments7694
Node: Argument files7815
Ref: #argument-files7966
Node: Special characters8232
Ref: #special-characters8385
Node: Input files9804
Ref: #input-files9940
Node: Smart dates11910
Ref: #smart-dates12051
Node: Report start & end date13030
Ref: #report-start-end-date13200
Node: Report intervals14265
Ref: #report-intervals14428
Node: Period expressions14829
Ref: #period-expressions14986
Node: For example17031
Ref: #for-example17174
Node: Depth limiting19098
Ref: #depth-limiting19235
Node: Pivoting19577
Ref: #pivoting19695
Node: Cost21371
Ref: #cost21479
Node: Market value21597
Ref: #market-value21732
Node: Regular expressions23032
Ref: #regular-expressions23168
Node: QUERIES24529
Ref: #queries24631
Node: COMMANDS28598
Ref: #commands28710
Node: accounts29693
Ref: #accounts29791
Node: activity30784
Ref: #activity30894
Node: add31254
Ref: #add31353
Node: balance34014
Ref: #balance34125
Node: Flat mode37554
Ref: #flat-mode37679
Node: Depth limited balance reports38099
Ref: #depth-limited-balance-reports38300
Node: Multicolumn balance reports38720
Ref: #multicolumn-balance-reports38915
Node: Budgets43604
Ref: #budgets43751
Node: Custom balance output47367
Ref: #custom-balance-output47529
Node: Colour support49622
Ref: #colour-support49781
Node: Output destination49954
Ref: #output-destination50110
Node: CSV output50380
Ref: #csv-output50497
Node: balancesheet50894
Ref: #balancesheet51030
Node: balancesheetequity52998
Ref: #balancesheetequity53147
Node: cashflow53936
Ref: #cashflow54064
Node: check-dates55976
Ref: #check-dates56103
Node: check-dupes56220
Ref: #check-dupes56345
Node: equity56482
Ref: #equity56592
Node: help56755
Ref: #help56856
Node: import57930
Ref: #import58044
Node: incomestatement58774
Ref: #incomestatement58908
Node: prices60861
Ref: #prices60976
Node: print61019
Ref: #print61129
Node: General options4060
Ref: #general-options4185
Node: Command options6736
Ref: #command-options6887
Node: Command arguments7285
Ref: #command-arguments7439
Node: Argument files7560
Ref: #argument-files7711
Node: Special characters7977
Ref: #special-characters8130
Node: Input files9549
Ref: #input-files9685
Node: Smart dates11655
Ref: #smart-dates11796
Node: Report start & end date12775
Ref: #report-start-end-date12945
Node: Report intervals14010
Ref: #report-intervals14173
Node: Period expressions14574
Ref: #period-expressions14734
Node: Depth limiting18691
Ref: #depth-limiting18835
Node: Pivoting19177
Ref: #pivoting19295
Node: Cost20971
Ref: #cost21079
Node: Market value21197
Ref: #market-value21332
Node: Combining -B and -V22515
Ref: #combining--b-and--v22679
Node: Regular expressions22826
Ref: #regular-expressions22969
Node: QUERIES24330
Ref: #queries24432
Node: COMMANDS28399
Ref: #commands28511
Node: accounts29494
Ref: #accounts29592
Node: activity30585
Ref: #activity30695
Node: add31055
Ref: #add31154
Node: balance33815
Ref: #balance33926
Node: Flat mode37300
Ref: #flat-mode37425
Node: Depth limited balance reports37845
Ref: #depth-limited-balance-reports38046
Node: Multicolumn balance reports38466
Ref: #multicolumn-balance-reports38661
Node: Budgets43350
Ref: #budgets43497
Node: Custom balance output47328
Ref: #custom-balance-output47490
Node: Colour support49583
Ref: #colour-support49742
Node: Output destination49915
Ref: #output-destination50071
Node: CSV output50341
Ref: #csv-output50458
Node: balancesheet50855
Ref: #balancesheet50991
Node: balancesheetequity52959
Ref: #balancesheetequity53108
Node: cashflow53897
Ref: #cashflow54025
Node: check-dates55937
Ref: #check-dates56064
Node: check-dupes56181
Ref: #check-dupes56306
Node: equity56443
Ref: #equity56553
Node: help56716
Ref: #help56817
Node: import57891
Ref: #import58005
Node: incomestatement58735
Ref: #incomestatement58869
Node: prices60822
Ref: #prices60937
Node: print60980
Ref: #print61090
Node: print-unique65975
Ref: #print-unique66101
Node: register66169

View File

@ -202,15 +202,11 @@ OPTIONS
convert amounts to their market value on the report end date
(using the most recent applicable market price, if any)
--forecast
generate forecast transactions from [periodic transac-
tion]((journal.html#periodic-transactions) rules. Each periodic
transaction rule will generate forecast transactions, beginning
the day after the last recorded journal transaction, and ending
6 months from today, or at the specified report end date.
--auto apply automated posting rules to modify transactions.
--auto apply automated posting rules to modify transactions where
applicable (can combine with -forecast).
--forecast
apply periodic transaction rules to generate future transac-
tions, to 6 months from now or report end date.
When a reporting option appears more than once in the command line, the
last one takes precedence.
@ -458,13 +454,24 @@ OPTIONS
will end on the last day of same period, even if associated period
expression specifies different explicit start and end date.
For example:
-p "weekly from 2009/1/1 to 2009/4/1" - starts on 2008/12/29, closest
preceeding Monday -p "monthly in 2008/11/25" - starts on 2018/11/01
-p "quarterly from 2009-05-05 to 2009-06-01" - starts on 2009/04/01,
ends on 2009/06/30, which are first and last days of Q2 2009
-p "yearly from 2009-12-29" - starts on 2009/01/01, first day of 2009
----------------------------
For example:
-p "weekly from 2009/1/1 to 2009/4/1" -
starts on 2008/12/29, closest preceed-
ing Monday
-p "monthly in 2008/11/25" - starts on
2018/11/01
-p "quar-
terly from 2009-05-05 to 2009-06-01" -
starts on 2009/04/01, ends on
2009/06/30, which are first and last
days of Q2 2009
-p "yearly from 2009-12-29" - starts on
2009/01/01, first day of 2009
The following more complex report intervals are also supported:
biweekly, bimonthly, every day|week|month|quarter|year,
@ -582,13 +589,14 @@ OPTIONS
if they have a transaction price specified.
Market value
The -V/--value flag converts the reported amounts to their market value
on the report end date, using the most recent applicable market prices,
when known. Specifically, when there is a market price (P directive)
for the amount's commodity, dated on or before the report end date (see
hledger -> Report start & end date), the amount will be converted to
the price's commodity. If multiple applicable prices are defined, the
latest-dated one is used (and if dates are equal, the one last parsed).
The -V/--value flag converts reported amounts to their current market
value. Specifically, when there is a market price (P directive) for
the amount's commodity, dated on or before today's date (or the report
end date if specified), the amount will be converted to the price's
commodity.
When there are multiple applicable P directives, -V chooses the most
recent one, or in case of equal dates, the last-parsed one.
For example:
@ -622,7 +630,10 @@ OPTIONS
Currently, hledger's -V only uses market prices recorded with P direc-
tives, not transaction prices (unlike Ledger).
Using -B and -V together is allowed.
Combining -B and -V
Using -B/-cost and -V/-value together is currently allowed, but the
results are probably not meaningful. Let us know if you find a use for
this.
Regular expressions
hledger uses regular expressions in a number of places:
@ -980,22 +991,21 @@ COMMANDS
above formats selects that format.
--pretty-tables
Use unicode to display prettier tables.
use unicode to display prettier tables.
--sort-amount
Sort by amount (total row amount, or by average if that is dis-
played), instead of account name (in flat mode)
sort by amount instead of account name (in flat mode). With
multiple columns, sorts by the row total, or by row average if
that is displayed.
--budget
Treat periodic transaction as definition of a budget. Compare
real balances to budget balances and show percentage of budget
consumed.
show performance compared to budget goals defined by periodic
transactions
--show-unbudgeted
When -budget is used, display accounts that do not have budget
defined
with -budget, show unbudgeted accounts also
The balance command displays accounts and balances. It is hledger's
The balance command displays accounts and balances. It is hledger's
most featureful and versatile command.
$ hledger balance
@ -1012,25 +1022,25 @@ COMMANDS
--------------------
0
More precisely, the balance command shows the change to each account's
More precisely, the balance command shows the change to each account's
balance caused by all (matched) postings. In the common case where you
do not filter by date and your journal sets the correct opening bal-
do not filter by date and your journal sets the correct opening bal-
ances, this is the same as the account's ending balance.
By default, accounts are displayed hierarchically, with subaccounts
By default, accounts are displayed hierarchically, with subaccounts
indented below their parent. "Boring" accounts, which contain a single
interesting subaccount and no balance of their own, are elided into the
following line for more compact output. (Use --no-elide to prevent
this. Eliding of boring accounts is not yet supported in multicolumn
following line for more compact output. (Use --no-elide to prevent
this. Eliding of boring accounts is not yet supported in multicolumn
reports.)
Each account's balance is the "inclusive" balance - it includes the
Each account's balance is the "inclusive" balance - it includes the
balances of any subaccounts.
Accounts which have zero balance (and no non-zero subaccounts) are
Accounts which have zero balance (and no non-zero subaccounts) are
omitted. Use -E/--empty to show them.
A final total is displayed by default; use -N/--no-total to suppress
A final total is displayed by default; use -N/--no-total to suppress
it:
$ hledger balance -p 2008/6 expenses --no-total
@ -1040,9 +1050,9 @@ COMMANDS
Flat mode
To see a flat list of full account names instead of the default hierar-
chical display, use --flat. In this mode, accounts (unless
chical display, use --flat. In this mode, accounts (unless
depth-clipped) show their "exclusive" balance, excluding any subaccount
balances. In this mode, you can also use --drop N to omit the first
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
@ -1050,9 +1060,9 @@ COMMANDS
$1 supplies
Depth limited balance reports
With --depth N, balance shows accounts only to the specified depth.
This is very useful to show a complex charts of accounts in less
detail. In flat mode, balances from accounts below the depth limit
With --depth N, balance shows accounts only to the specified depth.
This is very useful to show a complex charts of accounts in less
detail. In flat mode, balances from accounts below the depth limit
will be shown as part of a parent account at the depth limit.
$ hledger balance -N --depth 1
@ -1062,12 +1072,12 @@ COMMANDS
$1 liabilities
Multicolumn balance reports
With a reporting interval, multiple balance columns will be shown, one
for each report period. There are three types of multi-column balance
With a reporting interval, multiple balance columns will be shown, one
for each report period. There are three types of multi-column balance
report, showing different information:
1. By default: each column shows the sum of postings in that period, ie
the account's change of balance in that period. This is useful eg
the account's change of balance in that period. This is useful eg
for a monthly income statement:
$ hledger balance --quarterly income expenses -E
@ -1082,8 +1092,8 @@ COMMANDS
-------------------++---------------------------------
|| $-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
2. With --cumulative: each column shows the ending balance for that
period, accumulating the changes across periods, starting from 0 at
the report start date:
$ hledger balance --quarterly income expenses -E --cumulative
@ -1099,8 +1109,8 @@ COMMANDS
|| $-1 0 0 0
3. With --historical/-H: each column shows the actual historical ending
balance for that period, accumulating the changes across periods,
starting from the actual balance at the report start date. This is
balance for that period, accumulating the changes across periods,
starting from the actual balance at the report start date. This is
useful eg for a multi-period balance sheet, and when you are showing
only the data after a certain start date:
@ -1116,26 +1126,26 @@ COMMANDS
----------------------++-------------------------------------
|| 0 0 0
Multi-column balance reports display accounts in flat mode by default;
Multi-column balance reports display accounts in flat mode by default;
to see the hierarchy, use --tree.
With a reporting interval (like --quarterly above), the report
start/end dates will be adjusted if necessary so that they encompass
With a reporting interval (like --quarterly above), the report
start/end dates will be adjusted if necessary so that they encompass
the displayed report periods. This is so that the first and last peri-
ods will be "full" and comparable to the others.
The -E/--empty flag does two things in multicolumn balance reports:
first, the report will show all columns within the specified report
period (without -E, leading and trailing columns with all zeroes are
not shown). Second, all accounts which existed at the report start
date will be considered, not just the ones with activity during the
The -E/--empty flag does two things in multicolumn balance reports:
first, the report will show all columns within the specified report
period (without -E, leading and trailing columns with all zeroes are
not shown). Second, all accounts which existed at the report start
date will be considered, not just the ones with activity during the
report period (use -E to include low-activity accounts which would oth-
erwise would be omitted).
The -T/--row-total flag adds an additional column showing the total for
each row.
The -A/--average flag adds a column showing the average value in each
The -A/--average flag adds a column showing the average value in each
row.
Here's an example of all three:
@ -1157,9 +1167,11 @@ COMMANDS
# Average is rounded to the dollar here since all journal amounts are
Budgets
The --budget flag will treat all [periodic transaction]((jour-
nal.html#periodic-transactions) in your journal as definition of the
budget and allow you to compare real balances versus budgeted amounts.
With --budget and a report interval, all periodic transactions in your
journal with that interval, active during the requested report period,
are interpreted as recurring budget goals for the specified accounts
(and subaccounts), and the report will show the difference between
actual and budgeted balances.
For example, you can take average monthly expenses in the common
expense categories to construct a minimal monthly budget:
@ -1188,9 +1200,9 @@ COMMANDS
expenses:gifts $100
assets:bank:checking
You can now compare real balances with budget:
You can now see a monthly budget performance report:
$ hledge balance -M --budget
$ hledger balance -M --budget
Balance changes in 2017/11/01-2017/12/31:
|| 2017/11 2017/12
@ -1220,8 +1232,9 @@ COMMANDS
-----------------------++-------------------------------------------------
|| 0 0
Adding --show-unbudgeted will allow you to see all the accounts for
which budgets:
Accounts with no budget goals (not mentioned in the periodic transac-
tions) will be aggregated under <unbudgeted>, unless you add the
--show-unbudgeted flag to display them normally:
$ hledger balance --budget --show-unbudgeted
Balance changes in 2017/11/01-2017/12/31:
@ -1241,7 +1254,7 @@ COMMANDS
For more examples and details, see Budgeting and Forecasting.
Custom balance output
In simple (non-multi-column) balance reports, you can customise the
In simple (non-multi-column) balance reports, you can customise the
output with --format FMT:
$ hledger balance --format "%20(account) %12(total)"
@ -1259,7 +1272,7 @@ COMMANDS
0
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
data fields interpolated like so:
%[MIN][.MAX](FIELDNAME)
@ -1270,14 +1283,14 @@ COMMANDS
o FIELDNAME must be enclosed in parentheses, and can be one of:
o depth_spacer - a number of spaces equal to the account's depth, or
o depth_spacer - a number of spaces equal to the account's depth, or
if MIN is specified, MIN * depth spaces.
o account - the account's name
o total - the account's balance/posted total, right justified
Also, FMT can begin with an optional prefix to control how multi-com-
Also, FMT can begin with an optional prefix to control how multi-com-
modity amounts are rendered:
o %_ - render on multiple lines, bottom-aligned (the default)
@ -1286,7 +1299,7 @@ COMMANDS
o %, - render on one line, comma-separated
There are some quirks. Eg in one-line mode, %(depth_spacer) has no
There are some quirks. Eg in one-line mode, %(depth_spacer) has no
effect, instead %(account) has indentation built in.
Experimentation may be needed to get pleasing results.
@ -1294,14 +1307,14 @@ COMMANDS
o %(total) - the account's total
o %-20.20(account) - the account's name, left justified, padded to 20
o %-20.20(account) - the account's name, left justified, padded to 20
characters and clipped at 20 characters
o %,%-50(account) %25(total) - account name padded to 50 characters,
total padded to 20 characters, with multiple commodities rendered on
o %,%-50(account) %25(total) - account name padded to 50 characters,
total padded to 20 characters, with multiple commodities rendered on
one line
o %20(total) %2(depth_spacer)%-(account) - the default format for the
o %20(total) %2(depth_spacer)%-(account) - the default format for the
single-column balance report
Colour support
@ -1312,8 +1325,8 @@ COMMANDS
o the output is not being redirected or piped anywhere
Output destination
The balance, print, register and stats commands can write their output
to a destination other than the console. This is controlled by the
The balance, print, register and stats commands can write their output
to a destination other than the console. This is controlled by the
-o/--output-file option.
$ hledger balance -o - # write to stdout (the default)
@ -1321,8 +1334,8 @@ COMMANDS
CSV output
The balance, print and register commands can write their output as CSV.
This is useful for exporting data to other applications, eg to make
charts in a spreadsheet. This is controlled by the -O/--output-format
This is useful for exporting data to other applications, eg to make
charts in a spreadsheet. This is controlled by the -O/--output-format
option, or by specifying a .csv file extension with -o/--output-file.
$ hledger balance -O csv # write CSV to stdout
@ -1336,7 +1349,7 @@ COMMANDS
balances
--cumulative
show balance change accumulated across periods (in multicolumn
show balance change accumulated across periods (in multicolumn
reports), instead of historical ending balances
-H --historical
@ -1370,8 +1383,8 @@ COMMANDS
--sort-amount
sort by amount instead of account name
This command displays a simple balance sheet. It currently assumes
that you have top-level accounts named asset and liability (plural
This command displays a simple balance sheet. It currently assumes
that you have top-level accounts named asset and liability (plural
forms also allowed.)
$ hledger balancesheet
@ -1394,19 +1407,19 @@ COMMANDS
0
With a reporting interval, multiple columns will be shown, one for each
report period. As with multicolumn balance reports, you can alter the
report mode with --change/--cumulative/--historical. Normally bal-
ancesheet shows historical ending balances, which is what you need for
report period. As with multicolumn balance reports, you can alter the
report mode with --change/--cumulative/--historical. Normally bal-
ancesheet shows historical ending balances, which is what you need for
a balance sheet; note this means it ignores report begin dates.
balancesheetequity
Show a balance sheet including equity. Alias: bse.
Other than showing the equity accounts, this command is exactly the
Other than showing the equity accounts, this command is exactly the
same as the command balancesheet. Please refer to it for the available
options.
This command displays a balancesheet. It currently assumes that you
This command displays a balancesheet. It currently assumes that you
have top-level accounts named asset, liability and equity (plural forms
also allowed.)
@ -1441,7 +1454,7 @@ COMMANDS
show balance change in each period (default)
--cumulative
show balance change accumulated across periods (in multicolumn
show balance change accumulated across periods (in multicolumn
reports), instead of changes during periods
-H --historical
@ -1475,9 +1488,9 @@ COMMANDS
--sort-amount
sort by amount instead of account name
This command displays a simple cashflow statement It shows the change
in all "cash" (ie, liquid assets) accounts for the period. It cur-
rently assumes that cash accounts are under a top-level account named
This command displays a simple cashflow statement It shows the change
in all "cash" (ie, liquid assets) accounts for the period. It cur-
rently assumes that cash accounts are under a top-level account named
asset and do not contain receivable, :A/R or :fixed.
$ hledger cashflow
@ -1495,33 +1508,33 @@ COMMANDS
$-1
With a reporting interval, multiple columns will be shown, one for each
report period. Normally cashflow shows changes in assets per period,
though as with multicolumn balance reports you can alter the report
report period. Normally cashflow shows changes in assets per period,
though as with multicolumn balance reports you can alter the report
mode with --change/--cumulative/--historical.
check-dates
Check that transactions are sorted by increasing date. With a query,
Check that transactions are sorted by increasing date. With a query,
only matched transactions' dates are checked.
check-dupes
Report account names having the same leaf but different prefixes. An
Report account names having the same leaf but different prefixes. An
example: http://stefanorodighiero.net/software/hledger-dupes.html
equity
Print closing/opening transactions that bring some or all account bal-
ances to zero and back. Can be useful for bringing account balances
Print closing/opening transactions that bring some or all account bal-
ances to zero and back. Can be useful for bringing account balances
across file boundaries.
help
Show any of the hledger manuals.
The help command displays any of the main hledger manuals, in one of
several ways. Run it with no argument to list the manuals, or provide
The help command displays any of the main hledger manuals, in one of
several ways. Run it with no argument to list the manuals, or provide
a full or partial manual name to select one.
hledger manuals are available in several formats. hledger help will
use the first of these display methods that it finds: info, man,
$PAGER, less, stdout (or when non-interactive, just stdout). You can
hledger manuals are available in several formats. hledger help will
use the first of these display methods that it finds: info, man,
$PAGER, less, stdout (or when non-interactive, just stdout). You can
force a particular viewer with the --info, --man, --pager, --cat flags.
$ hledger help
@ -1545,7 +1558,7 @@ COMMANDS
...
import
Read new transactions added to each FILE since last run, and add them
Read new transactions added to each FILE since last run, and add them
to the main journal file.
--dry-run
@ -1555,11 +1568,11 @@ COMMANDS
each one. So eg to add new transactions from all CSV files to the main
journal, it's just: hledger import *.csv
New transactions are detected in the same way as print -new: by assum-
New transactions are detected in the same way as print -new: by assum-
ing transactions are always added to the input files in increasing date
order, and by saving .latest.FILE state files.
The -dry-run output is in journal format, so you can filter it, eg to
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
@ -1571,7 +1584,7 @@ COMMANDS
show balance change in each period (default)
--cumulative
show balance change accumulated across periods (in multicolumn
show balance change accumulated across periods (in multicolumn
reports), instead of changes during periods
-H --historical
@ -1605,8 +1618,8 @@ COMMANDS
--sort-amount
sort by amount instead of account name
This command displays a simple income statement. It currently assumes
that you have top-level accounts named income (or revenue) and expense
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
@ -1631,8 +1644,8 @@ COMMANDS
0
With a reporting interval, multiple columns will be shown, one for each
report period. Normally incomestatement shows revenues/expenses per
period, though as with multicolumn balance reports you can alter the
report period. Normally incomestatement shows revenues/expenses per
period, though as with multicolumn balance reports you can alter the
report mode with --change/--cumulative/--historical.
prices
@ -1642,7 +1655,7 @@ COMMANDS
Show transactions from the journal. Aliases: p, txns.
-m STR --match=STR
show the transaction whose description is most similar to STR,
show the transaction whose description is most similar to STR,
and is most recent
--new show only newer-dated transactions added in each file since last
@ -1655,7 +1668,7 @@ COMMANDS
select the output format. Supported formats: txt, csv.
-o FILE --output-file=FILE
write output to FILE. A file extension matching one of the
write output to FILE. A file extension matching one of the
above formats selects that format.
$ hledger print
@ -1686,39 +1699,39 @@ COMMANDS
it does not preserve directives or inter-transaction comments
Normally, the journal entry's explicit or implicit amount style is pre-
served. Ie when an amount is omitted in the journal, it will be omit-
ted in the output. You can use the -x/--explicit flag to make all
served. Ie when an amount is omitted in the journal, it will be omit-
ted in the output. You can use the -x/--explicit flag to make all
amounts explicit, which can be useful for troubleshooting or for making
your journal more readable and robust against data entry errors. Note,
-x will cause postings with a multi-commodity amount (these can arise
when a multi-commodity transaction has an implicit amount) will be
split into multiple single-commodity postings, for valid journal out-
-x will cause postings with a multi-commodity amount (these can arise
when a multi-commodity transaction has an implicit amount) will be
split into multiple single-commodity postings, for valid journal out-
put.
With -B/--cost, amounts with transaction prices are converted to cost
using that price.
With -B/--cost, amounts with transaction prices are converted to cost
using that price. This can be used for troubleshooting.
With -m/--match and a STR argument, print will show at most one trans-
action: the one one whose description is most similar to STR, and is
most recent. STR should contain at least two characters. If there is
With -m/--match and a STR argument, print will show at most one trans-
action: the one one whose description is most similar to STR, and is
most recent. STR should contain at least two characters. If there is
no similar-enough match, no transaction will be shown.
With --new, for each FILE being read, hledger reads (and writes) a spe-
cial state file (.latest.FILE in the same directory), containing the
latest transaction date(s) that were seen last time FILE was read.
When this file is found, only transactions with newer dates (and new
transactions on the latest date) are printed. This is useful for
ignoring already-seen entries in import data, such as downloaded CSV
cial state file (.latest.FILE in the same directory), containing the
latest transaction date(s) that were seen last time FILE was read.
When this file is found, only transactions with newer dates (and new
transactions on the latest date) are printed. This is useful for
ignoring already-seen entries in import data, such as downloaded CSV
files. Eg:
$ hledger -f bank1.csv print --new
# shows transactions added since last print --new on this file
This assumes that transactions added to FILE always have same or
increasing dates, and that transactions on the same day do not get
This assumes that transactions added to FILE always have same or
increasing dates, and that transactions on the same day do not get
reordered. See also the import command.
The print command also supports output destination and CSV output.
The print command also supports output destination and CSV output.
Here's an example of print's CSV output:
$ hledger print -Ocsv
@ -1735,20 +1748,20 @@ COMMANDS
"5","2008/12/31","","*","","pay off","","liabilities:debts","1","$","","1","",""
"5","2008/12/31","","*","","pay off","","assets:bank:checking","-1","$","1","","",""
o There is one CSV record per posting, with the parent transaction's
o There is one CSV record per posting, with the parent transaction's
fields repeated.
o The "txnidx" (transaction index) field shows which postings belong to
the same transaction. (This number might change if transactions are
reordered within the file, files are parsed/included in a different
the same transaction. (This number might change if transactions are
reordered within the file, files are parsed/included in a different
order, etc.)
o The amount is separated into "commodity" (the symbol) and "amount"
o The amount is separated into "commodity" (the symbol) and "amount"
(numeric quantity) fields.
o The numeric amount is repeated in either the "credit" or "debit" col-
umn, for convenience. (Those names are not accurate in the account-
ing sense; it just puts negative amounts under credit and zero or
umn, for convenience. (Those names are not accurate in the account-
ing sense; it just puts negative amounts under credit and zero or
greater amounts under debit.)
print-unique
@ -1761,7 +1774,7 @@ COMMANDS
show running total from report start date (default)
-H --historical
show historical running total/balance (includes postings before
show historical running total/balance (includes postings before
report start date)
-A --average
@ -1772,18 +1785,18 @@ COMMANDS
show postings' siblings instead
-w N --width=N
set output width (default: terminal width or COLUMNS. -wN,M
set output width (default: terminal width or COLUMNS. -wN,M
sets description width as well)
-O FMT --output-format=FMT
select the output format. Supported formats: txt, csv.
-o FILE --output-file=FILE
write output to FILE. A file extension matching one of the
write output to FILE. A file extension matching one of the
above formats selects that format.
The register command displays postings, one per line, and their running
total. This is typically used with a query selecting a particular
total. This is typically used with a query selecting a particular
account, to see that account's activity:
$ hledger register checking
@ -1792,8 +1805,8 @@ COMMANDS
2008/06/02 save assets:bank:checking $-1 $1
2008/12/31 pay off assets:bank:checking $-1 0
The --historical/-H flag adds the balance from any undisplayed prior
postings to the running total. This is useful when you want to see
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
@ -1803,23 +1816,23 @@ COMMANDS
The --depth option limits the amount of sub-account detail displayed.
The --average/-A flag shows the running average posting amount instead
The --average/-A flag shows the running average posting amount instead
of the running total (so, the final number displayed is the average for
the whole report period). This flag implies --empty (see below). It
is affected by --historical. It works best when showing just one
the whole report period). This flag implies --empty (see below). It
is affected by --historical. It works best when showing just one
account and one commodity.
The --related/-r flag shows the other postings in the transactions of
The --related/-r flag shows the other postings in the transactions of
the postings which would normally be shown.
With a reporting interval, register shows summary postings, one per
With a reporting interval, register shows summary postings, one per
interval, aggregating the postings to each account:
$ hledger register --monthly income
2008/01 income:salary $-1 $-1
2008/06 income:gifts $-1 $-2
Periods with no activity, and summary postings with a zero amount, are
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
@ -1836,7 +1849,7 @@ COMMANDS
2008/11 0 $-2
2008/12 0 $-2
Often, you'll want to see just one line per interval. The --depth
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
@ -1844,18 +1857,18 @@ COMMANDS
2008/06 assets $-1 0
2008/12 assets $-1 $-1
Note when using report intervals, if you specify start/end dates these
will be adjusted outward if necessary to contain a whole number of
intervals. This ensures that the first and last intervals are full
Note when using report intervals, if you specify start/end dates these
will be adjusted outward if necessary to contain a whole number of
intervals. This ensures that the first and last intervals are full
length and comparable to the others in the report.
Custom register output
register uses the full terminal width by default, except on windows.
You can override this by setting the COLUMNS environment variable (not
register uses the full terminal width by default, except on windows.
You can override this by setting the COLUMNS environment variable (not
a bash shell variable) or by using the --width/-w option.
The description and account columns normally share the space equally
(about half of (width - 40) each). You can adjust this by adding a
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:
@ -1872,12 +1885,12 @@ COMMANDS
$ hledger reg -w 100,40 # set overall width 100, description width 40
$ hledger reg -w $COLUMNS,40 # use terminal width, and set description width
The register command also supports the -o/--output-file and -O/--out-
The register command also supports the -o/--output-file and -O/--out-
put-format options for controlling output destination and CSV output.
register-match
Print the one posting whose transaction description is closest to DESC,
in the style of the register command. Helps ledger-autosync detect
in the style of the register command. Helps ledger-autosync detect
already-seen transactions when importing.
rewrite
@ -1887,7 +1900,7 @@ COMMANDS
Show some journal statistics.
-o FILE --output-file=FILE
write output to FILE. A file extension matching one of the
write output to FILE. A file extension matching one of the
above formats selects that format.
$ hledger stats
@ -1902,16 +1915,16 @@ COMMANDS
Accounts : 8 (depth 3)
Commodities : 1 ($)
The stats command displays summary information for the whole journal,
or a matched part of it. With a reporting interval, it shows a report
The stats command displays summary information for the whole journal,
or a matched part of it. With a reporting interval, it shows a report
for each report period.
The stats command also supports -o/--output-file for controlling output
destination.
tags
List all the tag names used in the journal. With a TAGREGEX argument,
only tag names matching the regular expression (case insensitive) are
List all the tag names used in the journal. With a TAGREGEX argument,
only tag names matching the regular expression (case insensitive) are
shown. With additional QUERY arguments, only transactions matching the
query are considered.
@ -1921,34 +1934,34 @@ COMMANDS
$ hledger test
Cases: 74 Tried: 74 Errors: 0 Failures: 0
This command runs hledger's built-in unit tests and displays a quick
This command runs hledger's built-in unit tests and displays a quick
report. With a regular expression argument, it selects only tests with
matching names. It's mainly used in development, but it's also nice to
be able to check your hledger executable for smoke at any time.
ADD-ON COMMANDS
hledger also searches for external add-on commands, and will include
hledger also searches for external add-on commands, and will include
these in the commands list. These are programs or scripts in your PATH
whose name starts with hledger- and ends with a recognised file exten-
whose name starts with hledger- and ends with a recognised file exten-
sion (currently: no extension, bat,com,exe, hs,lhs,pl,py,rb,rkt,sh).
Add-ons can be invoked like any hledger command, but there are a few
Add-ons can be invoked like any hledger command, but there are a few
things to be aware of. Eg if the hledger-web add-on is installed,
o hledger -h web shows hledger's help, while hledger web -h shows
hledger-web's help.
o Flags specific to the add-on must have a preceding -- to hide them
from hledger. So hledger web --serve --port 9000 will be rejected;
o Flags specific to the add-on must have a preceding -- to hide them
from hledger. So hledger web --serve --port 9000 will be rejected;
you must use hledger web -- --serve --port 9000.
o You can always run add-ons directly if preferred:
o You can always run add-ons directly if preferred:
hledger-web --serve --port 9000.
Add-ons are a relatively easy way to add local features or experiment
with new ideas. They can be written in any language, but haskell
scripts have a big advantage: they can use the same hledger (and
haskell) library functions that built-in commands do, for command-line
Add-ons are a relatively easy way to add local features or experiment
with new ideas. They can be written in any language, but haskell
scripts have a big advantage: they can use the same hledger (and
haskell) library functions that built-in commands do, for command-line
options, journal parsing, reporting, etc.
Here are some hledger add-ons available:
@ -1966,7 +1979,7 @@ ADD-ON COMMANDS
hledger-web provides a simple web interface.
Third party add-ons
These are maintained separately, and usually updated shortly after a
These are maintained separately, and usually updated shortly after a
hledger release.
diff
@ -1974,7 +1987,7 @@ ADD-ON COMMANDS
journal file and another.
iadd
hledger-iadd is a curses-style, more interactive replacement for the
hledger-iadd is a curses-style, more interactive replacement for the
add command.
interest
@ -1982,19 +1995,19 @@ ADD-ON COMMANDS
ing to various schemes.
irr
hledger-irr calculates the internal rate of return of an investment
hledger-irr calculates the internal rate of return of an investment
account.
Experimental add-ons
These are available in source form in the hledger repo's bin/ direc-
These are available in source form in the hledger repo's bin/ direc-
tory; installing them is pretty easy. They may be less mature and doc-
umented than built-in commands. Reading and tweaking these is a good
umented than built-in commands. Reading and tweaking these is a good
way to start making your own!
autosync
hledger-autosync is a symbolic link for easily running ledger-autosync,
if installed. ledger-autosync does deduplicating conversion of OFX
data and some CSV formats, and can also download the data if your bank
if installed. ledger-autosync does deduplicating conversion of OFX
data and some CSV formats, and can also download the data if your bank
offers OFX Direct Connect.
budget
@ -2007,21 +2020,21 @@ ADD-ON COMMANDS
hledger-check.hs checks more powerful account balance assertions.
ENVIRONMENT
COLUMNS The screen width used by the register command. Default: the
COLUMNS The screen width used by the register command. Default: the
full terminal width.
LEDGER_FILE The journal file path when not specified with -f. Default:
~/.hledger.journal (on windows, perhaps C:/Users/USER/.hledger.jour-
~/.hledger.journal (on windows, perhaps C:/Users/USER/.hledger.jour-
nal).
FILES
Reads data from one or more files in hledger journal, timeclock, time-
dot, or CSV format specified with -f, or $LEDGER_FILE, or
$HOME/.hledger.journal (on windows, perhaps
Reads data from one or more files in hledger journal, timeclock, time-
dot, or CSV format specified with -f, or $LEDGER_FILE, or
$HOME/.hledger.journal (on windows, perhaps
C:/Users/USER/.hledger.journal).
BUGS
The need to precede addon command options with -- when invoked from
The need to precede addon command options with -- when invoked from
hledger is awkward.
When input data contains non-ascii characters, a suitable system locale
@ -2034,33 +2047,33 @@ BUGS
In a Cygwin/MSYS/Mintty window, the tab key is not supported in hledger
add.
Not all of Ledger's journal file syntax is supported. See file format
Not all of Ledger's journal file syntax is supported. See file format
differences.
On large data files, hledger is slower and uses more memory than
On large data files, hledger is slower and uses more memory than
Ledger.
TROUBLESHOOTING
Here are some issues you might encounter when you run hledger (and
remember you can also seek help from the IRC channel, mail list or bug
Here are some issues you might encounter when you run hledger (and
remember you can also seek help from the IRC channel, mail list or bug
tracker):
Successfully installed, but "No command `hledger' found"
stack and cabal install binaries into a special directory, which should
be added to your PATH environment variable. Eg on unix-like systems,
be added to your PATH environment variable. Eg on unix-like systems,
that is ~/.local/bin and ~/.cabal/bin respectively.
I set a custom LEDGER_FILE, but hledger is still using the default file
LEDGER_FILE should be a real environment variable, not just a shell
variable. The command env | grep LEDGER_FILE should show it. You may
LEDGER_FILE should be a real environment variable, not just a shell
variable. The command env | grep LEDGER_FILE should show it. You may
need to use export. Here's an explanation.
"Illegal byte sequence" or "Invalid or incomplete multibyte or wide
"Illegal byte sequence" or "Invalid or incomplete multibyte or wide
character" errors
In order to handle non-ascii letters and symbols (like ), hledger needs
an appropriate locale. This is usually configured system-wide; you can
also configure it temporarily. The locale may need to be one that sup-
ports UTF-8, if you built hledger with GHC < 7.2 (or possibly always,
ports UTF-8, if you built hledger with GHC < 7.2 (or possibly always,
I'm not sure yet).
Here's an example of setting the locale temporarily, on ubuntu
@ -2079,7 +2092,7 @@ TROUBLESHOOTING
$ echo "export LANG=en_US.UTF-8" >>~/.bash_profile
$ bash --login
If we preferred to use eg fr_FR.utf8, we might have to install that
If we preferred to use eg fr_FR.utf8, we might have to install that
first:
$ apt-get install language-pack-fr
@ -2100,7 +2113,7 @@ TROUBLESHOOTING
REPORTING BUGS
Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel
Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel
or hledger mail list)
@ -2114,7 +2127,7 @@ COPYRIGHT
SEE ALSO
hledger(1), hledger-ui(1), hledger-web(1), hledger-api(1),
hledger(1), hledger-ui(1), hledger-web(1), hledger-api(1),
hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_time-
dot(5), ledger(1)