update embedded manuals

This commit is contained in:
Simon Michael 2018-06-30 22:08:48 +01:00
parent 6242b1d784
commit 22f2e90a4b
17 changed files with 622 additions and 308 deletions

View File

@ -1,5 +1,5 @@
.TH "hledger\-api" "1" "March 2018" "hledger\-api 1.9.99" "hledger User Manuals" .TH "hledger\-api" "1" "June 2018" "hledger\-api 1.9.99" "hledger User Manuals"

View File

@ -117,4 +117,4 @@ SEE ALSO
hledger-api 1.9.99 March 2018 hledger-api(1) hledger-api 1.9.99 June 2018 hledger-api(1)

View File

@ -1,5 +1,5 @@
.TH "hledger_csv" "5" "March 2018" "hledger 1.9.99" "hledger User Manuals" .TH "hledger_csv" "5" "June 2018" "hledger 1.9.99" "hledger User Manuals"

View File

@ -249,4 +249,4 @@ SEE ALSO
hledger 1.9.99 March 2018 hledger_csv(5) hledger 1.9.99 June 2018 hledger_csv(5)

View File

@ -1,6 +1,6 @@
.\"t .\"t
.TH "hledger_journal" "5" "March 2018" "hledger 1.9.99" "hledger User Manuals" .TH "hledger_journal" "5" "June 2018" "hledger 1.9.99" "hledger User Manuals"
@ -825,50 +825,173 @@ simple strings.
.PP .PP
A directive is a line in the journal beginning with a special keyword, A directive is a line in the journal beginning with a special keyword,
that influences how the journal is processed. that influences how the journal is processed.
Some directives may also have indented sub\-directives on the following hledger's directives are based on a subset of Ledger's, but there are
lines (\f[C]commodity\f[]). many differences (and also some differences between hledger versions).
.SS Directive scope, multiple files
.PP .PP
Directives vary in which journal entries they affect: Directives' behaviour and interactions can get a little bit complex, so
.IP \[bu] 2 here is a table summarising the directives and their effects, with links
some form a begin/end pair, and affect the enclosed journal entries (and to more detailed docs.
included files): .PP
.PD 0 .TS
.P tab(@);
.PD lw(7.8n) lw(8.6n) lw(7.0n) lw(27.8n) lw(18.8n).
\f[C]alias\f[] & \f[C]end\ aliases\f[]; \f[C]comment\f[] & T{
directive
T}@T{
end directive
T}@T{
subdirectives
T}@T{
purpose
T}@T{
can affect (as of 2018/06)
T}
_
T{
\f[C]account\f[]
T}@T{
T}@T{
any text
T}@T{
declare an account name & optional account code
T}@T{
account code: balance reports (except \f[C]balance\f[] single\-column
mode)
T}
T{
\f[C]alias\f[]
T}@T{
\f[C]end\ aliases\f[]
T}@T{
T}@T{
rewrite account names
T}@T{
following inline/included entries until end of current file or end
directive
T}
T{
\f[C]apply\ account\f[]
T}@T{
\f[C]end\ apply\ account\f[]
T}@T{
T}@T{
prepend a common parent to account names
T}@T{
following inline/included entries until end of current file or end
directive
T}
T{
\f[C]comment\f[]
T}@T{
\f[C]end\ comment\f[] \f[C]end\ comment\f[]
.IP \[bu] 2 T}@T{
some affect the subsequent journal entries (and included files) in the T}@T{
current file: ignore part of journal
.PD 0 T}@T{
.P following inline/included entries until end of current file or end
.PD directive
\f[C]alias\f[] or \f[C]comment\f[] without an end directive, \f[C]Y\f[] T}
.IP \[bu] 2 T{
some affect all journal entries (and included files) anywhere in the \f[C]commodity\f[]
current file: T}@T{
.PD 0 T}@T{
.P \f[C]format\f[]
.PD T}@T{
\f[C]account\f[], \f[C]commodity\f[], \f[C]D\f[], \f[C]P\f[]. declare a commodity and its number notation & display style
T}@T{
number notation: following entries in that commodity in all files;
display style: amounts of that commodity in reports
T}
T{
\f[C]D\f[]
T}@T{
T}@T{
T}@T{
declare a commodity, number notation & display style for commodityless
amounts
T}@T{
commodity: all commodityless entries in all files; number notation:
following commodityless entries and entries in that commodity in all
files; display style: amounts of that commodity in reports
T}
T{
\f[C]include\f[]
T}@T{
T}@T{
T}@T{
include entries/directives from another file
T}@T{
what the included directives affect
T}
T{
\f[C]P\f[]
T}@T{
T}@T{
T}@T{
declare a market price for a commodity
T}@T{
amounts of that commodity in reports, when \-V is used
T}
T{
\f[C]Y\f[]
T}@T{
T}@T{
T}@T{
declare a year for yearless dates
T}@T{
following inline/included entries until end of current file
T}
.TE
.PP .PP
It's important to note that directives can affect the current file and And some definitions:
child (included) files, but not sibling or parent (including) files.
This is by design, for simplicity and predictability of reports, but it
can be surprising at times.
Eg, in:
.IP
.nf
\f[C]
hledger\ \-f\ a.prices\ \-f\ b.journal
\f[]
.fi
.PP .PP
the prices defined in a.prices will not be effective in b.journal (a .TS
sibling file). tab(@);
Instead, you have to include (or inline) a.prices in b.journal, or vice lw(8.9n) lw(61.1n).
versa. T{
subdirective
T}@T{
optional indented directive or unparsed text lines immediately following
a parent directive
T}
T{
account code
T}@T{
numeric code influencing account display order in most balance reports
T}
T{
number notation
T}@T{
how to interpret numbers when parsing journal entries (the identity of
the decimal separator character).
(Currently each commodity can have its own notation, even in the same
file.)
T}
T{
display style
T}@T{
how to display amounts of a commodity in reports (symbol side and
spacing, digit groups, decimal separator, decimal places)
T}
T{
directive scope
T}@T{
which entries and (when there are multiple files) which files are
affected by a directive
T}
.TE
.PP
As you can see, directives vary in which journal entries and files they
affect, and whether they are focussed on input (parsing) or output
(reports).
Some directives have multiple effects.
.PP
If you have a journal made up of multiple files, or pass multiple \-f
options on the command line, note that directives which affect input
typically last only until the end of their defining file.
This provides more simplicity and predictability, eg reports are not
changed by writing file options in a different order.
It can be surprising at times though.
.SS Comment blocks .SS Comment blocks
.PP .PP
A line containing just \f[C]comment\f[] starts a commented region of the A line containing just \f[C]comment\f[] starts a commented region of the
@ -1047,11 +1170,24 @@ account\ expenses\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 6000
\f[] \f[]
.fi .fi
.PP .PP
This affects account display order in reports: accounts with codes are This affects how accounts are sorted in account and balance reports:
listed before accounts without codes, in increasing code order. accounts with codes are listed before accounts without codes, and in
(Otherwise, accounts are listed alphabetically.) Account codes should be increasing code order (instead of listing all accounts alphabetically).
all numeric digits, unique, and separated from the account name by at Warning, this feature is incomplete; account codes do not yet affect
least two spaces (since account names may contain single spaces). sort order in
.IP \[bu] 2
the \f[C]accounts\f[] command
.IP \[bu] 2
the \f[C]balance\f[] command's single\-column mode
.IP \[bu] 2
flat mode balance reports (to work around this, declare account codes on
the subaccounts as well).
.IP \[bu] 2
hledger\-web's sidebar
.PP
Account codes should be all numeric digits, unique, and separated from
the account name by at least two spaces (since account names may contain
single spaces).
By convention, often the first digit indicates the type of account, as By convention, often the first digit indicates the type of account, as
in this numbering scheme and the example above. in this numbering scheme and the example above.
In future, we might use this to recognize account types. In future, we might use this to recognize account types.
@ -1072,9 +1208,9 @@ account\ assets:bank:checking\ \ \ 1110
.fi .fi
.SS Rewriting accounts .SS Rewriting accounts
.PP .PP
You can define aliases which rewrite your account names (after reading You can define account alias rules which rewrite your account names, or
the journal, before generating reports). parts of them, before generating reports.
hledger's account aliases can be useful for: This can be useful for:
.IP \[bu] 2 .IP \[bu] 2
expanding shorthand account names to their full form, allowing easier expanding shorthand account names to their full form, allowing easier
data entry and a less verbose journal data entry and a less verbose journal
@ -1086,6 +1222,10 @@ combining two accounts into one
.IP \[bu] 2 .IP \[bu] 2
customising reports customising reports
.PP .PP
Account aliases also rewrite account names in account directives.
They do not affect account names being entered via hledger add or
hledger\-web.
.PP
See also Cookbook: Rewrite account names. See also Cookbook: Rewrite account names.
.SS Basic aliases .SS Basic aliases
.PP .PP
@ -1106,7 +1246,7 @@ command line.
This affects all entries. This affects all entries.
It's useful for trying out aliases interactively. It's useful for trying out aliases interactively.
.PP .PP
OLD and NEW are full account names. OLD and NEW are case sensitive full account names.
hledger will replace any occurrence of the old account name with the new hledger will replace any occurrence of the old account name with the new
one. one.
Subaccounts are also affected. Subaccounts are also affected.
@ -1216,16 +1356,22 @@ include\ personal.journal
.PP .PP
Prior to hledger 1.0, legacy \f[C]account\f[] and \f[C]end\f[] spellings Prior to hledger 1.0, legacy \f[C]account\f[] and \f[C]end\f[] spellings
were also supported. were also supported.
.PP
A default parent account also affects account directives.
It does not affect account names being entered via hledger add or
hledger\-web.
If account aliases are present, they are applied after the default
parent account.
.SS Periodic transactions .SS Periodic transactions
.PP .PP
Periodic transaction rules describe transactions that recur. Periodic transaction rules describe transactions that recur.
They allow you to generate future transactions for forecast reports They allow you to generate future transactions for forecasting, without
(with \f[C]\-\-forecast\f[]), without having to write them out having to write them out explicitly in the journal (with
explicitly in the journal. \f[C]\-\-forecast\f[]).
Secondly, they also can be used to define budget goals (with Secondly, they also can be used to define budget goals (with
\f[C]\-\-budget\f[]). \f[C]\-\-budget\f[]).
.PP .PP
A periodic transaction rule looks like a regular journal entry, with the A periodic transaction rule looks like a normal journal entry, with the
date replaced by a tilde (\f[C]~\f[]) followed by a period expression date replaced by a tilde (\f[C]~\f[]) followed by a period expression
(mnemonic: \f[C]~\f[] looks like a repeating sine wave): (mnemonic: \f[C]~\f[] looks like a repeating sine wave):
.IP .IP
@ -1242,9 +1388,8 @@ date must fall on a natural boundary of the interval.
Eg \f[C]monthly\ from\ 2018/1/1\f[] is valid, but Eg \f[C]monthly\ from\ 2018/1/1\f[] is valid, but
\f[C]monthly\ from\ 2018/1/15\f[] is not. \f[C]monthly\ from\ 2018/1/15\f[] is not.
.PP .PP
Also, if you write a transaction description or same\-line comment, it If you write a transaction description or same\-line comment, it must be
must be separated from the period expression by \f[B]two or more separated from the period expression by \f[B]two or more spaces\f[].
spaces\f[].
Eg: Eg:
.IP .IP
.nf .nf
@ -1257,30 +1402,34 @@ Eg:
\ \ \ \ income:acme\ inc \ \ \ \ income:acme\ inc
\f[] \f[]
.fi .fi
.SS Generating forecasts with periodic transactions .SS Forecasting with periodic transactions
.PP .PP
With the \f[C]\-\-forecast\f[] flag, each periodic transaction rule With the \f[C]\-\-forecast\f[] flag, each periodic transaction rule
generates future transactions recurring at the specified interval, generates future transactions recurring at the specified interval.
beginning the day after the latest recorded journal transaction (or These are not saved in the journal, but appear in all reports.
today, if there are no transactions), and ending 6 months from today (or They will look like normal transactions, but with an extra tag named
at the report end date, if specified). \f[C]recur\f[], whose value is the generating period expression.
The generated transactions will appear in all reports.
They will have a \[lq]recur:\[rq] transaction tag added, with the
generating period expression as its value.
.PP .PP
This can be useful for forecasting balances into the future, and Forecast transactions begin on or after the day after the latest normal
experimenting with different scenarios, without having to write a lot of (non\-periodic) transaction in the journal, or today if there are none.
journal entries.
It can also help with data entry (describe most of your transactions
with periodic rules, and every so often copy the output of
\f[C]print\ \-\-forecast\f[] to the journal).
.PP .PP
You can generate one\-time transactions too; just write a period They end on or before the report end date if specified, or 180 days from
today if unspecified.
.PP
Forecasting can be useful for estimating balances into the future, and
experimenting with different scenarios.
Note the start date logic means that forecasted transactions are
automatically replaced by normal transactions as you add those.
.PP
Forecasting can also help with data entry: describe most of your
transactions with periodic rules, and every so often copy the output of
\f[C]print\ \-\-forecast\f[] to the journal.
.PP
You can generate one\-time transactions too: just write a period
expression specifying a date with no report interval. expression specifying a date with no report interval.
You could use this to forecast an estimated transaction, that is (You could also write a normal transaction with a future date, but
automatically deactivated once the actual transaction (or any other remember this disables forecast transactions on previous dates.)
transaction on or after that date) is recorded. .SS Budgeting with periodic transactions
.SS Setting budget goals with periodic transactions
.PP .PP
With the \f[C]\-\-budget\f[] flag, currently supported by the balance With the \f[C]\-\-budget\f[] flag, currently supported by the balance
command, each periodic transaction rule declares recurring budget goals command, each periodic transaction rule declares recurring budget goals
@ -1297,7 +1446,7 @@ Automated posting rules describe extra postings that should be added to
certain transactions at report time, when the \f[C]\-\-auto\f[] flag is certain transactions at report time, when the \f[C]\-\-auto\f[] flag is
used. used.
.PP .PP
An automated posting rule looks like a regular journal entry, except the An automated posting rule looks like a normal journal entry, except the
first line is an equal sign (\f[C]=\f[]) followed by a query (mnemonic: first line is an equal sign (\f[C]=\f[]) followed by a query (mnemonic:
\f[C]=\f[] looks like posting lines): \f[C]=\f[] looks like posting lines):
.IP .IP

