doc: note an issue with balance assertions & multiple -f options

[ci skip]
This commit is contained in:
Simon Michael 2017-01-14 17:49:26 -08:00
parent d3883bad1f
commit d657374ac4
8 changed files with 563 additions and 499 deletions

View File

@ -368,6 +368,7 @@ might break and require updating.
This order dependence does bring an advantage: precise control over the This order dependence does bring an advantage: precise control over the
order of postings and assertions within a day, so you can assert order of postings and assertions within a day, so you can assert
intra\-day balances. intra\-day balances.
.SS Assertions and included files
.PP .PP
With included files, things are a little more complicated. With included files, things are a little more complicated.
Including preserves the ordering of postings and assertions. Including preserves the ordering of postings and assertions.
@ -375,6 +376,11 @@ If you have multiple postings to an account on the same day, split
across different files, and you also want to assert the account\[aq]s across different files, and you also want to assert the account\[aq]s
balance on the same day, you\[aq]ll have to put the assertion in the balance on the same day, you\[aq]ll have to put the assertion in the
right file. right file.
.SS Assertions and multiple \-f options
.PP
Balance assertions don\[aq]t work well across files specified with
multiple \-f options.
Use include or concatenate the files instead.
.SS Assertions and commodities .SS Assertions and commodities
.PP .PP
The asserted balance must be a simple single\-commodity amount, and in The asserted balance must be a simple single\-commodity amount, and in

View File

@ -361,12 +361,14 @@ for reading Ledger files.
* Menu: * Menu:
* Assertions and ordering:: * Assertions and ordering::
* Assertions and included files::
* Assertions and multiple -f options::
* Assertions and commodities:: * Assertions and commodities::
* Assertions and subaccounts:: * Assertions and subaccounts::
* Assertions and virtual postings:: * Assertions and virtual postings::
 
File: hledger_journal.5.info, Node: Assertions and ordering, Next: Assertions and commodities, Up: Balance Assertions File: hledger_journal.5.info, Node: Assertions and ordering, Next: Assertions and included files, Up: Balance Assertions
1.6.1 Assertions and ordering 1.6.1 Assertions and ordering
----------------------------- -----------------------------
@ -384,16 +386,31 @@ updating. This order dependence does bring an advantage: precise control
over the order of postings and assertions within a day, so you can over the order of postings and assertions within a day, so you can
assert intra-day balances. assert intra-day balances.
With included files, things are a little more complicated. Including 
File: hledger_journal.5.info, Node: Assertions and included files, Next: Assertions and multiple -f options, Prev: Assertions and ordering, Up: Balance Assertions
1.6.2 Assertions and included files
-----------------------------------
With included files, things are a little more complicated. Including
preserves the ordering of postings and assertions. If you have multiple preserves the ordering of postings and assertions. If you have multiple
postings to an account on the same day, split across different files, 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, 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. you'll have to put the assertion in the right file.
 
File: hledger_journal.5.info, Node: Assertions and commodities, Next: Assertions and subaccounts, Prev: Assertions and ordering, Up: Balance Assertions File: hledger_journal.5.info, Node: Assertions and multiple -f options, Next: Assertions and commodities, Prev: Assertions and included files, Up: Balance Assertions
1.6.2 Assertions and commodities 1.6.3 Assertions and multiple -f options
----------------------------------------
Balance assertions don't work well across files specified with multiple
-f options. Use include or concatenate the files instead.

File: hledger_journal.5.info, Node: Assertions and commodities, Next: Assertions and subaccounts, Prev: Assertions and multiple -f options, Up: Balance Assertions
1.6.4 Assertions and commodities
-------------------------------- --------------------------------
The asserted balance must be a simple single-commodity amount, and in The asserted balance must be a simple single-commodity amount, and in
@ -411,7 +428,7 @@ for this kind of total balance assertion if there's demand.)
 
File: hledger_journal.5.info, Node: Assertions and subaccounts, Next: Assertions and virtual postings, Prev: Assertions and commodities, Up: Balance Assertions File: hledger_journal.5.info, Node: Assertions and subaccounts, Next: Assertions and virtual postings, Prev: Assertions and commodities, Up: Balance Assertions
1.6.3 Assertions and subaccounts 1.6.5 Assertions and subaccounts
-------------------------------- --------------------------------
Balance assertions do not count the balance from subaccounts; they check Balance assertions do not count the balance from subaccounts; they check
@ -436,7 +453,7 @@ $ hledger bal checking --flat
 
