doc: update manuals

This commit is contained in:
Simon Michael 2023-11-22 22:56:31 -10:00
parent fcfa7ed78a
commit 0bf0c30b8d
13 changed files with 3461 additions and 2960 deletions

View File

@ -1,2 +1,2 @@
m4_dnl Date to show in man pages. Updated by "Shake manuals" m4_dnl Date to show in man pages. Updated by "Shake manuals"
m4_define({{_monthyear_}}, {{September 2023}})m4_dnl m4_define({{_monthyear_}}, {{November 2023}})m4_dnl

View File

@ -1,2 +1,2 @@
m4_dnl Date to show in man pages. Updated by "Shake manuals" m4_dnl Date to show in man pages. Updated by "Shake manuals"
m4_define({{_monthyear_}}, {{September 2023}})m4_dnl m4_define({{_monthyear_}}, {{November 2023}})m4_dnl

View File

@ -1,5 +1,5 @@
.TH "HLEDGER-UI" "1" "September 2023" "hledger-ui-1.31.99 " "hledger User Manuals" .TH "HLEDGER-UI" "1" "November 2023" "hledger-ui-1.31.99 " "hledger User Manuals"
@ -347,25 +347,28 @@ current transaction when invoked from the register and transaction
screens, and at the error location (if possible) when invoked from the screens, and at the error location (if possible) when invoked from the
error screen. error screen.
.PP .PP
\f[V]B\f[R] toggles cost mode, showing amounts in their cost\[aq]s \f[V]B\f[R] toggles cost mode, showing amounts converted to their
commodity (like toggling the \f[V]-B/--cost\f[R] flag). cost\[aq]s commodity (see hledger manual > Cost reporting.
.PP .PP
\f[V]V\f[R] toggles value mode, showing amounts\[aq] current market \f[V]V\f[R] toggles value mode, showing amounts converted to their
value in their default valuation commodity (like toggling the market value (see hledger manual > Valuation flag).
\f[V]-V/--market\f[R] flag). More specifically,
Note, \[dq]current market value\[dq] means the value on the report end .IP "1." 3
date if specified, otherwise today. By default, the \f[V]V\f[R] key toggles showing end value
To see the value on another date, you can temporarily set that as the (\f[V]--value=end\f[R]) on or off.
report end date. The valuation date will be the report end date if specified, otherwise
Eg: to see a transaction as it was valued on july 30, go to the accounts today.
or register screen, press \f[V]/\f[R], and add \f[V]date:-7/30\f[R] to .IP "2." 3
the query. If you started hledger-ui with some other valuation (such as
\f[V]--value=then,EUR\f[R]), the \f[V]V\f[R] key toggles that off or on.
.PP .PP
At most one of cost or value mode can be active at once. Cost/value tips: - When showing end value, you can change the report end
.PP date without restarting, by pressing \f[V]/\f[R] and adding a query like
There\[aq]s not yet any visual reminder when cost or value mode is \f[V]date:..YYYY-MM-DD\f[R].
active; for now pressing \f[V]b\f[R] \f[V]b\f[R] \f[V]v\f[R] should - Either cost mode, or value mode, can be active, but not both at once.
reliably reset to normal mode. Cost mode takes precedence.
- There\[aq]s not yet any visual indicator that cost or value mode is
active, other than the amount values.
.PP .PP
\f[V]q\f[R] quits the application. \f[V]q\f[R] quits the application.
.PP .PP
@ -436,6 +439,13 @@ This will be the running historical balance (what you would see on a
bank\[aq]s website, eg) if not disturbed by a query. bank\[aq]s website, eg) if not disturbed by a query.
.RE .RE
.PP .PP
Note, this screen combines each transaction\[aq]s in-period postings to
a single line item, dated with the earliest in-period transaction or
posting date (like hledger\[aq]s \f[V]aregister\f[R]).
So custom posting dates can cause the running balance to be temporarily
inaccurate.
(See hledger manual > aregister and posting dates.)
.PP
Transactions affecting this account\[aq]s subaccounts will be included Transactions affecting this account\[aq]s subaccounts will be included
in the register if the accounts screen is in tree mode, or if it\[aq]s in the register if the accounts screen is in tree mode, or if it\[aq]s
in list mode but this account has subaccounts which are not shown due to in list mode but this account has subaccounts which are not shown due to

View File