View File

@ -755,11 +755,97 @@ File: hledger_journal.info, Node: Directives, Next: Periodic transactions, Pr
=============== ===============
A directive is a line in the journal beginning with a special keyword, A directive is a line in the journal beginning with a special keyword,
that influences how the journal is processed. Some directives may also that influences how the journal is processed. hledger's directives are
have indented sub-directives on the following lines ('commodity'). based on a subset of Ledger's, but there are many differences (and also
some differences between hledger versions).
Directives' behaviour and interactions can get a little bit complex,
so here is a table summarising the directives and their effects, with
links to more detailed docs.
directiveend subdirectivespurpose can affect (as of
directive 2018/06)
-----------------------------------------------------------------------------
'account' any declare an account name & account code:
text optional account code balance reports
(except 'balance'
single-column
mode)
'alias' 'end rewrite account names following
aliases' inline/included
entries until end
of current file
or end directive
'apply 'end prepend a common parent to following
account' apply account names inline/included
account' entries until end
of current file
or end directive
'comment''end ignore part of journal following
comment' inline/included
entries until end
of current file
or end directive
'commodity' 'format'declare a commodity and its number notation:
number notation & display following entries
style in that commodity
in all files;
display style:
amounts of that
commodity in
reports
'D' declare a commodity, number commodity: all
notation & display style commodityless
for commodityless amounts entries in all
files; number
notation:
following
commodityless
entries and
entries in that
commodity in all
files; display
style: amounts of
that commodity in
reports
'include' include entries/directives what the included
from another file directives affect
'P' declare a market price for amounts of that
a commodity commodity in
reports, when -V
is used
'Y' declare a year for yearless following
dates inline/included
entries until end
of current file
And some definitions:
subdirectiveoptional indented directive or unparsed text lines
immediately following a parent directive
account numeric code influencing account display order in most
code balance reports
number how to interpret numbers when parsing journal entries (the
notation identity of the decimal separator character). (Currently
each commodity can have its own notation, even in the same
file.)
display how to display amounts of a commodity in reports (symbol side
style and spacing, digit groups, decimal separator, decimal places)
directive which entries and (when there are multiple files) which files
scope are affected by a directive
As you can see, directives vary in which journal entries and files
they affect, and whether they are focussed on input (parsing) or output
(reports). Some directives have multiple effects.
If you have a journal made up of multiple files, or pass multiple -f
options on the command line, note that directives which affect input
typically last only until the end of their defining file. This provides
more simplicity and predictability, eg reports are not changed by
writing file options in a different order. It can be surprising at
times though.
* Menu: * Menu:
* Directive scope multiple files::
* Comment blocks:: * Comment blocks::
* Including other files:: * Including other files::
* Default year:: * Default year::
@ -771,38 +857,9 @@ have indented sub-directives on the following lines ('commodity').
* Default parent account:: * Default parent account::
 