File: hledger_journal.5.info, Node: Assertions and virtual postings, Prev: Assertions and subaccounts, Up: Balance Assertions File: hledger_journal.5.info, Node: Assertions and virtual postings, Prev: Assertions and subaccounts, Up: Balance Assertions
1.6.4 Assertions and virtual postings 1.6.6 Assertions and virtual postings
------------------------------------- -------------------------------------
Balance assertions are checked against all postings, both real and Balance assertions are checked against all postings, both real and
@ -984,53 +1001,57 @@ Node: Virtual Postings10420
Ref: #virtual-postings10581 Ref: #virtual-postings10581
Node: Balance Assertions11801 Node: Balance Assertions11801
Ref: #balance-assertions11978 Ref: #balance-assertions11978
Node: Assertions and ordering12800 Node: Assertions and ordering12873
Ref: #assertions-and-ordering12985 Ref: #assertions-and-ordering13061
Node: Assertions and commodities14016 Node: Assertions and included files13758
Ref: #assertions-and-commodities14242 Ref: #assertions-and-included-files14001
Node: Assertions and subaccounts14934 Node: Assertions and multiple -f options14332
Ref: #assertions-and-subaccounts15168 Ref: #assertions-and-multiple--f-options14588
Node: Assertions and virtual postings15690 Node: Assertions and commodities14719
Ref: #assertions-and-virtual-postings15899 Ref: #assertions-and-commodities14956
Node: Balance Assignments16040 Node: Assertions and subaccounts15648
Ref: #balance-assignments16209 Ref: #assertions-and-subaccounts15882
Node: Prices17327 Node: Assertions and virtual postings16404
Ref: #prices17460 Ref: #assertions-and-virtual-postings16613
Node: Transaction prices17511 Node: Balance Assignments16754
Ref: #transaction-prices17656 Ref: #balance-assignments16923
Node: Market prices19236 Node: Prices18041
Ref: #market-prices19371 Ref: #prices18174
Node: Comments20371 Node: Transaction prices18225
Ref: #comments20493 Ref: #transaction-prices18370
Node: Tags21605 Node: Market prices19950
Ref: #tags21725 Ref: #market-prices20085
Node: Directives22648 Node: Comments21085
Ref: #directives22763 Ref: #comments21207
Node: Account aliases22956 Node: Tags22319
Ref: #account-aliases23102 Ref: #tags22439
Node: Basic aliases23704 Node: Directives23362
Ref: #basic-aliases23849 Ref: #directives23477
Node: Regex aliases24537 Node: Account aliases23670
Ref: #regex-aliases24707 Ref: #account-aliases23816
Node: Multiple aliases25477 Node: Basic aliases24418
Ref: #multiple-aliases25651 Ref: #basic-aliases24563
Node: end aliases26147 Node: Regex aliases25251
Ref: #end-aliases26289 Ref: #regex-aliases25421
Node: account directive26391 Node: Multiple aliases26191
Ref: #account-directive26573 Ref: #multiple-aliases26365
Node: apply account directive26869 Node: end aliases26861
Ref: #apply-account-directive27067 Ref: #end-aliases27003
Node: Multi-line comments27727 Node: account directive27105
Ref: #multi-line-comments27919 Ref: #account-directive27287
Node: commodity directive28046 Node: apply account directive27583
Ref: #commodity-directive28232 Ref: #apply-account-directive27781
Node: Default commodity29105 Node: Multi-line comments28441
Ref: #default-commodity29280 Ref: #multi-line-comments28633
Node: Default year29816 Node: commodity directive28760
Ref: #default-year29983 Ref: #commodity-directive28946
Node: Including other files30406 Node: Default commodity29819
Ref: #including-other-files30565 Ref: #default-commodity29994
Node: EDITOR SUPPORT30961 Node: Default year30530
Ref: #editor-support31081 Ref: #default-year30697
Node: Including other files31120
Ref: #including-other-files31279
Node: EDITOR SUPPORT31675
Ref: #editor-support31795
 