@ -377,22 +377,25 @@ cursor will be positioned at the current transaction when invoked from
the register and transaction screens, and at the error location (if the register and transaction screens, and at the error location (if
possible) when invoked from the error screen. possible) when invoked from the error screen.
'B' toggles cost mode, showing amounts in their cost's commodity 'B' toggles cost mode, showing amounts converted to their cost's
(like toggling the '-B/--cost' flag). commodity (see hledger manual > Cost reporting.
'V' toggles value mode, showing amounts' current market value in 'V' toggles value mode, showing amounts converted to their market
their default valuation commodity (like toggling the '-V/--market' value (see hledger manual > Valuation flag). More specifically,
flag). Note, "current market value" means the value on the report end
date if specified, otherwise today. To see the value on another date,
you can temporarily set that as the report end date. Eg: to see a
transaction as it was valued on july 30, go to the accounts or register
screen, press '/', and add 'date:-7/30' to the query.
At most one of cost or value mode can be active at once. 1. By default, the 'V' key toggles showing end value ('--value=end')
on or off. The valuation date will be the report end date if
specified, otherwise today.
There's not yet any visual reminder when cost or value mode is 2. If you started hledger-ui with some other valuation (such as
active; for now pressing 'b' 'b' 'v' should reliably reset to normal '--value=then,EUR'), the 'V' key toggles that off or on.
mode.
Cost/value tips: - When showing end value, you can change the report
end date without restarting, by pressing '/' and adding a query like
'date:..YYYY-MM-DD'. - Either cost mode, or value mode, can be active,
but not both at once. Cost mode takes precedence. - There's not yet
any visual indicator that cost or value mode is active, other than the
amount values.
'q' quits the application. 'q' quits the application.
@ -500,6 +503,12 @@ line represents one transaction, and shows:
historical balance (what you would see on a bank's website, historical balance (what you would see on a bank's website,
eg) if not disturbed by a query. eg) if not disturbed by a query.
Note, this screen combines each transaction's in-period postings to a
single line item, dated with the earliest in-period transaction or
posting date (like hledger's 'aregister'). So custom posting dates can
cause the running balance to be temporarily inaccurate. (See hledger
manual > aregister and posting dates.)
Transactions affecting this account's subaccounts will be included in Transactions affecting this account's subaccounts will be included in
the register if the accounts screen is in tree mode, or if it's in list the register if the accounts screen is in tree mode, or if it's in list
mode but this account has subaccounts which are not shown due to a depth mode but this account has subaccounts which are not shown due to a depth
@ -677,34 +686,34 @@ Node: MOUSE7825
Ref: #mouse7920 Ref: #mouse7920
Node: KEYS8157 Node: KEYS8157
Ref: #keys8250 Ref: #keys8250
Node: SCREENS12763 Node: SCREENS12905
Ref: #screens12861 Ref: #screens13003
Node: Menu13441 Node: Menu13583
Ref: #menu13534 Ref: #menu13676
Node: Cash accounts13729 Node: Cash accounts13871
Ref: #cash-accounts13871 Ref: #cash-accounts14013
Node: Balance sheet accounts14055 Node: Balance sheet accounts14197
Ref: #balance-sheet-accounts14236 Ref: #balance-sheet-accounts14378
Node: Income statement accounts14356 Node: Income statement accounts14498
Ref: #income-statement-accounts14542 Ref: #income-statement-accounts14684
Node: All accounts14706 Node: All accounts14848
Ref: #all-accounts14852 Ref: #all-accounts14994
Node: Register15034 Node: Register15176
Ref: #register15158 Ref: #register15300
Node: Transaction17120 Node: Transaction17584
Ref: #transaction17243 Ref: #transaction17707
Node: Error18660 Node: Error19124
Ref: #error18754 Ref: #error19218
Node: TIPS18998 Node: TIPS19462
Ref: #tips19097 Ref: #tips19561
Node: Watch mode19139 Node: Watch mode19603
Ref: #watch-mode19246 Ref: #watch-mode19710
Node: Debug output20705 Node: Debug output21169
Ref: #debug-output20816 Ref: #debug-output21280
Node: ENVIRONMENT21028 Node: ENVIRONMENT21492
Ref: #environment21138 Ref: #environment21602
Node: BUGS21329 Node: BUGS21793
Ref: #bugs21412 Ref: #bugs21876
 
End Tag Table End Tag Table

View File

@ -314,21 +314,25 @@ KEYS
register and transaction screens, and at the error location (if possi- register and transaction screens, and at the error location (if possi-
ble) when invoked from the error screen. ble) when invoked from the error screen.
B toggles cost mode, showing amounts in their cost's commodity (like B toggles cost mode, showing amounts converted to their cost's commod-
toggling the -B/--cost flag). ity (see hledger manual > Cost reporting.
V toggles value mode, showing amounts' current market value in their V toggles value mode, showing amounts converted to their market value
default valuation commodity (like toggling the -V/--market flag). (see hledger manual > Valuation flag). More specifically,
Note, "current market value" means the value on the report end date if
specified, otherwise today. To see the value on another date, you can
temporarily set that as the report end date. Eg: to see a transaction
as it was valued on july 30, go to the accounts or register screen,
press /, and add date:-7/30 to the query.
At most one of cost or value mode can be active at once. 1. By default, the V key toggles showing end value (--value=end) on or
off. The valuation date will be the report end date if specified,
otherwise today.
There's not yet any visual reminder when cost or value mode is active; 2. If you started hledger-ui with some other valuation (such as
for now pressing b b v should reliably reset to normal mode. --value=then,EUR), the V key toggles that off or on.
Cost/value tips: - When showing end value, you can change the report
end date without restarting, by pressing / and adding a query like
date:..YYYY-MM-DD. - Either cost mode, or value mode, can be active,
but not both at once. Cost mode takes precedence. - There's not yet
any visual indicator that cost or value mode is active, other than the
amount values.
q quits the application. q quits the application.
@ -389,6 +393,12 @@ SCREENS
(what you would see on a bank's website, eg) if not disturbed by a (what you would see on a bank's website, eg) if not disturbed by a
query. query.
Note, this screen combines each transaction's in-period postings to a
single line item, dated with the earliest in-period transaction or
posting date (like hledger's aregister). So custom posting dates can
cause the running balance to be temporarily inaccurate. (See hledger
manual > aregister and posting dates.)
Transactions affecting this account's subaccounts will be included in Transactions affecting this account's subaccounts will be included in
the register if the accounts screen is in tree mode, or if it's in list the register if the accounts screen is in tree mode, or if it's in list
mode but this account has subaccounts which are not shown due to a mode but this account has subaccounts which are not shown due to a
@ -527,4 +537,4 @@ LICENSE
SEE ALSO SEE ALSO
hledger(1), hledger-ui(1), hledger-web(1), ledger(1) hledger(1), hledger-ui(1), hledger-web(1), ledger(1)
hledger-ui-1.31.99 September 2023 HLEDGER-UI(1) hledger-ui-1.31.99 November 2023 HLEDGER-UI(1)

View File

@ -1,2 +1,2 @@
m4_dnl Date to show in man pages. Updated by "Shake manuals" m4_dnl Date to show in man pages. Updated by "Shake manuals"
m4_define({{_monthyear_}}, {{September 2023}})m4_dnl m4_define({{_monthyear_}}, {{November 2023}})m4_dnl

View File

@ -1,5 +1,5 @@
.TH "HLEDGER-WEB" "1" "September 2023" "hledger-web-1.31.99 " "hledger User Manuals" .TH "HLEDGER-WEB" "1" "November 2023" "hledger-web-1.31.99 " "hledger User Manuals"
@ -102,12 +102,11 @@ hledger-web normally serves static files itself, but if you wanted to
serve them from another server for efficiency, you would set the url serve them from another server for efficiency, you would set the url
with this. with this.
.TP .TP
\f[V]--capabilities=CAP[,CAP..]\f[R] \f[V]--allow=view|add|edit\f[R]
enable the view, add, and/or manage capabilities (default: view,add) set the user\[aq]s access level for changing data (default:
.TP \f[V]add\f[R]).
\f[V]--capabilities-header=HTTPHEADER\f[R] It also accepts \f[V]sandstorm\f[R] for use on that platform (reads
read capabilities to enable from a HTTP header, like permissions from the \f[V]X-Sandstorm-Permissions\f[R] request header).
X-Sandstorm-Permissions (default: disabled)
.TP .TP
\f[V]--test\f[R] \f[V]--test\f[R]
run hledger-web\[aq]s tests and exit. run hledger-web\[aq]s tests and exit.

View File

@ -110,14 +110,11 @@ will be applied in addition to any search query entered there.
normally serves static files itself, but if you wanted to serve normally serves static files itself, but if you wanted to serve
them from another server for efficiency, you would set the url with them from another server for efficiency, you would set the url with
this. this.
'--capabilities=CAP[,CAP..]' '--allow=view|add|edit'
enable the view, add, and/or manage capabilities (default: set the user's access level for changing data (default: 'add'). It
view,add) also accepts 'sandstorm' for use on that platform (reads
'--capabilities-header=HTTPHEADER' permissions from the 'X-Sandstorm-Permissions' request header).
read capabilities to enable from a HTTP header, like
X-Sandstorm-Permissions (default: disabled)
'--test' '--test'
run hledger-web's tests and exit. hspec test runner args may run hledger-web's tests and exit. hspec test runner args may
@ -648,28 +645,28 @@ Tag Table:
Node: Top225 Node: Top225
Node: OPTIONS2580 Node: OPTIONS2580
Ref: #options2685 Ref: #options2685
Node: General help options5996 Node: General help options5973
Ref: #general-help-options6146 Ref: #general-help-options6123
Node: General input options6428 Node: General input options6405
Ref: #general-input-options6614 Ref: #general-input-options6591
Node: General reporting options7316 Node: General reporting options7293
Ref: #general-reporting-options7481 Ref: #general-reporting-options7458
Node: PERMISSIONS10871 Node: PERMISSIONS10848
Ref: #permissions11010 Ref: #permissions10987
Node: EDITING UPLOADING DOWNLOADING12222 Node: EDITING UPLOADING DOWNLOADING12199
Ref: #editing-uploading-downloading12403 Ref: #editing-uploading-downloading12380
Node: RELOADING13237 Node: RELOADING13214
Ref: #reloading13371 Ref: #reloading13348
Node: JSON API13804 Node: JSON API13781
Ref: #json-api13919 Ref: #json-api13896
Node: DEBUG OUTPUT19407 Node: DEBUG OUTPUT19384
Ref: #debug-output19532 Ref: #debug-output19509
Node: Debug output19559 Node: Debug output19536
Ref: #debug-output-119660 Ref: #debug-output-119637
Node: ENVIRONMENT20077 Node: ENVIRONMENT20054
Ref: #environment20196 Ref: #environment20173
Node: BUGS20313 Node: BUGS20290
Ref: #bugs20397 Ref: #bugs20374
 
End Tag Table End Tag Table

View File

@ -87,13 +87,10 @@ OPTIONS
them from another server for efficiency, you would set the url them from another server for efficiency, you would set the url
with this. with this.
--capabilities=CAP[,CAP..] --allow=view|add|edit
enable the view, add, and/or manage capabilities (default: set the user's access level for changing data (default: add).
view,add) It also accepts sandstorm for use on that platform (reads per-
missions from the X-Sandstorm-Permissions request header).
--capabilities-header=HTTPHEADER
read capabilities to enable from a HTTP header, like X-Sand-
storm-Permissions (default: disabled)
--test run hledger-web's tests and exit. hspec test runner args may --test run hledger-web's tests and exit. hspec test runner args may
follow a --, eg: hledger-web --test -- --help follow a --, eg: hledger-web --test -- --help
@ -567,4 +564,4 @@ LICENSE
SEE ALSO SEE ALSO
hledger(1), hledger-ui(1), hledger-web(1), ledger(1) hledger(1), hledger-ui(1), hledger-web(1), ledger(1)
hledger-web-1.31.99 September 2023 HLEDGER-WEB(1) hledger-web-1.31.99 November 2023 HLEDGER-WEB(1)

View File

@ -1,2 +1,2 @@
m4_dnl Date to show in man pages. Updated by "Shake manuals" m4_dnl Date to show in man pages. Updated by "Shake manuals"
m4_define({{_monthyear_}}, {{September 2023}})m4_dnl m4_define({{_monthyear_}}, {{November 2023}})m4_dnl

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -97,18 +97,17 @@ Input
Usually the data file is in hledger's journal format, but it can be in Usually the data file is in hledger's journal format, but it can be in
any of the supported file formats, which currently are: any of the supported file formats, which currently are:
Reader: Reads: Used for file exten- Reader: Reads: Used for file extensions:
sions:
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
journal hledger journal files and some Ledger .journal .j .hledger journal hledger journal files and some .journal .j .hledger .ledger
journals, for transactions .ledger Ledger journals, for transac-
time- timeclock files, for precise time log- .timeclock tions
clock ging timeclock timeclock files, for precise .timeclock
timedot timedot files, for approximate time .timedot time logging
logging timedot timedot files, for approximate .timedot
csv CSV/SSV/TSV/character-separated values, .csv .ssv .tsv time logging
for data import .csv.rules .ssv.rules csv CSV/SSV/TSV/character-sepa- .csv .ssv .tsv .csv.rules
.tsv.rules rated values, for data import .ssv.rules .tsv.rules
These formats are described in more detail below. These formats are described in more detail below.
@ -494,16 +493,71 @@ Command line tips
and vice versa. (See eg #961). and vice versa. (See eg #961).
Regular expressions Regular expressions
hledger uses regular expressions in a number of places: A regular expression (regexp) is a small piece of text where certain
characters (like ., ^, $, +, *, (), |, [], \) have special meanings,
forming a tiny language for matching text precisely - very useful in
hledger and elsewhere. To learn all about them, visit regular-expres-
sions.info.
o query terms, on the command line and in the hledger-web search form: hledger supports regexps whenever you are entering a pattern to match
REGEX, desc:REGEX, cur:REGEX, tag:...=REGEX something, eg in query arguments, account aliases, CSV if rules,
hledger-web's search form, hledger-ui's / search, etc. You may need to
wrap them in quotes, especially at the command line (see Special char-
acters above). Here are some examples:
o CSV rules conditional blocks: if REGEX ... Account name queries (quoted for command line use):
o account alias directive and --alias option: alias /REGEX/ = REPLACE- Regular expression: Matches:
MENT, --alias /REGEX/=REPLACEMENT ------------------- ------------------------------------------------------------
bank assets:bank, assets:bank:savings, expenses:art:banksy, ...
:bank assets:bank:savings, expenses:art:banksy
:bank: assets:bank:savings
'^bank' none of those ( ^ matches beginning of text )
'bank$' assets:bank ( $ matches end of text )
'big \$ bank' big $ bank ( \ disables following character's special meaning )
'\bbank\b' assets:bank, assets:bank:savings ( \b matches word boundaries )
'(sav|check)ing' saving or checking ( (|) matches either alternative )
'saving|checking' saving or checking ( outer parentheses are not needed )
'savings?' saving or savings ( ? matches 0 or 1 of the preceding thing )
'my +bank' my bank, my bank, ... ( + matches 1 or more of the preceding thing )
'my *bank' mybank, my bank, my bank, ... ( * matches 0 or more of the preceding thing )
'b.nk' bank, bonk, b nk, ... ( . matches any character )
Some other queries:
desc:'amazon|amzn|audible' Amazon transactions
cur:EUR amounts with commodity symbol containing EUR
cur:'\$' amounts with commodity symbol containing $
cur:'^\$$' only $ amounts, not eg AU$ or CA$
cur:....? amounts with 4-or-more-character symbols
tag:.=202[1-3] things with any tag whose value contains 2021, 2022 or 2023
Account name aliases: accept . instead of : as account separator:
alias /\./=: replaces all periods in account names with colons
Show multiple top-level accounts combined as one:
--alias='/^[^:]+/=combined' ( [^:] matches any character other than : )
Show accounts with the second-level part removed:
--alias '/^([^:]+):[^:]+/ = \1'
match a top-level account and a second-level account
and replace those with just the top-level account
( \1 in the replacement text means "whatever was matched
by the first parenthesised part of the regexp"
CSV rules: match CSV records containing dining-related MCC codes:
if \?MCC581[124]
Match CSV records with a specific amount around the end/start of month:
if %amount \b3\.99
& %date (29|30|31|01|02|03)$
hledger's regular expressions
hledger's regular expressions come from the regex-tdfa library. If hledger's regular expressions come from the regex-tdfa library. If
they're not doing what you expect, it's important to know exactly what they're not doing what you expect, it's important to know exactly what
they support: they support:
@ -517,10 +571,10 @@ Command line tips
4. they also support GNU word boundaries (\b, \B, \<, \>) 4. they also support GNU word boundaries (\b, \B, \<, \>)
5. they do not support backreferences; if you write \1, it will match 5. backreferences are supported when doing text replacement in account
the digit 1. Except when doing text replacement, eg in account aliases or CSV rules, where backreferences can be used in the re-
aliases, where backreferences can be used in the replacement string placement string to reference capturing groups in the search regexp.
to reference capturing groups in the search regexp. Otherwise, if you write \1, it will match the digit 1.
6. they do not support mode modifiers ((?s)), character classes (\w, 6. they do not support mode modifiers ((?s)), character classes (\w,
\d), or anything else not mentioned above. \d), or anything else not mentioned above.
@ -568,7 +622,7 @@ Output
Some commands offer other kinds of output, not just text on the termi- Some commands offer other kinds of output, not just text on the termi-
nal. Here are those commands and the formats currently supported: nal. Here are those commands and the formats currently supported:
- txt csv html json sql - txt csv/tsv html json sql
-------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------
aregister Y Y Y Y aregister Y Y Y Y
balance Y 1 Y 1 Y 1,2 Y balance Y 1 Y 1 Y 1,2 Y
@ -1132,7 +1186,7 @@ Journal
A decimal mark can be written as a period or a comma: A decimal mark can be written as a period or a comma:
1.23 1.23
1,23456780000009 1,23
In the integer part of the quantity (left of the decimal mark), groups In the integer part of the quantity (left of the decimal mark), groups
of digits can optionally be separated by a digit group mark - a space, of digits can optionally be separated by a digit group mark - a space,
@ -1143,21 +1197,15 @@ Journal
INR 9,99,99,999.00 INR 9,99,99,999.00
1 000 000.9455 1 000 000.9455
Note, a number containing a single digit group mark and no decimal mark hledger is not biased towards period or comma decimal marks, so a num-
is ambiguous. Are these digit group marks or decimal marks ? ber containing just one period or comma, like 1,000 or 1.000, is am-
biguous. In such cases hledger assumes it is a decimal mark, parsing
both of these as 1.
1,000 To disambiguate these and ensure accurate number parsing, especially if
1.000 you use digit group marks, we recommend declaring the decimal mark.
You can declare it for each file with decimal-mark directives, or for
If you don't tell it otherwise, hledger will assume both of the above each commodity with commodity directives (described below).
are decimal marks, parsing both numbers as 1.
To prevent confusing parsing mistakes and undetected typos, especially
if your data contains digit group marks (eg, thousands separators), we
recommend explicitly declaring the decimal mark character in each jour-
nal file, using a directive at the top of the file. The decimal-mark
directive is best, otherwise commodity directives will also work.
These are described below.
Commodity Commodity
Amounts in hledger have both a "quantity", which is a signed decimal Amounts in hledger have both a "quantity", which is a signed decimal
@ -1196,66 +1244,45 @@ Journal
Commodity display style Commodity display style
For the amounts in each commodity, hledger chooses a consistent display For the amounts in each commodity, hledger chooses a consistent display
style to use in most reports. (Exceptions: price amounts, and all style (symbol placement, decimal mark and digit group marks, number of
amounts displayed by the print command, are displayed with all of their decimal digits) to use in most reports. This is inferred as follows:
decimal digits visible.)
A commodity's display style is inferred as follows. First, if there's a D directive declaring a default commodity, that
commodity symbol and amount format is applied to all no-symbol amounts
in the journal.
First, if a default commodity is declared with D, this commodity and Then each commodity's display style is determined from its commodity
its style is applied to any no-symbol amounts in the journal. directive. We recommend always declaring commodities with commodity
directives, since they help ensure consistent display styles and preci-
sions, and bring other benefits such as error checking for commodity
symbols.
Then each commodity's style is inferred from one of the following, in But if a commodity directive is not present, hledger infers a commod-
order of preference: ity's display styles from its amounts as they are written in the jour-
nal (excluding cost amounts and amounts in periodic transaction rules
or auto posting rules). It uses
o The commodity directive for that commodity (including the no-symbol o the symbol placement and decimal mark of the first amount seen
commodity), if any.
o The amounts in that commodity seen in the journal's transactions. o the digit group marks of the first amount with digit group marks
(Posting amounts only; prices and periodic or auto rules are ignored,
currently.)
o The built-in fallback style, which looks like this: $1000.00. (Sym- o and the maximum number of decimal digits seen across all amounts.
bol on the left, period decimal mark, two decimal places.)
A style is inferred from journal amounts as follows: And as fallback if no applicable amounts are found, it would use a de-
fault style, like $1000.00 (symbol on the left with no space, period as
decimal mark, and two decimal digits).
o Use the general style (decimal mark, symbol placement) of the first Finally, commodity styles can be overridden by the -c/--commodity-style
amount command line option.
o Use the first-seen digit group style (digit group mark, digit group
sizes), if any
o Use the maximum number of decimal places of all.
Cost amounts don't affect the commodity display style directly, but oc-
casionally they can do so indirectly (eg when a posting's amount is in-
ferred using a cost). If you find this causing problems, use a commod-
ity directive to fix the display style.
To summarise: each commodity's amounts will be normalised to (a) the
style declared by a commodity directive, or (b) the style of the first
posting amount in the journal, with the first-seen digit group style
and the maximum-seen number of decimal places. So if your reports are
showing amounts in a way you don't like, eg with too many decimal
places, use a commodity directive. Some examples:
# declare euro, dollar, bitcoin and no-symbol commodities and set their
# input number formats and output display styles:
commodity EUR 1.000,
commodity $1000.00
commodity 1000.00000000 BTC
commodity 1 000.
The inferred commodity style can be overridden by supplying a command
line option.
Rounding Rounding
Amounts are stored internally as decimal numbers with up to 255 decimal Amounts are stored internally as decimal numbers with up to 255 decimal
places, and displayed with the number of decimal places specified by places. They are displayed with their original journal precisions by
the commodity display style. Note, hledger uses banker's rounding: it print and print-like reports, and rounded to their display precision
rounds to the nearest even number, eg 0.5 displayed with zero decimal (the number of decimal digits specified by the commodity display style)
places is "0"). by other reports. When rounding, hledger uses banker's rounding (it
rounds to the nearest even digit). So eg 0.5 displayed with zero deci-
mal digits appears as "0".
Costs Costs
After a posting amount, you can note its cost (when buying) or selling After a posting amount, you can note its cost (when buying) or selling
@ -2084,84 +2111,76 @@ Journal
$ hledger accounts --alias assets=bassetts type:a $ hledger accounts --alias assets=bassetts type:a
commodity directive commodity directive
You can use commodity directives to declare your commodities. In fact The commodity directive performs several functions:
the commodity directive performs several functions at once:
1. It declares commodities which may be used in the journal. This can 1. It declares which commodity symbols may be used in the journal, en-
optionally be enforced, providing useful error checking. (Cf Com- abling useful error checking with strict mode or the check command.
modity error checking) (See Commodity error checking below.)
2. It declares which decimal mark character (period or comma), to ex- 2. It declares the precision with which this commodity's amounts should
pect when parsing input - useful to disambiguate international num- be compared when checking for balanced transactions.
ber formats in your data. Without this, hledger will parse both
1,000 and 1.000 as 1. (Cf Amounts)
3. It declares how to render the commodity's amounts when displaying 3. It declares how this commodity's amounts should be displayed, eg
output - the decimal mark, any digit group marks, the number of dec- their symbol placement, digit group mark if any, digit group sizes,
imal places, symbol placement and so on. (Cf Commodity display decimal mark (period or comma), and the number of decimal places.
style) (See Commodity display style above.)
You will run into one of the problems solved by commodity directives 4. It sets which decimal mark (period or comma) to expect when parsing
sooner or later, so we recommend using them, for robust and predictable subsequent amounts in this commodity (if there is no decimal-mark
parsing and display. directive in effect. See Decimal marks, digit group marks above.
For related dev discussion, see #793.)
Generally you should put them at the top of your journal file (since Declaring commodities solves several common parsing/display problems,
for function 2, they affect only following amounts, cf #793). so we recommend it. Generally you should put commodity directives at
the top of your journal file (because function 4 is position-sensi-
tive).
A commodity directive is just the word commodity followed by a sample Commodity directive syntax
amount, like this: A commodity directive is normally the word commodity followed by a sam-
ple amount (and optionally a comment). Only the amount's symbol and
;commodity SAMPLEAMOUNT format is significant. Eg:
commodity $1000.00 commodity $1000.00
commodity 1,000.0000 AAAA ; optional same-line comment commodity 1.000,00 EUR
commodity 1 000 000.0000 ; the no-symbol commodity
It may also be written on multiple lines, and use the format subdirec- A commodity directive's sample amount must always include a period or
tive, as in Ledger. Note in this case the commodity symbol appears comma decimal mark (this rule helps disambiguate decimal marks and
twice; it must be the same in both places: digit group marks). If you don't want to show any decimal digits,
write the decimal mark at the end:
;commodity SYMBOL commodity 1000. AAAA ; show AAAA with no decimals
; format SAMPLEAMOUNT
Commodity symbols containing spaces, numbers, or punctuation must be
enclosed in double quotes, as usual:
commodity 1.0000 "AAAA 2023"
Commodity directives normally include a sample amount, but can declare
only a symbol (ie, just function 1 above):
commodity $
commodity INR
commodity "AAAA 2023"
commodity "" ; the no-symbol commodity
Commodity directives may also be written with an indented format subdi-
rective, as in Ledger. The symbol is repeated and must be the same in
both places. Other subdirectives are currently ignored:
; display indian rupees with currency name on the left, ; display indian rupees with currency name on the left,
; thousands, lakhs and crores comma-separated, ; thousands, lakhs and crores comma-separated,
; period as decimal point, and two decimal places. ; period as decimal point, and two decimal places.
commodity INR commodity INR
format INR 1,00,00,000.00 format INR 1,00,00,000.00
an unsupported subdirective ; ignored by hledger
Other indented subdirectives are currently ignored.
Remember that if the commodity symbol contains spaces, numbers, or
punctuation, it must be enclosed in double quotes (cf Commodity).
The amount's quantity does not matter; only the format is significant.
It must include a decimal mark - either a period or a comma - followed
by 0 or more decimal digits.
A few more examples:
# number formats for $, EUR, INR and the no-symbol commodity:
commodity $1,000.00
commodity EUR 1.000,00
commodity INR 9,99,99,999.0
commodity 1 000 000.
Note hledger normally uses banker's rounding, so 0.5 displayed with
zero decimal digits is "0". (More at Commodity display style.)
Even in the presence of commodity directives, the commodity display
style can still be overridden by supplying a command line option.
Commodity error checking Commodity error checking
In strict mode, enabled with the -s/--strict flag, hledger will report In strict mode (-s/--strict) (or when you run hledger check commodi-
an error if a commodity symbol is used that has not been declared by a ties), hledger will report an error if an undeclared commodity symbol
commodity directive. This works similarly to account error checking, is used. (With one exception: zero amounts are always allowed to have
see the notes there for more details. no commodity symbol.) It works like account error checking (described
above).
Note, this disallows amounts without a commodity symbol, because cur-
rently it's not possible (?) to declare the "no-symbol" commodity with
a directive. This is one exception for convenience: zero amounts are
always allowed to have no commodity symbol.
decimal-mark directive decimal-mark directive
You can use a decimal-mark directive - usually one per file, at the top You can use a decimal-mark directive - usually one per file, at the top
@ -3012,9 +3031,9 @@ CSV
To assign a value to a hledger field, write the field name (any of the To assign a value to a hledger field, write the field name (any of the
standard hledger field/pseudo-field names, defined below), a space, standard hledger field/pseudo-field names, defined below), a space,
followed by a text value on the same line. This text value may inter- followed by a text value on the same line. This text value may inter-
polate CSV fields, referenced by their 1-based position in the CSV polate CSV fields, referenced either by their 1-based position in the
record (%N), or by the name they were given in the fields list (%CSV- CSV record (%N) or by the name they were given in the fields list
FIELD). (%CSVFIELD), and regular expression match groups (\N).
Some examples: Some examples:
@ -3264,7 +3283,29 @@ CSV
o When a matcher is preceded by ampersand (&) it will be AND'ed with o When a matcher is preceded by ampersand (&) it will be AND'ed with
the previous matcher (both of them must match). the previous matcher (both of them must match).
There's not yet an easy syntax to negate a matcher. When a matcher is preceded by an exclamation mark (!), the matcher will
be negated, ie it will exclude CSV records that match.
Match groups
Matchers can define match groups: parenthesised portions of the regular
expression which are available for reference in field assignments.
Groups are enclosed in regular parentheses (( and )) and can be nested.
Each group is available in field assignments using the token \N, where
N is an index into the match groups for this conditional block (e.g.
\1, \2, etc.).
Example: Warp credit card payment postings to the beginning of the
billing period (Month start), to match how they are presented in state-
ments, using posting dates:
if %date (....-..)-..
comment2 date:\1-01
Another example: Read the expense account from the CSV field, but throw
away a prefix:
if %account1 liabilities:family:(expenses:.*)
account1 \1
if table if table
"if tables" are an alternative to if blocks; they can express many "if tables" are an alternative to if blocks; they can express many
@ -3277,18 +3318,21 @@ CSV
MATCHERC,VALUE1,VALUE2,... MATCHERC,VALUE1,VALUE2,...
<empty line> <empty line>
The first character after if is taken to be the separator for the rest The first character after if is taken to be this if table's field sepa-
of the table. It should be a non-alphanumeric character like , or | rator. It is unrelated to the separator used in the CSV file. It
that does not appear anywhere else in the table. (Note: it is unre- should be a non-alphanumeric character like , or | that does not appear
lated to the CSV file's separator.) Whitespace can be used in the anywhere else in the table (it should not be used in field names or
matcher lines for readability, but not in the if line currently. The matchers or values, and it cannot be escaped with a backslash).
table must be terminated by an empty line (or end of file). Each line
must contain the same number of separators; empty values are allowed.
The above means: try all of the matchers; whenever a matcher succeeds, Each line must contain the same number of separators; empty values are
assign all of the values on that line to the corresponding hledger allowed. Whitespace can be used in the matcher lines for readability
fields; later lines can overrider earlier ones. It is equivalent to (but not in the if line, currently). The table must be terminated by
this sequence of if blocks: an empty line (or end of file).
An if table like the above is interpreted as follows: try all of the
matchers; whenever a matcher succeeds, assign all of the values on that
line to the corresponding hledger fields; later lines can overrider
earlier ones. It is equivalent to this sequence of if blocks:
if MATCHERA if MATCHERA
HLEDGERFIELD1 VALUE1 HLEDGERFIELD1 VALUE1
@ -4165,6 +4209,53 @@ Timedot
A sample.timedot file. A sample.timedot file.
PART 3: REPORTING CONCEPTS PART 3: REPORTING CONCEPTS
Amount formatting, parseability
If you're wondering why your print report sometimes shows trailing dec-
imal marks, even when there are no decimal digits; it does this to dis-
ambiguate ambiguous amounts (amounts which have one digit group mark
and no decimal digits), allowing them to be re-parsed reliably.
More generally: hledger output falls into three rough categories, which
format amounts a little bit differently to suit different consumers:
1. "hledger-readable output" - should be readable by hledger (and by
humans)
o This is produced by reports that show full journal entries: print,
import, close, rewrite etc.
o It shows amounts with their original journal precisions, which may
not be consistent.
o It adds a trailing decimal mark when needed to avoid showing ambigu-
ous amounts.
o It can be parsed reliably (by hledger and ledger2beancount at least,
but perhaps not by Ledger..)
2. "human-readable output" - usually for humans
o This is produced by all other reports.
o It shows amounts with standard display precisions, which will be con-
sistent within each commodity.
o It shows ambiguous amounts unmodified.
o It can be parsed reliably in the context of a known report (when you
know decimals are consistently not being shown, you can assume a sin-
gle mark is a digit group mark).
3. "machine-readable output" - usually for other software
o This is produced by all reports when an output format like csv, tsv,
json, or sql is selected.
o It shows amounts as 1 or 2 do, but without digit group marks.
o It can be parsed reliably (if needed, the decimal mark can be changed
with -c/--commodity-style).
Time periods Time periods
Report start & end date Report start & end date
By default, most hledger reports will show the full span of time repre- By default, most hledger reports will show the full span of time repre-
@ -5127,21 +5218,29 @@ Value reporting
that. that.
Valuation date Valuation date
Since market prices can change from day to day, market value reports Market prices can change from day to day. hledger will use the prices
have a valuation date (or more than one), which determines which market on a particular valuation date (or on more than one date). By default
prices will be used. hledger uses "end" dates for valuation. More specifically:
For single period reports, if an explicit report end date is specified, o For single period reports (including normal print and register re-
that will be used as the valuation date; otherwise the valuation date ports):
is the journal's end date.
For multiperiod reports, each column/period is valued on the last day o If an explicit report end date is specified, that is used
of the period, by default.
o Otherwise the latest transaction date or P directive date is used
(even if it's in the future)
o For multiperiod reports, each period is valued on its last day.
This can be customised with the --value option described below, which
can select either "then", "end", "now", or "custom" dates. (Note, this
has a bug in hledger-ui <=1.31: turning on valuation with the V key al-
ways resets it to "end".)
Finding market price Finding market price
To convert a commodity A to its market value in another commodity B, To convert a commodity A to its market value in another commodity B,
hledger looks for a suitable market price (exchange rate) as follows, hledger looks for a suitable market price (exchange rate) as follows,
in this order of preference : in this order of preference:
1. A declared market price or inferred market price: A's latest market 1. A declared market price or inferred market price: A's latest market
price in B on or before the valuation date as declared by a P direc- price in B on or before the valuation date as declared by a P direc-
@ -5422,38 +5521,6 @@ Value reporting
2000-03-01 2000-03-01
(a) 1 B (a) 1 B
You may need to explicitly set a commodity's display style, when re-
verse prices are used. Eg this output might be surprising:
P 2000-01-01 A 2B
2000-01-01
a 1B
b
$ hledger print -x -X A
2000-01-01
a 0
b 0
Explanation: because there's no amount or commodity directive specify-
ing a display style for A, 0.5A gets the default style, which shows no
decimal digits. Because the displayed amount looks like zero, the com-
modity symbol and minus sign are not displayed either. Adding a com-
modity directive sets a more useful display style for A:
P 2000-01-01 A 2B
commodity 0.00A
2000-01-01
a 1B
b
$ hledger print -X A
2000-01-01
a 0.50A
b -0.50A
Interaction of valuation and queries Interaction of valuation and queries
When matching postings based on queries in the presence of valuation, When matching postings based on queries in the presence of valuation,
the following happens. the following happens.
@ -5901,18 +5968,22 @@ PART 4: COMMANDS
--align-all flag. --align-all flag.
This command also supports the output destination and output format op- This command also supports the output destination and output format op-
tions. The output formats supported are txt, csv, and json. tions. The output formats supported are txt, csv, tsv, and json.
aregister and custom posting dates aregister and posting dates
Transactions whose date is outside the report period can still be aregister always shows one line (and date and amount) per transaction.
shown, if they have a posting to this account dated inside the report But sometimes transactions have postings with different dates. Also,
period. (And in this case it's the posting date that is shown.) This not all of a transaction's postings may be within the report period.
ensures that aregister can show an accurate historical running balance, To resolve this, aregister shows the earliest of the transaction's date
matching the one shown by register -H with the same arguments. and posting dates that is in-period, and the sum of the in-period post-
ings. In other words it will show a combined line item with just the
earliest date, and the running balance will (temporarily, until the
transaction's last posting) be inaccurate. Use register -H if you need
to see the individual postings.
To filter strictly by transaction date instead, add the --txn-dates There is also a --txn-dates flag, which filters strictly by transaction
flag. If you use this flag and some of your postings have custom date, ignoring posting dates. This too can cause an inaccurate running
dates, it's probably best to assume the running balance is wrong. balance.
balance balance
(bal) (bal)
@ -5996,9 +6067,9 @@ PART 4: COMMANDS
o commodities displayed on the same line or multiple lines (--layout) o commodities displayed on the same line or multiple lines (--layout)
This command supports the output destination and output format options, This command supports the output destination and output format options,
with output formats txt, csv, json, and (multi-period reports only:) with output formats txt, csv, tsv, json, and (multi-period reports
html. In txt output in a colour-supporting terminal, negative amounts only:) html. In txt output in a colour-supporting terminal, negative
are shown in red. amounts are shown in red.
The --related/-r flag shows the balance of the other postings in the The --related/-r flag shows the balance of the other postings in the
transactions of the postings which would normally be shown. transactions of the postings which would normally be shown.
@ -6970,8 +7041,8 @@ PART 4: COMMANDS
flipped. flipped.
This command also supports the output destination and output format op- This command also supports the output destination and output format op-
tions The output formats supported are txt, csv, html, and (experimen- tions The output formats supported are txt, csv, tsv, html, and (exper-
tal) json. imental) json.
balancesheetequity balancesheetequity
(bse) (bse)
@ -7018,8 +7089,8 @@ PART 4: COMMANDS
sign flipped. sign flipped.
This command also supports the output destination and output format op- This command also supports the output destination and output format op-
tions The output formats supported are txt, csv, html, and (experimen- tions The output formats supported are txt, csv, tsv, html, and (exper-
tal) json. imental) json.
cashflow cashflow
(cf) (cf)
@ -7066,8 +7137,8 @@ PART 4: COMMANDS
not:receivable, but with smarter account detection. not:receivable, but with smarter account detection.
This command also supports the output destination and output format op- This command also supports the output destination and output format op-
tions The output formats supported are txt, csv, html, and (experimen- tions The output formats supported are txt, csv, tsv, html, and (exper-
tal) json. imental) json.
check check
Check for various kinds of errors in your data. Check for various kinds of errors in your data.
@ -7481,10 +7552,10 @@ PART 4: COMMANDS
$ hledger help -m journal # show it with man, even if info is installed $ hledger help -m journal # show it with man, even if info is installed
import import
Read new transactions added to each FILE since last run, and add them Read new transactions added to each FILE provided as arguments since
to the journal. Or with --dry-run, just print the transactions that last run, and add them to the journal. Or with --dry-run, just print
would be added. Or with --catchup, just mark all of the FILEs' trans- the transactions that would be added. Or with --catchup, just mark all
actions as imported, without actually importing any. of the FILEs' current transactions as imported, without importing them.
This command may append new transactions to the main journal file This command may append new transactions to the main journal file
(which should be in journal format). Existing transactions are not (which should be in journal format). Existing transactions are not
@ -7501,14 +7572,14 @@ PART 4: COMMANDS
common import source, and these docs focus on that case. common import source, and these docs focus on that case.
Deduplication Deduplication
As a convenience import does deduplication while reading transactions. import does time-based deduplication, to detect only the new transac-
This does not mean "ignore transactions that look the same", but rather tions since the last successful import. (This does not mean "ignore
"ignore transactions that have been seen before". This is intended for transactions that look the same", but rather "ignore transactions that
when you are periodically importing foreign data which may contain al- have been seen before".) This is intended for when you are periodi-
ready-imported transactions. So eg, if every day you download bank CSV cally importing downloaded data, which may overlap with previous down-
files containing redundant data, you can safely run hledger import loads. Eg if every week (or every day) you download a bank's last
bank.csv and only new transactions will be imported. (import is idem- three months of CSV data, you can safely run hledger import thebank.csv
potent.) each time and only new transactions will be imported.
Since the items being read (CSV records, eg) often do not come with Since the items being read (CSV records, eg) often do not come with
unique identifiers, hledger detects new transactions by date, assuming unique identifiers, hledger detects new transactions by date, assuming
@ -7528,10 +7599,12 @@ PART 4: COMMANDS
be the ones affected). be the ones affected).
hledger remembers the latest date processed in each input file by sav- hledger remembers the latest date processed in each input file by sav-
ing a hidden ".latest" state file in the same directory. Eg when read- ing a hidden ".latest.FILE" file in FILE's directory (after a succesful
ing finance/bank.csv, it will look for and update the finance/.lat- import).
est.bank.csv state file. The format is simple: one or more lines con-
taining the same ISO-format date (YYYY-MM-DD), meaning "I have Eg when reading finance/bank.csv, it will look for and update the fi-
nance/.latest.bank.csv state file. The format is simple: one or more
lines containing the same ISO-format date (YYYY-MM-DD), meaning "I have
processed transactions up to this date, and this many of them on that processed transactions up to this date, and this many of them on that
date." Normally you won't see or manipulate these state files yourself. date." Normally you won't see or manipulate these state files yourself.
But if needed, you can delete them to reset the state (making all But if needed, you can delete them to reset the state (making all
@ -7622,8 +7695,8 @@ PART 4: COMMANDS
sign flipped. sign flipped.
This command also supports the output destination and output format op- This command also supports the output destination and output format op-
tions The output formats supported are txt, csv, html, and (experimen- tions The output formats supported are txt, csv, tsv, html, and (exper-
tal) json. imental) json.
notes notes
List the unique notes that appear in transactions. List the unique notes that appear in transactions.
@ -7660,11 +7733,20 @@ PART 4: COMMANDS
Person A Person A
prices prices
Print market price directives from the journal. With --infer-market- Print the market prices declared with P directives. With --infer-mar-
prices, generate additional market prices from costs. With --infer-re- ket-prices, also show any additional prices inferred from costs. With
verse-prices, also generate market prices by inverting known prices. --show-reverse, also show additional prices inferred by reversing known
Prices can be filtered by a query. Price amounts are displayed with prices.
their full precision.
Price amounts are always displayed with their full precision, except
for reverse prices which are limited to 8 decimal digits.
Prices can be filtered by a date:, cur: or amt: query.
Generally if you run this command with --infer-market-prices --show-re-
verse, it will show the same prices used internally to calculate value
reports. But if in doubt, you can inspect those directly by running
the value report with --debug=2.
print print
Show transaction journal entries, sorted by date. Show transaction journal entries, sorted by date.
@ -7672,26 +7754,14 @@ PART 4: COMMANDS
The print command displays full journal entries (transactions) from the The print command displays full journal entries (transactions) from the
journal file, sorted by date (or with --date2, by secondary date). journal file, sorted by date (or with --date2, by secondary date).
Amounts are shown mostly normalised to commodity display style, eg the
placement of commodity symbols will be consistent. All of their deci-
mal places are shown, as in the original journal entry (with one alter-
ation: in some cases trailing zeroes are added.)
Amounts are shown right-aligned within each transaction (but not across
all transactions).
Directives and inter-transaction comments are not shown, currently. Directives and inter-transaction comments are not shown, currently.
This means the print command is somewhat lossy, and if you are using it This means the print command is somewhat lossy, and if you are using it
to reformat your journal you should take care to also copy over the di- to reformat/regenerate your journal you should take care to also copy
rectives and file-level comments. over the directives and inter-transaction comments.
Eg: Eg:
$ hledger print $ hledger print -f examples/sample.journal date:200806
2008/01/01 income
assets:bank:checking $1
income:salary $-1
2008/06/01 gift 2008/06/01 gift
assets:bank:checking $1 assets:bank:checking $1
income:gifts $-1 income:gifts $-1
@ -7705,13 +7775,56 @@ PART 4: COMMANDS
expenses:supplies $1 expenses:supplies $1
assets:cash $-2 assets:cash $-2
2008/12/31 * pay off print explicitness
liabilities:debts $1 Normally, whether posting amounts are implicit or explicit is pre-
assets:bank:checking $-1 served. For example, when an amount is omitted in the journal, it will
not appear in the output. Similarly, if a conversion cost is implied
but not written, it will not appear in the output.
You can use the -x/--explicit flag to force explicit display of all
amounts and costs. This can be useful for troubleshooting or for mak-
ing your journal more readable and robust against data entry errors.
-x is also implied by using any of -B,-V,-X,--value.
The -x/--explicit flag will cause any postings with a multi-commodity
amount (which can arise when a multi-commodity transaction has an im-
plicit amount) to be split into multiple single-commodity postings,
keeping the output parseable.
print amount style
Amounts are shown right-aligned within each transaction (but not
aligned across all transactions; you can do that with ledger-mode in
Emacs).
Amounts will be (mostly) normalised to their commodity display style:
their symbol placement, decimal mark, and digit group marks will be
made consistent. By default, decimal digits are shown as they are
written in the journal.
With the --round option, print will try increasingly hard to display
decimal digits according to the commodity display styles:
o --round=none show amounts with original precisions (default)
o --round=soft add/remove decimal zeros in amounts (except costs)
o --round=hard round amounts (except costs), possibly hiding signifi-
cant digits
o --round=all round all amounts and costs
soft is good for non-lossy cleanup, formatting amounts more consis-
tently where it's safe to do so.
hard and all can cause print to show invalid unbalanced journal en-
tries; they may be useful eg for stronger cleanup, with manual fixups
when needed.
print parseability
print's output is usually a valid hledger journal, and you can process print's output is usually a valid hledger journal, and you can process
it again with a second hledger command. This can be useful for certain it again with a second hledger command. This can be useful for certain
kinds of search, eg: kinds of search (though the same can be achieved with expr: queries
now):
# Show running total of food expenses paid from cash. # Show running total of food expenses paid from cash.
# -f- reads from stdin. -I/--ignore-assertions is sometimes needed. # -f- reads from stdin. -I/--ignore-assertions is sometimes needed.
@ -7726,36 +7839,41 @@ PART 4: COMMANDS
o Account aliases can generate bad account names. o Account aliases can generate bad account names.
Normally, the journal entry's explicit or implicit amount style is pre- print, other features
served. For example, when an amount is omitted in the journal, it will With -B/--cost, amounts with costs are shown converted to cost.
not appear in the output. Similarly, when a cost is implied but not
written, it will not appear in the output. You can use the -x/--ex-
plicit flag to make all amounts and costs explicit, which can be useful
for troubleshooting or for making your journal more readable and robust
against data entry errors. -x is also implied by using any of
-B,-V,-X,--value.
Note, -x/--explicit will cause postings with a multi-commodity amount With --new, print shows only transactions it has not seen on a previous
(these can arise when a multi-commodity transaction has an implicit run. This uses the same deduplication system as the import command.
amount) to be split into multiple single-commodity postings, keeping (See import's docs for details.)
the output parseable.
With -B/--cost, amounts with costs are converted to cost using that With -m DESC/--match=DESC, print shows one recent transaction whose de-
price. This can be used for troubleshooting. scription is most similar to DESC. DESC should contain at least two
characters. If there is no similar-enough match, no transaction will
With -m DESC/--match=DESC, print does a fuzzy search for one recent be shown and the program exit code will be non-zero.
transaction whose description is most similar to DESC. DESC should
contain at least two characters. If there is no similar-enough match,
no transaction will be shown and the program exit code will be non-
zero.
With --new, hledger prints only transactions it has not seen on a pre-
vious run. This uses the same deduplication system as the import com-
mand. (See import's docs for details.)
print output format
This command also supports the output destination and output format op- This command also supports the output destination and output format op-
tions The output formats supported are txt, csv, and (experimental) tions The output formats supported are txt, beancount, csv, tsv, json
json and sql. and sql.
Experimental: The beancount format tries to produce Beancount-compati-
ble output. It is very basic and may require additional manual fixups:
o Transaction and postings with unmarked status are converted to
cleared (`*``) status.
o Transactions' payee and or note are wrapped in double quotes.
o Transaction tags are copied to Beancount #tag format.
o Account name parts are capitalised, and if the first account name
part is not one of Assets, Liabilities, Equity, Income, or Expenses,
"Equity:" is prepended.
o The $ commodity symbol is converted to USD.
o An open directive is generated for each account used, on the earliest
transaction date.
Here's an example of print's CSV output: Here's an example of print's CSV output:
@ -7912,8 +8030,8 @@ PART 4: COMMANDS
$ hledger reg -w $COLUMNS,40 # use terminal width, & description width 40 $ hledger reg -w $COLUMNS,40 # use terminal width, & description width 40
This command also supports the output destination and output format op- This command also supports the output destination and output format op-
tions The output formats supported are txt, csv, and (experimental) tions The output formats supported are txt, csv, tsv, and (experimen-
json. tal) json.
rewrite rewrite
Print all transactions, rewriting the postings of matched transactions. Print all transactions, rewriting the postings of matched transactions.
@ -8372,7 +8490,7 @@ PART 5: COMMON TASKS
On unix and mac, running these commands in the terminal will work for On unix and mac, running these commands in the terminal will work for
many people; adapt as needed: many people; adapt as needed:
$ echo 'export LEDGER_FILE=~/finance/2023.journal` >> ~/.profile $ echo 'export LEDGER_FILE=~/finance/2023.journal' >> ~/.profile
$ source ~/.profile $ source ~/.profile
When correctly configured, in a new terminal window env | grep When correctly configured, in a new terminal window env | grep
@ -8759,6 +8877,12 @@ BUGS
$ echo "export LANG=en_US.utf8" >>~/.profile $ echo "export LANG=en_US.utf8" >>~/.profile
# close and re-open terminal window # close and re-open terminal window
If you are using Nix (not NixOS) for GHC and Hledger, you might need to
set the LOCALE_ARCHIVE variable:
$ echo "export LOCALE_ARCHIVE=${glibcLocales}/lib/locale/locale-archive" >>~/.profile
# close and re-open terminal window
COMPATIBILITY ISSUES: hledger gives an error with my Ledger file COMPATIBILITY ISSUES: hledger gives an error with my Ledger file
Not all of Ledger's journal file syntax or feature set is supported. Not all of Ledger's journal file syntax or feature set is supported.
See hledger and Ledger for full details. See hledger and Ledger for full details.
@ -8781,4 +8905,4 @@ LICENSE
SEE ALSO SEE ALSO
hledger(1), hledger-ui(1), hledger-web(1), ledger(1) hledger(1), hledger-ui(1), hledger-web(1), ledger(1)
hledger-1.31.99 September 2023 HLEDGER(1) hledger-1.31.99 November 2023 HLEDGER(1)