File: hledger_journal.info, Node: Directive scope multiple files, Next: Comment blocks, Up: Directives File: hledger_journal.info, Node: Comment blocks, Next: Including other files, Up: Directives
1.14.1 Directive scope, multiple files 1.14.1 Comment blocks
--------------------------------------
Directives vary in which journal entries they affect:
* some form a begin/end pair, and affect the enclosed journal entries
(and included files):
'alias' & 'end aliases'; 'comment' & 'end comment'
* some affect the subsequent journal entries (and included files) in
the current file:
'alias' or 'comment' without an end directive, 'Y'
* some affect all journal entries (and included files) anywhere in
the current file:
'account', 'commodity', 'D', 'P'.
It's important to note that directives can affect the current file
and child (included) files, but not sibling or parent (including) files.
This is by design, for simplicity and predictability of reports, but it
can be surprising at times. Eg, in:
hledger -f a.prices -f b.journal
the prices defined in a.prices will not be effective in b.journal (a
sibling file). Instead, you have to include (or inline) a.prices in
b.journal, or vice versa.

File: hledger_journal.info, Node: Comment blocks, Next: Including other files, Prev: Directive scope multiple files, Up: Directives
1.14.2 Comment blocks
--------------------- ---------------------
A line containing just 'comment' starts a commented region of the file, A line containing just 'comment' starts a commented region of the file,
@ -812,7 +869,7 @@ file) ends it. See also comments.
 