End Tag Table End Tag Table

View File

@ -290,6 +290,8 @@ updating. This order dependence does bring an advantage: precise
control over the order of postings and assertions within a day, so you control over the order of postings and assertions within a day, so you
can assert intra-day balances. can assert intra-day balances.
### Assertions and included files
With [included files](#including-other-files), things are a little With [included files](#including-other-files), things are a little
more complicated. Including preserves the ordering of postings and more complicated. Including preserves the ordering of postings and
assertions. If you have multiple postings to an account on the same assertions. If you have multiple postings to an account on the same
@ -297,6 +299,11 @@ 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 account's balance on the same day, you'll have to put the assertion
in the right file. in the right file.
### Assertions and multiple -f options
Balance assertions don't work well across files specified
with multiple -f options. Use include or [concatenate the files](/hledger.html#input-files)
instead.
### Assertions and commodities ### Assertions and commodities

View File

@ -287,28 +287,33 @@ FILE FORMAT
trol over the order of postings and assertions within a day, so you can trol over the order of postings and assertions within a day, so you can
assert intra-day balances. assert intra-day balances.
Assertions and included files
With included files, things are a little more complicated. Including With included files, things are a little more complicated. Including
preserves the ordering of postings and assertions. If you have multi- preserves the ordering of postings and assertions. If you have multi-
ple postings to an account on the same day, split across different 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 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. day, you'll have to put the assertion in the right file.
Assertions and multiple -f options
Balance assertions don't work well across files specified with multiple
-f options. Use include or concatenate the files instead.
Assertions and commodities Assertions and commodities
The asserted balance must be a simple single-commodity amount, and in The asserted balance must be a simple single-commodity amount, and in
fact the assertion checks only this commodity's balance within the fact the assertion checks only this commodity's balance within the
(possibly multi-commodity) account balance. We could call this a par- (possibly multi-commodity) account balance. We could call this a par-
tial balance assertion. This is compatible with Ledger, and makes it tial balance assertion. This is compatible with Ledger, and makes it
possible to make assertions about accounts containing multiple commodi- possible to make assertions about accounts containing multiple commodi-
ties. ties.
To assert each commodity's balance in such a multi-commodity account, To assert each commodity's balance in such a multi-commodity account,
you can add multiple postings (with amount 0 if necessary). But note you can add multiple postings (with amount 0 if necessary). But note
that no matter how many assertions you add, you can't be sure the that no matter how many assertions you add, you can't be sure the
account does not contain some unexpected commodity. (We'll add support account does not contain some unexpected commodity. (We'll add support
for this kind of total balance assertion if there's demand.) for this kind of total balance assertion if there's demand.)
Assertions and subaccounts 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: check the posted account's exclusive balance. For example:
1/1 1/1
@ -316,7 +321,7 @@ FILE FORMAT
checking 1 = 1 ; post to the parent account, its exclusive balance is now 1 checking 1 = 1 ; post to the parent account, its exclusive balance is now 1
equity equity
The balance report's flat mode shows these exclusive balances more The balance report's flat mode shows these exclusive balances more
clearly: clearly:
$ hledger bal checking --flat $ hledger bal checking --flat
@ -330,10 +335,10 @@ FILE FORMAT
tual. They are not affected by the --real/-R flag or real: query. tual. They are not affected by the --real/-R flag or real: query.
Balance Assignments Balance Assignments
Ledger-style balance assignments are also supported. These are like Ledger-style balance assignments are also supported. These are like
balance assertions, but with no posting amount on the left side of the balance assertions, but with no posting amount on the left side of the
equals sign; instead it is calculated automatically so as to satisfy equals sign; instead it is calculated automatically so as to satisfy
the assertion. This can be a convenience during data entry, eg when the assertion. This can be a convenience during data entry, eg when
setting opening balances: setting opening balances:
; starting a new journal, set asset account balances ; starting a new journal, set asset account balances
@ -351,27 +356,27 @@ FILE FORMAT
expenses:misc expenses:misc
The calculated amount depends on the account's balance in the commodity The calculated amount depends on the account's balance in the commodity
at that point (which depends on the previously-dated postings of the at that point (which depends on the previously-dated postings of the
commodity to that account since the last balance assertion or assign- commodity to that account since the last balance assertion or assign-
ment). Note that using balance assignments makes your journal a little ment). Note that using balance assignments makes your journal a little
less explicit; to know the exact amount posted, you have to run hledger less explicit; to know the exact amount posted, you have to run hledger
or do the calculations yourself, instead of just reading it. or do the calculations yourself, instead of just reading it.
Prices Prices
Transaction prices Transaction prices
Within a transaction posting, you can record an amount's price in Within a transaction posting, you can record an amount's price in
another commodity. This can be used to document the cost (for a pur- another commodity. This can be used to document the cost (for a pur-
chase), or selling price (for a sale), or the exchange rate that was chase), or selling price (for a sale), or the exchange rate that was
used, for this transaction. These transaction prices are fixed, and do used, for this transaction. These transaction prices are fixed, and do
not change over time. not change over time.
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 --cost/-B flag supported by most price's commodity, by using the --cost/-B flag supported by most
hledger commands (mnemonic: "cost Basis"). hledger commands (mnemonic: "cost Basis").
There are several ways to record a transaction price: There are several ways to record a transaction price:
1. Write the unit price (aka exchange rate), as @ UNITPRICE after the 1. Write the unit price (aka exchange rate), as @ UNITPRICE after the
amount: amount:
2009/1/1 2009/1/1
@ -385,7 +390,7 @@ FILE FORMAT
assets:cash assets:cash
3. Or let hledger infer the price so as to balance the transaction. To 3. Or let hledger infer the price so as to balance the transaction. To
permit this, you must fully specify all posting amounts, and their permit this, you must fully specify all posting amounts, and their
sum must have a non-zero amount in exactly two commodities: sum must have a non-zero amount in exactly two commodities:
2009/1/1 2009/1/1
@ -399,46 +404,46 @@ FILE FORMAT
assets:foreign currency $135.00 assets:foreign currency $135.00
assets:cash $-135.00 assets:cash $-135.00
Example use for transaction prices: recording the effective conversion Example use for transaction prices: recording the effective conversion
rate of purchases made in a foreign currency. rate of purchases made in a foreign currency.
Market prices Market prices
Market prices are not tied to a particular transaction; they represent Market prices are not tied to a particular transaction; they represent
historical exchange rates between two commodities. (Ledger calls them historical exchange rates between two commodities. (Ledger calls them
historical prices.) For example, the prices published by a stock historical prices.) For example, the prices published by a stock
exchange or the foreign exchange market. Some commands (balance, cur- exchange or the foreign exchange market. Some commands (balance, cur-
rently) can use this information to show the market value of things at rently) can use this information to show the market value of things at
a given date. a given date.
To record market prices, use P directives in the main journal or in an To record market prices, use P directives in the main journal or in an
included file. Their format is: included file. Their format is:
P DATE COMMODITYBEINGPRICED UNITPRICE P DATE COMMODITYBEINGPRICED UNITPRICE
DATE is a simple date as usual. COMMODITYBEINGPRICED is the symbol of DATE is a simple date as usual. COMMODITYBEINGPRICED is the symbol of
the commodity being priced (just the symbol, no quantity). UNITPRICE the commodity being priced (just the symbol, no quantity). UNITPRICE
is an ordinary amount (symbol and quantity) in a second commodity, is an ordinary amount (symbol and quantity) in a second commodity,
specifying the unit price or conversion rate for the first commodity in specifying the unit price or conversion rate for the first commodity in
terms of the second, on the given date. 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: US dollars during 2009, and $1.40 from 2010 onward:
P 2009/1/1 $1.35 P 2009/1/1 $1.35
P 2010/1/1 $1.40 P 2010/1/1 $1.40
Comments Comments
Lines in the journal beginning with a semicolon (;) or hash (#) or Lines in the journal beginning with a semicolon (;) or hash (#) or
asterisk (*) are comments, and will be ignored. (Asterisk comments asterisk (*) are comments, and will be ignored. (Asterisk comments
make it easy to treat your journal like an org-mode outline in emacs.) make it easy to treat your journal like an org-mode outline in emacs.)
Also, anything between comment and end comment directives is a Also, anything between comment and end comment directives is a
(multi-line) comment. If there is no end comment, the comment extends (multi-line) comment. If there is no end comment, the comment extends
to the end of the file. to the end of the file.
You can attach comments to a transaction by writing them after the You can attach comments to a transaction by writing them after the
description and/or indented on the following lines (before the post- description and/or indented on the following lines (before the post-
ings). Similarly, you can attach comments to an individual posting by ings). Similarly, you can attach comments to an individual posting by
writing them after the amount and/or indented on the following lines. writing them after the amount and/or indented on the following lines.
Some examples: Some examples:
@ -463,30 +468,30 @@ FILE FORMAT
; a journal comment (because not indented) ; a journal comment (because not indented)
Tags Tags
A tag is a word followed by a full colon inside a transaction or post- A tag is a word followed by a full colon inside a transaction or post-
ing comment. You can write multiple tags, comma separated. Eg: ing comment. You can write multiple tags, comma separated. Eg:
; a comment containing sometag:, anothertag:. You can search for tags ; a comment containing sometag:, anothertag:. You can search for tags
with the tag: query. with the tag: query.
A tag can also have a value, which is any text between the colon and A tag can also have a value, which is any text between the colon and
the next comma or newline, excluding leading/trailing whitespace. (So the next comma or newline, excluding leading/trailing whitespace. (So
hledger tag values can not contain commas or newlines). hledger tag values can not contain commas or newlines).
Tags in a transaction comment affect the transaction and all of its Tags in a transaction comment affect the transaction and all of its
postings, while tags in a posting comment affect only that posting. postings, while tags in a posting comment affect only that posting.
For example, the following transaction has three tags (A, TAG2, For example, the following transaction has three tags (A, TAG2,
third-tag) and the posting has four (A, TAG2, third-tag, posting-tag): third-tag) and the posting has four (A, TAG2, third-tag, posting-tag):
1/1 a transaction ; A:, TAG2: 1/1 a transaction ; A:, TAG2:
; third-tag: a third transaction tag, this time with a value ; third-tag: a third transaction tag, this time with a value
(a) $1 ; posting-tag: (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. are simple strings.
Directives Directives
Account aliases 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 the journal, before generating reports). hledger's account aliases can
be useful for: be useful for:
@ -503,8 +508,8 @@ FILE FORMAT
See also How to use account aliases. See also How to use account aliases.
Basic aliases Basic aliases
To set an account alias, use the alias directive in your journal file. 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 This affects all subsequent journal entries in the current file or its
included files. The spaces around the = are optional: included files. The spaces around the = are optional:
alias OLD = NEW alias OLD = NEW
@ -512,53 +517,53 @@ FILE FORMAT
Or, you can use the --alias 'OLD=NEW' option on the command line. This 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. affects all entries. It's useful for trying out aliases interactively.
OLD and NEW are full account names. hledger will replace any occur- 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 rence of the old account name with the new one. Subaccounts are also
affected. Eg: affected. Eg:
alias checking = assets:bank:wells fargo:checking 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" # rewrites "checking" to "assets:bank:wells fargo:checking", or "checking:a" to "assets:bank:wells fargo:checking:a"
Regex aliases 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. (This was the default behaviour in indicated by the forward slashes. (This was the default behaviour in
hledger 0.24-0.25): hledger 0.24-0.25):
alias /REGEX/ = REPLACEMENT alias /REGEX/ = REPLACEMENT
or --alias '/REGEX/=REPLACEMENT'. or --alias '/REGEX/=REPLACEMENT'.
REGEX is a case-insensitive regular expression. Anywhere it matches REGEX is a case-insensitive regular expression. Anywhere it matches
inside an account name, the matched part will be replaced by REPLACE- inside an account name, the matched part will be replaced by REPLACE-
MENT. If REGEX contains parenthesised match groups, these can be ref- MENT. If REGEX contains parenthesised match groups, these can be ref-
erenced by the usual numeric backreferences in REPLACEMENT. Note, cur- erenced by the usual numeric backreferences in REPLACEMENT. Note, cur-
rently regular expression aliases may cause noticeable slow-downs. rently regular expression aliases may cause noticeable slow-downs.
(And if you use Ledger on your hledger file, they will be ignored.) Eg: (And if you use Ledger on your hledger file, they will be ignored.) Eg:
alias /^(.+):bank:([^:]+)(.*)/ = \1:\2 \3 alias /^(.+):bank:([^:]+)(.*)/ = \1:\2 \3
# rewrites "assets:bank:wells fargo:checking" to "assets:wells fargo checking" # rewrites "assets:bank:wells fargo:checking" to "assets:wells fargo checking"
Multiple aliases Multiple aliases
You can define as many aliases as you like using directives or com- You can define as many aliases as you like using directives or com-
mand-line options. Aliases are recursive - each alias sees the result mand-line options. Aliases are recursive - each alias sees the result
of applying previous ones. (This is different from Ledger, where of applying previous ones. (This is different from Ledger, where
aliases are non-recursive by default). Aliases are applied in the fol- aliases are non-recursive by default). Aliases are applied in the fol-
lowing order: 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) precedence over earlier ones; directives not yet seen are ignored)
2. alias options, in the order they appear on the command line 2. alias options, in the order they appear on the command line
end aliases 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 directive:
end aliases end aliases
account directive account directive
The account directive predefines account names, as in Ledger and Bean- The account directive predefines account names, as in Ledger and Bean-
count. This may be useful for your own documentation; hledger doesn't count. This may be useful for your own documentation; hledger doesn't
make use of it yet. make use of it yet.
; account ACCT ; account ACCT
@ -573,8 +578,8 @@ FILE FORMAT
; etc. ; etc.
apply account directive apply account directive
You can specify a parent account which will be prepended to all You can specify a parent account which will be prepended to all
accounts within a section of the journal. Use the apply account and accounts within a section of the journal. Use the apply account and
end apply account directives like so: end apply account directives like so:
apply account home apply account home
@ -591,7 +596,7 @@ FILE FORMAT
home:food $10 home:food $10
home:cash $-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: file. Included files are also affected, eg:
apply account business apply account business
@ -600,16 +605,16 @@ FILE FORMAT
apply account personal apply account personal
include personal.journal 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. ported.
Multi-line comments 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. containing just end comment ends it. See comments.
commodity directive commodity directive
The commodity directive predefines commodities (currently this is just The commodity directive predefines commodities (currently this is just
informational), and also it may define the display format for amounts informational), and also it may define the display format for amounts
in this commodity (overriding the automatically inferred format). in this commodity (overriding the automatically inferred format).
It may be written on a single line, like this: It may be written on a single line, like this:
@ -621,8 +626,8 @@ FILE FORMAT
; separating thousands with comma. ; separating thousands with comma.
commodity 1,000.0000 AAAA commodity 1,000.0000 AAAA
or on multiple lines, using the "format" subdirective. In this case or on multiple lines, using the "format" subdirective. In this case
the commodity symbol appears twice and should be the same in both the commodity symbol appears twice and should be the same in both
places: places:
; commodity SYMBOL ; commodity SYMBOL
@ -635,10 +640,10 @@ FILE FORMAT
format INR 9,99,99,999.00 format INR 9,99,99,999.00
Default commodity 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 used for amounts without a commodity symbol (ie, plain numbers). (Note
this differs from Ledger's default commodity directive.) The commodity this differs from Ledger's default commodity directive.) The commodity
and display format will be applied to all subsequent commodity-less and display format will be applied to all subsequent commodity-less
amounts, or until the next D directive. amounts, or until the next D directive.
# commodity-less amounts should be treated as dollars # commodity-less amounts should be treated as dollars
@ -650,8 +655,8 @@ FILE FORMAT
b b
Default year Default year
You can set a default year to be used for subsequent dates which don't You can set a default year to be used for subsequent dates which don't
specify a year. This is a line beginning with Y followed by the year. specify a year. This is a line beginning with Y followed by the year.
Eg: Eg:
Y2009 ; set default year to 2009 Y2009 ; set default year to 2009
@ -671,24 +676,24 @@ FILE FORMAT
assets assets
Including other files 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 directive, like this:
include path/to/file.journal 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. 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. include journal, timeclock or timedot files, but not CSV files.
EDITOR SUPPORT EDITOR SUPPORT
Add-on modes exist for various text editors, to make working with jour- Add-on modes exist for various text editors, to make working with jour-
nal files easier. They add colour, navigation aids and helpful com- nal files easier. They add colour, navigation aids and helpful com-
mands. For hledger users who edit the journal file directly (the mands. For hledger users who edit the journal file directly (the
majority), using one of these modes is quite recommended. majority), using one of these modes is quite recommended.
These were written with Ledger in mind, but also work with hledger These were written with Ledger in mind, but also work with hledger
files: files:
@ -705,7 +710,7 @@ EDITOR SUPPORT
REPORTING BUGS 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) or hledger mail list)
@ -719,7 +724,7 @@ COPYRIGHT
SEE ALSO 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- hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_time-
dot(5), ledger(1) dot(5), ledger(1)