File: hledger_journal.info, Node: Including other files, Next: Default year, Prev: Comment blocks, Up: Directives File: hledger_journal.info, Node: Including other files, Next: Default year, Prev: Comment blocks, Up: Directives
1.14.3 Including other files 1.14.2 Including other files
---------------------------- ----------------------------
You can pull in the content of additional files by writing an include You can pull in the content of additional files by writing an include
@ -829,7 +886,7 @@ include journal, timeclock or timedot files, but not CSV files.
 
File: hledger_journal.info, Node: Default year, Next: Declaring commodities, Prev: Including other files, Up: Directives File: hledger_journal.info, Node: Default year, Next: Declaring commodities, Prev: Including other files, Up: Directives
1.14.4 Default year 1.14.3 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
@ -855,7 +912,7 @@ Y2010 ; change default year to 2010
 
File: hledger_journal.info, Node: Declaring commodities, Next: Default commodity, Prev: Default year, Up: Directives File: hledger_journal.info, Node: Declaring commodities, Next: Default commodity, Prev: Default year, Up: Directives
1.14.5 Declaring commodities 1.14.4 Declaring commodities
---------------------------- ----------------------------
The 'commodity' directive declares commodities which may be used in the The 'commodity' directive declares commodities which may be used in the
@ -893,7 +950,7 @@ or more decimal digits).
 
File: hledger_journal.info, Node: Default commodity, Next: Market prices, Prev: Declaring commodities, Up: Directives File: hledger_journal.info, Node: Default commodity, Next: Market prices, Prev: Declaring commodities, Up: Directives
1.14.6 Default commodity 1.14.5 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
@ -916,7 +973,7 @@ with a decimal point.
 
File: hledger_journal.info, Node: Market prices, Next: Declaring accounts, Prev: Default commodity, Up: Directives File: hledger_journal.info, Node: Market prices, Next: Declaring accounts, Prev: Default commodity, Up: Directives
1.14.7 Market prices 1.14.6 Market prices
-------------------- --------------------
The 'P' directive declares a market price, which is an exchange rate The 'P' directive declares a market price, which is an exchange rate
@ -946,7 +1003,7 @@ another commodity using these prices.
 
File: hledger_journal.info, Node: Declaring accounts, Next: Rewriting accounts, Prev: Market prices, Up: Directives File: hledger_journal.info, Node: Declaring accounts, Next: Rewriting accounts, Prev: Market prices, Up: Directives
1.14.8 Declaring accounts 1.14.7 Declaring accounts
------------------------- -------------------------
The 'account' directive predeclares account names. The simplest form is The 'account' directive predeclares account names. The simplest form is
@ -966,14 +1023,23 @@ account liabilities 2000
account revenues 4000 account revenues 4000
account expenses 6000 account expenses 6000
This affects account display order in reports: accounts with codes This affects how accounts are sorted in account and balance reports:
are listed before accounts without codes, in increasing code order. accounts with codes are listed before accounts without codes, and in
(Otherwise, accounts are listed alphabetically.) Account codes should increasing code order (instead of listing all accounts alphabetically).
be all numeric digits, unique, and separated from the account name by at Warning, this feature is incomplete; account codes do not yet affect
least two spaces (since account names may contain single spaces). By sort order in
convention, often the first digit indicates the type of account, as in
this numbering scheme and the example above. In future, we might use * the 'accounts' command
this to recognize account types. * the 'balance' command's single-column mode
* flat mode balance reports (to work around this, declare account
codes on the subaccounts as well).
* hledger-web's sidebar
Account codes should be all numeric digits, unique, and separated
from the account name by at least two spaces (since account names may
contain single spaces). By convention, often the first digit indicates
the type of account, as in this numbering scheme and the example above.
In future, we might use this to recognize account types.
An account directive can also have indented subdirectives following An account directive can also have indented subdirectives following
it, which are currently ignored. Here is the full syntax: it, which are currently ignored. Here is the full syntax:
@ -988,12 +1054,11 @@ account assets:bank:checking 1110
 
File: hledger_journal.info, Node: Rewriting accounts, Next: Default parent account, Prev: Declaring accounts, Up: Directives File: hledger_journal.info, Node: Rewriting accounts, Next: Default parent account, Prev: Declaring accounts, Up: Directives
1.14.9 Rewriting accounts 1.14.8 Rewriting accounts
------------------------- -------------------------
You can define aliases which rewrite your account names (after reading You can define account alias rules which rewrite your account names, or
the journal, before generating reports). hledger's account aliases can parts of them, before generating reports. This can be useful for:
be useful for:
* expanding shorthand account names to their full form, allowing * expanding shorthand account names to their full form, allowing
easier data entry and a less verbose journal easier data entry and a less verbose journal
@ -1002,6 +1067,10 @@ be useful for:
or combining two accounts into one or combining two accounts into one
* customising reports * customising reports
Account aliases also rewrite account names in account directives.
They do not affect account names being entered via hledger add or
hledger-web.
See also Cookbook: Rewrite account names. See also Cookbook: Rewrite account names.
* Menu: * Menu:
@ -1013,7 +1082,7 @@ be useful for:
 
File: hledger_journal.info, Node: Basic aliases, Next: Regex aliases, Up: Rewriting accounts File: hledger_journal.info, Node: Basic aliases, Next: Regex aliases, Up: Rewriting accounts
1.14.9.1 Basic aliases 1.14.8.1 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.
@ -1026,9 +1095,9 @@ alias OLD = NEW
This affects all entries. It's useful for trying out aliases This affects all entries. It's useful for trying out aliases
interactively. interactively.
OLD and NEW are full account names. hledger will replace any OLD and NEW are case sensitive full account names. hledger will
occurrence of the old account name with the new one. Subaccounts are replace any occurrence of the old account name with the new one.
also affected. Eg: Subaccounts are also 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"
@ -1036,7 +1105,7 @@ alias checking = assets:bank:wells fargo:checking
 
File: hledger_journal.info, Node: Regex aliases, Next: Multiple aliases, Prev: Basic aliases, Up: Rewriting accounts File: hledger_journal.info, Node: Regex aliases, Next: Multiple aliases, Prev: Basic aliases, Up: Rewriting accounts
1.14.9.2 Regex aliases 1.14.8.2 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,
@ -1061,7 +1130,7 @@ whitespace.
 
File: hledger_journal.info, Node: Multiple aliases, Next: end aliases, Prev: Regex aliases, Up: Rewriting accounts File: hledger_journal.info, Node: Multiple aliases, Next: end aliases, Prev: Regex aliases, Up: Rewriting accounts
1.14.9.3 Multiple aliases 1.14.8.3 Multiple aliases
......................... .........................
You can define as many aliases as you like using directives or You can define as many aliases as you like using directives or
@ -1077,7 +1146,7 @@ following order:
 
File: hledger_journal.info, Node: end aliases, Prev: Multiple aliases, Up: Rewriting accounts File: hledger_journal.info, Node: end aliases, Prev: Multiple aliases, Up: Rewriting accounts
1.14.9.4 'end aliases' 1.14.8.4 'end aliases'
...................... ......................
You can clear (forget) all currently defined aliases with the 'end You can clear (forget) all currently defined aliases with the 'end
@ -1088,8 +1157,8 @@ end aliases
 
File: hledger_journal.info, Node: Default parent account, Prev: Rewriting accounts, Up: Directives File: hledger_journal.info, Node: Default parent account, Prev: Rewriting accounts, Up: Directives
1.14.10 Default parent account 1.14.9 Default parent account
------------------------------ -----------------------------
You can specify a parent account which will be prepended to all accounts You can specify a parent account which will be prepended to all accounts
within a section of the journal. Use the 'apply account' and 'end apply within a section of the journal. Use the 'apply account' and 'end apply
@ -1121,6 +1190,11 @@ include personal.journal
Prior to hledger 1.0, legacy 'account' and 'end' spellings were also Prior to hledger 1.0, legacy 'account' and 'end' spellings were also
supported. supported.
A default parent account also affects account directives. It does
not affect account names being entered via hledger add or hledger-web.
If account aliases are present, they are applied after the default
parent account.
 
File: hledger_journal.info, Node: Periodic transactions, Next: Automated postings, Prev: Directives, Up: FILE FORMAT File: hledger_journal.info, Node: Periodic transactions, Next: Automated postings, Prev: Directives, Up: FILE FORMAT
@ -1128,12 +1202,11 @@ File: hledger_journal.info, Node: Periodic transactions, Next: Automated posti
========================== ==========================
Periodic transaction rules describe transactions that recur. They allow Periodic transaction rules describe transactions that recur. They allow
you to generate future transactions for forecast reports (with you to generate future transactions for forecasting, without having to
'--forecast'), without having to write them out explicitly in the write them out explicitly in the journal (with '--forecast'). Secondly,
journal. Secondly, they also can be used to define budget goals (with they also can be used to define budget goals (with '--budget').
'--budget').
A periodic transaction rule looks like a regular journal entry, with A periodic transaction rule looks like a normal journal entry, with
the date replaced by a tilde ('~') followed by a period expression the date replaced by a tilde ('~') followed by a period expression
(mnemonic: '~' looks like a repeating sine wave): (mnemonic: '~' looks like a repeating sine wave):
@ -1145,9 +1218,8 @@ the date replaced by a tilde ('~') followed by a period expression
date must fall on a natural boundary of the interval. Eg 'monthly from date must fall on a natural boundary of the interval. Eg 'monthly from
2018/1/1' is valid, but 'monthly from 2018/1/15' is not. 2018/1/1' is valid, but 'monthly from 2018/1/15' is not.
Also, if you write a transaction description or same-line comment, it If you write a transaction description or same-line comment, it must
must be separated from the period expression by *two or more spaces*. be separated from the period expression by *two or more spaces*. Eg:
Eg:
; 2 or more spaces ; 2 or more spaces
; || ; ||
@ -1158,40 +1230,47 @@ Eg:
* Menu: * Menu:
* Generating forecasts with periodic transactions:: * Forecasting with periodic transactions::
* Setting budget goals with periodic transactions:: * Budgeting with periodic transactions::
 
File: hledger_journal.info, Node: Generating forecasts with periodic transactions, Next: Setting budget goals with periodic transactions, Up: Periodic transactions File: hledger_journal.info, Node: Forecasting with periodic transactions, Next: Budgeting with periodic transactions, Up: Periodic transactions
1.15.1 Generating forecasts with periodic transactions 1.15.1 Forecasting with periodic transactions
------------------------------------------------------ ---------------------------------------------
With the '--forecast' flag, each periodic transaction rule generates With the '--forecast' flag, each periodic transaction rule generates
future transactions recurring at the specified interval, beginning the future transactions recurring at the specified interval. These are not
day after the latest recorded journal transaction (or today, if there saved in the journal, but appear in all reports. They will look like
are no transactions), and ending 6 months from today (or at the report normal transactions, but with an extra tag named 'recur', whose value is
end date, if specified). The generated transactions will appear in all the generating period expression.
reports. They will have a "recur:" transaction tag added, with the
generating period expression as its value.
This can be useful for forecasting balances into the future, and Forecast transactions begin on or after the day after the latest
experimenting with different scenarios, without having to write a lot of normal (non-periodic) transaction in the journal, or today if there are
journal entries. It can also help with data entry (describe most of none.
your transactions with periodic rules, and every so often copy the
output of 'print --forecast' to the journal).
You can generate one-time transactions too; just write a period They end on or before the report end date if specified, or 180 days
expression specifying a date with no report interval. You could use from today if unspecified.
this to forecast an estimated transaction, that is automatically
deactivated once the actual transaction (or any other transaction on or Forecasting can be useful for estimating balances into the future,
after that date) is recorded. and experimenting with different scenarios. Note the start date logic
means that forecasted transactions are automatically replaced by normal
transactions as you add those.
Forecasting can also help with data entry: describe most of your
transactions with periodic rules, and every so often copy the output of
'print --forecast' to the journal.
You can generate one-time transactions too: just write a period
expression specifying a date with no report interval. (You could also
write a normal transaction with a future date, but remember this
disables forecast transactions on previous dates.)
 