View File

@ -490,8 +490,14 @@ $\ echo\ \[aq]i\ 2009/13/1\ 08:00:00\[aq]\ |\ hledger\ print\ \-ftimeclock:\-
.PP .PP
You can also specify multiple \f[C]\-f\f[] options, to read multiple You can also specify multiple \f[C]\-f\f[] options, to read multiple
files as one big journal. files as one big journal.
(Directives in one file will not affect the other files. There are some limitations with this:
If you need that, use the include directive instead.) .IP \[bu] 2
directives in one file will not affect the other files
.IP \[bu] 2
balance assertions will not see any account balances from previous files
.PP
If you need those, either use the include directive, or concatenate the
files, eg: \f[C]cat\ a.journal\ b.journal\ |\ hledger\ \-f\-\ CMD\f[].
.SS Depth limiting .SS Depth limiting
.PP .PP
With the \f[C]\-\-depth\ N\f[] option, commands like account, balance With the \f[C]\-\-depth\ N\f[] option, commands like account, balance

View File

@ -369,8 +369,15 @@ $ hledger -f csv:/some/csv-file.dat stats
$ echo 'i 2009/13/1 08:00:00' | hledger print -ftimeclock:- $ echo 'i 2009/13/1 08:00:00' | hledger print -ftimeclock:-
You can also specify multiple `-f' options, to read multiple files You can also specify multiple `-f' options, to read multiple files
as one big journal. (Directives in one file will not affect the other as one big journal. There are some limitations with this:
files. If you need that, use the include directive instead.)
* directives in one file will not affect the other files
* balance assertions will not see any account balances from previous
files
If you need those, either use the include directive, or concatenate
the files, eg: `cat a.journal b.journal | hledger -f- CMD'.
 
File: hledger.1.info, Node: Depth limiting, Next: Smart dates, Prev: Input files, Up: OPTIONS File: hledger.1.info, Node: Depth limiting, Next: Smart dates, Prev: Input files, Up: OPTIONS
@ -2283,93 +2290,93 @@ Node: Reporting options7611
Ref: #reporting-options7764 Ref: #reporting-options7764
Node: Input files9587 Node: Input files9587
Ref: #input-files9727 Ref: #input-files9727
Node: Depth limiting11564 Node: Depth limiting11768
Ref: #depth-limiting11704 Ref: #depth-limiting11908
Node: Smart dates11905 Node: Smart dates12109
Ref: #smart-dates12051 Ref: #smart-dates12255
Node: Report start & end date13048 Node: Report start & end date13252
Ref: #report-start-end-date13220 Ref: #report-start-end-date13424
Node: Report intervals14296 Node: Report intervals14500
Ref: #report-intervals14461 Ref: #report-intervals14665
Node: Period expressions14860 Node: Period expressions15064
Ref: #period-expressions15025 Ref: #period-expressions15229
Node: Regular expressions17360 Node: Regular expressions17564
Ref: #regular-expressions17502 Ref: #regular-expressions17706
Node: QUERIES18985 Node: QUERIES19189
Ref: #queries19089 Ref: #queries19293
Node: COMMANDS22728 Node: COMMANDS22932
Ref: #commands22842 Ref: #commands23046
Node: accounts23515 Node: accounts23719
Ref: #accounts23615 Ref: #accounts23819
Node: activity24597 Node: activity24801
Ref: #activity24709 Ref: #activity24913
Node: add25068 Node: add25272
Ref: #add25169 Ref: #add25373
Node: balance27832 Node: balance28036
Ref: #balance27945 Ref: #balance28149
Node: Flat mode30958 Node: Flat mode31162
Ref: #flat-mode31085 Ref: #flat-mode31289
Node: Depth limited balance reports31504 Node: Depth limited balance reports31708
Ref: #depth-limited-balance-reports31707 Ref: #depth-limited-balance-reports31911
Node: Multicolumn balance reports32128 Node: Multicolumn balance reports32332
Ref: #multicolumn-balance-reports32330 Ref: #multicolumn-balance-reports32534
Node: Market value36979 Node: Market value37183
Ref: #market-value37143 Ref: #market-value37347
Node: Custom balance output38444 Node: Custom balance output38648
Ref: #custom-balance-output38617 Ref: #custom-balance-output38821
Node: Output destination40721 Node: Output destination40925
Ref: #output-destination40886 Ref: #output-destination41090
Node: CSV output41156 Node: CSV output41360
Ref: #csv-output41275 Ref: #csv-output41479
Node: balancesheet41672 Node: balancesheet41876
Ref: #balancesheet41800 Ref: #balancesheet42004
Node: cashflow42452 Node: cashflow42656
Ref: #cashflow42569 Ref: #cashflow42773
Node: help43259 Node: help43463
Ref: #help43371 Ref: #help43575
Node: incomestatement44208 Node: incomestatement44412
Ref: #incomestatement44338 Ref: #incomestatement44542
Node: info45065 Node: info45269
Ref: #info45172 Ref: #info45376
Node: man45534 Node: man45738
Ref: #man45631 Ref: #man45835
Node: print46034 Node: print46238
Ref: #print46139 Ref: #print46343
Node: register49888 Node: register50092
Ref: #register50001 Ref: #register50205
Node: Custom register output54493 Node: Custom register output54697
Ref: #custom-register-output54624 Ref: #custom-register-output54828
Node: stats55921 Node: stats56125
Ref: #stats56027 Ref: #stats56231
Node: test56907 Node: test57111
Ref: #test56994 Ref: #test57198
Node: ADD-ON COMMANDS57361 Node: ADD-ON COMMANDS57565
Ref: #add-on-commands57497 Ref: #add-on-commands57701
Node: api58785 Node: api58989
Ref: #api58877 Ref: #api59081
Node: autosync58911 Node: autosync59115
Ref: #autosync59026 Ref: #autosync59230
Node: diff61341 Node: diff61545
Ref: #diff61451 Ref: #diff61655
Node: equity62115 Node: equity62319
Ref: #equity62229 Ref: #equity62433
Node: interest63557 Node: interest63761
Ref: #interest63674 Ref: #interest63878
Node: irr66758 Node: irr66962
Ref: #irr66871 Ref: #irr67075
Node: print-unique69246 Node: print-unique69450
Ref: #print-unique69376 Ref: #print-unique69580
Node: rewrite69634 Node: rewrite69838
Ref: #rewrite69753 Ref: #rewrite69957
Node: ui70282 Node: ui70486
Ref: #ui70382 Ref: #ui70586
Node: web70423 Node: web70627
Ref: #web70511 Ref: #web70715
Node: TROUBLESHOOTING70544 Node: TROUBLESHOOTING70748
Ref: #troubleshooting70663 Ref: #troubleshooting70867
Node: Run-time problems70717 Node: Run-time problems70921
Ref: #run-time-problems70860 Ref: #run-time-problems71064
Node: Known limitations72804 Node: Known limitations73008
Ref: #known-limitations72947 Ref: #known-limitations73151
 
End Tag Table End Tag Table

File diff suppressed because it is too large Load Diff

View File

@ -113,8 +113,13 @@ $ echo 'i 2009/13/1 08:00:00' | hledger print -ftimeclock:-
``` ```
You can also specify multiple `-f` options, to read multiple files as one big journal. You can also specify multiple `-f` options, to read multiple files as one big journal.
(Directives in one file will not affect the other files. If you need that, There are some limitations with this:
use the [include directive](#including-other-files) instead.)
- directives in one file will not affect the other files
- [balance assertions](/journal.html#balance-assertions) will not see any account balances from previous files
If you need those, either use the [include directive](/journal.html#including-other-files),
or concatenate the files, eg: `cat a.journal b.journal | hledger -f- CMD`.
## Depth limiting ## Depth limiting