File: hledger_journal.info, Node: Setting budget goals with periodic transactions, Prev: Generating forecasts with periodic transactions, Up: Periodic transactions File: hledger_journal.info, Node: Budgeting with periodic transactions, Prev: Forecasting with periodic transactions, Up: Periodic transactions
1.15.2 Setting budget goals with periodic transactions 1.15.2 Budgeting with periodic transactions
------------------------------------------------------ -------------------------------------------
With the '--budget' flag, currently supported by the balance command, With the '--budget' flag, currently supported by the balance command,
each periodic transaction rule declares recurring budget goals for the each periodic transaction rule declares recurring budget goals for the
@ -1212,7 +1291,7 @@ File: hledger_journal.info, Node: Automated postings, Prev: Periodic transacti
Automated posting rules describe extra postings that should be added to Automated posting rules describe extra postings that should be added to
certain transactions at report time, when the '--auto' flag is used. certain transactions at report time, when the '--auto' flag is used.
An automated posting rule looks like a regular journal entry, except An automated posting rule looks like a normal journal entry, except
the first line is an equal sign ('=') followed by a query (mnemonic: '=' the first line is an equal sign ('=') followed by a query (mnemonic: '='
looks like posting lines): looks like posting lines):
@ -1325,43 +1404,41 @@ Node: Tags26398
Ref: #tags26516 Ref: #tags26516
Node: Directives27918 Node: Directives27918
Ref: #directives28061 Ref: #directives28061
Node: Directive scope multiple files28517 Node: Comment blocks33917
Ref: #directive-scope-multiple-files28705 Ref: #comment-blocks34062
Node: Comment blocks29655 Node: Including other files34238
Ref: #comment-blocks29839 Ref: #including-other-files34418
Node: Including other files30015 Node: Default year34807
Ref: #including-other-files30195 Ref: #default-year34976
Node: Default year30584 Node: Declaring commodities35399
Ref: #default-year30753 Ref: #declaring-commodities35582
Node: Declaring commodities31176 Node: Default commodity36809
Ref: #declaring-commodities31359 Ref: #default-commodity36985
Node: Default commodity32586 Node: Market prices37621
Ref: #default-commodity32762 Ref: #market-prices37786
Node: Market prices33398 Node: Declaring accounts38627
Ref: #market-prices33563 Ref: #declaring-accounts38803
Node: Declaring accounts34404 Node: Rewriting accounts40474
Ref: #declaring-accounts34580 Ref: #rewriting-accounts40659
Node: Rewriting accounts35927 Node: Basic aliases41393
Ref: #rewriting-accounts36112 Ref: #basic-aliases41539
Node: Basic aliases36716 Node: Regex aliases42243
Ref: #basic-aliases36862 Ref: #regex-aliases42414
Node: Regex aliases37552 Node: Multiple aliases43132
Ref: #regex-aliases37723 Ref: #multiple-aliases43307
Node: Multiple aliases38441 Node: end aliases43805
Ref: #multiple-aliases38616 Ref: #end-aliases43952
Node: end aliases39114 Node: Default parent account44053
Ref: #end-aliases39261 Ref: #default-parent-account44219
Node: Default parent account39362 Node: Periodic transactions45103
Ref: #default-parent-account39530 Ref: #periodic-transactions45282
Node: Periodic transactions40189 Node: Forecasting with periodic transactions46492
Ref: #periodic-transactions40368 Ref: #forecasting-with-periodic-transactions46735
Node: Generating forecasts with periodic transactions41609 Node: Budgeting with periodic transactions47976
Ref: #generating-forecasts-with-periodic-transactions41890 Ref: #budgeting-with-periodic-transactions48215
Node: Setting budget goals with periodic transactions42983 Node: Automated postings48674
Ref: #setting-budget-goals-with-periodic-transactions43264 Ref: #automated-postings48828
Node: Automated postings43723 Node: EDITOR SUPPORT49967
Ref: #automated-postings43877 Ref: #editor-support50085
Node: EDITOR SUPPORT45017
Ref: #editor-support45135
 
End Tag Table End Tag Table

View File

@ -601,34 +601,97 @@ FILE FORMAT
Directives Directives
A directive is a line in the journal beginning with a special keyword, A directive is a line in the journal beginning with a special keyword,
that influences how the journal is processed. Some directives may also that influences how the journal is processed. hledger's directives are
have indented sub-directives on the following lines (commodity). based on a subset of Ledger's, but there are many differences (and also
some differences between hledger versions).
Directive scope, multiple files Directives' behaviour and interactions can get a little bit complex, so
Directives vary in which journal entries they affect: here is a table summarising the directives and their effects, with
links to more detailed docs.
o some form a begin/end pair, and affect the enclosed journal entries
(and included files):
alias & end aliases; comment & end comment
o some affect the subsequent journal entries (and included files) in direc- end subdi- purpose can affect (as of
the current file: tive directive rec- 2018/06)
alias or comment without an end directive, Y tives
-------------------------------------------------------------------------------------------------
account any declare an account name & account code: bal-
text optional account code ance reports
(except balance
single-column mode)
alias end aliases rewrite account names following
inline/included
entries until end
of current file or
end directive
apply account end apply account prepend a common parent to following
account names inline/included
entries until end
of current file or
end directive
comment end comment ignore part of journal following
inline/included
entries until end
of current file or
end directive
commodity format declare a commodity and its number notation:
number notation & display following entries
style in that commodity
in all files; dis-
play style: amounts
of that commodity
in reports
D declare a commodity, number commodity: all com-
notation & display style for modityless entries
commodityless amounts in all files; num-
ber notation: fol-
lowing commodity-
less entries and
entries in that
commodity in all
files; display
style: amounts of
that commodity in
reports
include include entries/directives what the included
from another file directives affect
P declare a market price for a amounts of that
commodity commodity in
reports, when -V is
used
Y declare a year for yearless following
dates inline/included
entries until end
of current file
o some affect all journal entries (and included files) anywhere in the And some definitions:
current file:
account, commodity, D, P.
It's important to note that directives can affect the current file and
child (included) files, but not sibling or parent (including) files.
This is by design, for simplicity and predictability of reports, but it
can be surprising at times. Eg, in:
hledger -f a.prices -f b.journal subdirec- optional indented directive or unparsed text lines immedi-
tive ately following a parent directive
account numeric code influencing account display order in most bal-
code ance reports
the prices defined in a.prices will not be effective in b.journal (a
sibling file). Instead, you have to include (or inline) a.prices in
b.journal, or vice versa. number how to interpret numbers when parsing journal entries (the
notation identity of the decimal separator character). (Currently
each commodity can have its own notation, even in the same
file.)
display how to display amounts of a commodity in reports (symbol side
style and spacing, digit groups, decimal separator, decimal places)
directive which entries and (when there are multiple files) which files
scope are affected by a directive
As you can see, directives vary in which journal entries and files they
affect, and whether they are focussed on input (parsing) or output
(reports). Some directives have multiple effects.
If you have a journal made up of multiple files, or pass multiple -f
options on the command line, note that directives which affect input
typically last only until the end of their defining file. This pro-
vides more simplicity and predictability, eg reports are not changed by
writing file options in a different order. It can be surprising at
times though.
Comment blocks Comment blocks
A line containing just comment starts a commented region of the file, A line containing just comment starts a commented region of the file,
@ -763,14 +826,26 @@ FILE FORMAT
account revenues 4000 account revenues 4000
account expenses 6000 account expenses 6000
This affects account display order in reports: accounts with codes are This affects how accounts are sorted in account and balance reports:
listed before accounts without codes, in increasing code order. (Oth- accounts with codes are listed before accounts without codes, and in
erwise, accounts are listed alphabetically.) Account codes should be increasing code order (instead of listing all accounts alphabetically).
all numeric digits, unique, and separated from the account name by at Warning, this feature is incomplete; account codes do not yet affect
least two spaces (since account names may contain single spaces). By sort order in
convention, often the first digit indicates the type of account, as in
this numbering scheme and the example above. In future, we might use o the accounts command
this to recognize account types.
o the balance command's single-column mode
o flat mode balance reports (to work around this, declare account codes
on the subaccounts as well).
o hledger-web's sidebar
Account codes should be all numeric digits, unique, and separated from
the account name by at least two spaces (since account names may con-
tain single spaces). By convention, often the first digit indicates
the type of account, as in this numbering scheme and the example above.
In future, we might use this to recognize account types.
An account directive can also have indented subdirectives following it, An account directive can also have indented subdirectives following it,
which are currently ignored. Here is the full syntax: which are currently ignored. Here is the full syntax:
@ -783,9 +858,8 @@ FILE FORMAT
some-tag:12345 some-tag:12345
Rewriting accounts Rewriting accounts
You can define aliases which rewrite your account names (after reading You can define account alias rules which rewrite your account names, or
the journal, before generating reports). hledger's account aliases can parts of them, before generating reports. This can be useful for:
be useful for:
o expanding shorthand account names to their full form, allowing easier o expanding shorthand account names to their full form, allowing easier
data entry and a less verbose journal data entry and a less verbose journal
@ -797,6 +871,10 @@ FILE FORMAT
o customising reports o customising reports
Account aliases also rewrite account names in account directives. They
do not affect account names being entered via hledger add or
hledger-web.
See also Cookbook: Rewrite account names. See also Cookbook: Rewrite account names.
Basic aliases Basic aliases
@ -809,9 +887,9 @@ 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 case sensitive full account names. hledger will
rence of the old account name with the new one. Subaccounts are also replace any occurrence of the old account name with the new one. Sub-
affected. Eg: accounts are also 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"
@ -885,16 +963,20 @@ FILE FORMAT
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.
A default parent account also affects account directives. It does not
affect account names being entered via hledger add or hledger-web. If
account aliases are present, they are applied after the default parent
account.
Periodic transactions Periodic transactions
Periodic transaction rules describe transactions that recur. They Periodic transaction rules describe transactions that recur. They
allow you to generate future transactions for forecast reports (with allow you to generate future transactions for forecasting, without hav-
--forecast), without having to write them out explicitly in the jour- ing to write them out explicitly in the journal (with --forecast).
nal. Secondly, they also can be used to define budget goals (with Secondly, they also can be used to define budget goals (with --budget).
--budget).
A periodic transaction rule looks like a regular journal entry, with A periodic transaction rule looks like a normal journal entry, with the
the date replaced by a tilde (~) followed by a period expression date replaced by a tilde (~) followed by a period expression (mnemonic:
(mnemonic: ~ looks like a repeating sine wave): ~ looks like a repeating sine wave):
~ monthly ~ monthly
expenses:rent $2000 expenses:rent $2000
@ -904,9 +986,8 @@ FILE FORMAT
date must fall on a natural boundary of the interval. Eg date must fall on a natural boundary of the interval. Eg
monthly from 2018/1/1 is valid, but monthly from 2018/1/15 is not. monthly from 2018/1/1 is valid, but monthly from 2018/1/15 is not.
Also, if you write a transaction description or same-line comment, it If you write a transaction description or same-line comment, it must be
must be separated from the period expression by two or more spaces. separated from the period expression by two or more spaces. Eg:
Eg:
; 2 or more spaces ; 2 or more spaces
; || ; ||
@ -915,28 +996,34 @@ FILE FORMAT
assets:bank:checking $1500 assets:bank:checking $1500
income:acme inc income:acme inc
Generating forecasts with periodic transactions Forecasting with periodic transactions
With the --forecast flag, each periodic transaction rule generates With the --forecast flag, each periodic transaction rule generates
future transactions recurring at the specified interval, beginning the future transactions recurring at the specified interval. These are not
day after the latest recorded journal transaction (or today, if there saved in the journal, but appear in all reports. They will look like
are no transactions), and ending 6 months from today (or at the report normal transactions, but with an extra tag named recur, whose value is
end date, if specified). The generated transactions will appear in all the generating period expression.
reports. They will have a "recur:" transaction tag added, with the
generating period expression as its value.
This can be useful for forecasting balances into the future, and exper- Forecast transactions begin on or after the day after the latest normal
imenting with different scenarios, without having to write a lot of (non-periodic) transaction in the journal, or today if there are none.
journal entries. It can also help with data entry (describe most of
your transactions with periodic rules, and every so often copy the out-
put of print --forecast to the journal).
You can generate one-time transactions too; just write a period expres- They end on or before the report end date if specified, or 180 days
sion specifying a date with no report interval. You could use this to from today if unspecified.
forecast an estimated transaction, that is automatically deactivated
once the actual transaction (or any other transaction on or after that
date) is recorded.
Setting budget goals with periodic transactions Forecasting can be useful for estimating balances into the future, and
experimenting with different scenarios. Note the start date logic
means that forecasted transactions are automatically replaced by normal
transactions as you add those.
Forecasting can also help with data entry: describe most of your trans-
actions with periodic rules, and every so often copy the output of
print --forecast to the journal.
You can generate one-time transactions too: just write a period expres-
sion specifying a date with no report interval. (You could also write
a normal transaction with a future date, but remember this disables
forecast transactions on previous dates.)
Budgeting with periodic transactions
With the --budget flag, currently supported by the balance command, With the --budget flag, currently supported by the balance command,
each periodic transaction rule declares recurring budget goals for the each periodic transaction rule declares recurring budget goals for the
specified accounts. Eg the first example above declares a goal of specified accounts. Eg the first example above declares a goal of
@ -951,9 +1038,9 @@ FILE FORMAT
Automated posting rules describe extra postings that should be added to Automated posting rules describe extra postings that should be added to
certain transactions at report time, when the --auto flag is used. certain transactions at report time, when the --auto flag is used.
An automated posting rule looks like a regular journal entry, except An automated posting rule looks like a normal journal entry, except the
the first line is an equal sign (=) followed by a query (mnemonic: = first line is an equal sign (=) followed by a query (mnemonic: = looks
looks like posting lines): like posting lines):
= expenses:gifts = expenses:gifts
budget:gifts *-1 budget:gifts *-1
@ -1003,6 +1090,7 @@ EDITOR SUPPORT
Textmate https://github.com/ledger/ledger/wiki/Using-TextMate-2 Textmate https://github.com/ledger/ledger/wiki/Using-TextMate-2
Text Wran- https://github.com/ledger/ledger/wiki/Edit- Text Wran- https://github.com/ledger/ledger/wiki/Edit-
gler ing-Ledger-files-with-TextWrangler gler ing-Ledger-files-with-TextWrangler
Visual Stu- https://marketplace.visualstudio.com/items?item- Visual Stu- https://marketplace.visualstudio.com/items?item-
dio Code Name=mark-hansen.hledger-vscode dio Code Name=mark-hansen.hledger-vscode
@ -1031,4 +1119,4 @@ SEE ALSO
hledger 1.9.99 March 2018 hledger_journal(5) hledger 1.9.99 June 2018 hledger_journal(5)

View File

@ -1,5 +1,5 @@
.TH "hledger_timeclock" "5" "March 2018" "hledger 1.9.99" "hledger User Manuals" .TH "hledger_timeclock" "5" "June 2018" "hledger 1.9.99" "hledger User Manuals"

View File

@ -77,4 +77,4 @@ SEE ALSO
hledger 1.9.99 March 2018 hledger_timeclock(5) hledger 1.9.99 June 2018 hledger_timeclock(5)

View File

@ -1,5 +1,5 @@
.TH "hledger_timedot" "5" "March 2018" "hledger 1.9.99" "hledger User Manuals" .TH "hledger_timedot" "5" "June 2018" "hledger 1.9.99" "hledger User Manuals"

View File

@ -124,4 +124,4 @@ SEE ALSO
hledger 1.9.99 March 2018 hledger_timedot(5) hledger 1.9.99 June 2018 hledger_timedot(5)

View File

@ -1,5 +1,5 @@
.TH "hledger\-ui" "1" "March 2018" "hledger\-ui 1.9.99" "hledger User Manuals" .TH "hledger\-ui" "1" "June 2018" "hledger\-ui 1.9.99" "hledger User Manuals"

View File

@ -384,4 +384,4 @@ SEE ALSO
hledger-ui 1.9.99 March 2018 hledger-ui(1) hledger-ui 1.9.99 June 2018 hledger-ui(1)

View File

@ -1,5 +1,5 @@
.TH "hledger\-web" "1" "March 2018" "hledger\-web 1.9.99" "hledger User Manuals" .TH "hledger\-web" "1" "June 2018" "hledger\-web 1.9.99" "hledger User Manuals"

View File

@ -248,4 +248,4 @@ SEE ALSO
hledger-web 1.9.99 March 2018 hledger-web(1) hledger-web 1.9.99 June 2018 hledger-web(1)

View File

@ -1,6 +1,6 @@
.\"t .\"t
.TH "hledger" "1" "March 2018" "hledger 1.9.99" "hledger User Manuals" .TH "hledger" "1" "June 2018" "hledger 1.9.99" "hledger User Manuals"

View File

@ -2210,4 +2210,4 @@ SEE ALSO
hledger 1.9.99 March 2018 hledger(1) hledger 1.9.99 June 2018 hledger(1)