Repository navigation #
Upgrading from hledger 1 ? See Upgrading to hledger 2.
hledger 2 is developed with careful, disclosed AI assistance, and uses no AI at runtime;
see hledger 2 and AI and the AI policy.
#
Release notes #
hledger 2: lot tracking and capital gains, a holdings report, charts, twelve UI languages, assert rules, new queries, easier setup and importing, journal format improvements, custom commands, a much more capable hledger-web, auto-re hledger-ui, and 2-3x more speed.
hledger 2.0
All changes since hledger 1.52.4.
For the 1.99.x preview releases, and 2.0's changes since the last of them (1.99.6),
see https://hledger.org/relnotes199.html.
hledger 2 is the first hledger release developed with AI assistance;
see the https://hledger.org/relnotes.html intro and https://hledger.org/AI.html.
For more help with upgrading, see https://hledger.org/upgrading.html.
Highlights
The most notable changes since hledger 1.52; each is described in its section below.
- Lot tracking and capital gains: cost basis, lot movements and gains are tracked, checked and inferred;
and a new
holdingsreport shows your investments' performance. (Investments) - Charts: most reports can be shown as charts in the terminal, or as SVG or HTML, with
--chart;--viewopens any report in a viewer. (Reporting) - Translations: hledger, hledger-ui and hledger-web can be shown in 12 languages, and new languages are easy to add. (Running hledger)
- Assert rules: standing rules about your data, written as queries and checked like balance assertions. (Journal format)
- New queries:
::(short forfind:) searches in all fields, andchange:andbalance:select report rows by their amounts. (Reporting) - Easier setup and importing:
initcreates starter files,getfetches data and prices, andimportneeds no arguments; CSV rules gainmerge, functions,ifstables and amount expressions. (Getting data in) - Journal format: amount expressions, commodity aliases, account alias tags, and CSV files included in journals. (Journal format)
- Custom commands, defined in your config file; a reorganised
help; and an improvedreplandrun. (Running hledger) - Speed: hledger is 2-3x faster than 1.52, and uses up to a third less memory. (Performance)
Breaking changes
hledger 2 reads hledger 1 data, and most users will need no changes.
But here are the breaking changes you might encounter.
(These are described more fully in the sections below.)
Changes in how files are read:
Config files can no longer select the command to run with a bare first word in the general section. (Now such a word is read as a query argument.) The command must be given on the command line. (Config files) #
A repeated commodity declaration now adds to the earlier one instead of replacing it,
and with several-f files the last file's display style is used, not the first's.
(Journal format) #
Amounts which hledger infers no longer affect commodities' display precision, or the precision used to balance the entry. So some reports show fewer decimal places. (Journal format) #
alias directives are now applied beforeapply account , as in Ledger.
(Journal format) #
apply year is now scoped, as in Ledger:end apply year restores the previous default year.
(Journal format) #
In CSV rules, when a setting like date-format orseparator is declared more than once, the last one now wins (exceptskip ).
And thesource andarchive rules now read from and save to adata/ directory next to the journal.
(Data import) #
Sales with a cost basis annotation and no gain posting now get an inferred gain posting, to revenues:gain by default.
(Lot tracking)
Changes in commands and output:
print now aligns amounts by their decimal mark.--layout=hledger1 gives the old layout. #
register now hides zero-amount postings unless-E is used. #
activity now shows transactions per week, as a chart;activity --postings -D -0 gives the old report. #
--tldr is now--examples .stats -1 is nowstats --oneline .--txn-balancing=exact|old is now--txn-tolerance=entry|display (the old spelling still works).
--verbose-tags is now an option ofprint andrewrite only.commodities --used now shows only commodities used in transactions. #
hledger test is nowhledger --test . Thedemo command is removed.
The hledger-check-fancyassertions add-on is removed, replaced by assert rules. #
accounts andpayees now respect transaction-specific query terms likedate: ordesc: ,
which no longer match declared but unused accounts or payees.any: andall: queries now also work in posting reports.
New query prefixes (find: ,change: ,balance: ) mean that account names beginning with those needacct: .
(Queries) #
In JSON output, postings' ptype field is renamed topreal .
In csv/html output, print's debit column now comes before credit, and aregister's "change" column is now "amount".
New errors you might see:
With a decimal-mark directive (or CSV rule) in effect, a number clearly using the other decimal mark (1,000.00 whendecimal-mark , is declared),
or using the declared mark more than once (1.2.34 , previously read as 1234), is now an error.
(#1985 ,#1904 ) #
A hyphenated date range like 2026-13 is no longer read as "from 2026 to the 13th of this month"; it is rejected as a mistyped date.
(Write2026..13 for that.) #
Account names with an empty part (beginning or ending with : , or containing:: ) are now an error.
And account names whose last part is enclosed in curly braces (assets:{foo} ) are reserved for lot subaccounts, and must contain a valid lot name.
(Journal format) #
An unquoted commodity symbol can no longer begin with ( when written before the number, or with/ when written after it,
because of the new amount expressions; eg(A) 10 or10 /kg must now be written"(A)" 10 or10 "/kg" .
(Journal format) #
In CSV rules files, * at the start of a line no longer begins a comment; use# or; .
And more than onesource rule in a rules file (including its included files) is now an error.
(Data import) #
Ledger-style assert EXPR directives, previously ignored, must now use hledger's assert syntax.
And anend apply year with no matchingapply year is an error.
(Assert rules, Journal format) #
Cost basis annotations like {$50} , which hledger 1 ignored, are now interpreted and checked.
So entries using them may be rejected, eg if a purchase's{} cost basis and@ cost disagree,
if a sale takes from a lot which was never acquired, or if a sale's@ is not the selling price.
-I or--ignore-lots disables this.
(Lot tracking)
Running hledger
Command line
acc ,comm ,desc are now official short spellings for theaccounts ,commodities anddescriptions commands.
When an-O value looks like a file name, the error suggests-o .
With an unrecognised argument, the error shows it, and the config file it came from, if any (#2489 ).
hledger no longer duplicates options in theLESS environment variable. #
Colour handling is more robust: ANSI colour is no longer used when TERM=dumb , eg in an Emacs shell (--color=yes overrides);
colour works in terminals where the background lightness can't be detected (a light background is assumed);
and in terminals without truecolor support, we downgrade to the nearest xterm 256-colour. #
The built-in unit tests are now run with an option, hledger --test[=PATTERN] , not a command. #
Fixed: option handling is more robust: a missing option value gives a clear error (eg hledger import -f --dry-run no longer
uses--dry-run as the file name); bad option values are always reported; and a flag belonging to another command gets an accurate error.
(Kevin F. Konrad,#2696 ) #
Fixed: -o - now writes to stdout, as documented; with-o FILE , an error no longer leaves an empty or truncated file behind;
stats -o FILE writes all of its output to the file; and on Linux, output redirected to a file on a network drive (eg a CIFS mount) is no longer silently truncated. #
Multi-period reports with more than 10000 periods, or a --forecast generating more than 100000 transactions, now print a warning,
so you can cancel. Such numbers usually mean a mistyped date, and could use many gigabytes of memory.
(#1683 ) #
Fixed: command line arguments are now passed to addon commands exactly as typed; apostrophes, empty strings or other special characters
could be mangled or dropped. (Except on Windows, where addons are still run through the shell.)
And options written after-- are passed through to an addon command rather than consumed by hledger.
(Kevin F. Konrad, Arthur Cinader,#2696 ) #
Fixed: on Windows, file paths containing spaces are now quoted properly when running external helpers (info, man, tldr, pager, $EDITOR , hledger-iadd).
(#2646 ) #
hledger is now built with GHC runtime system options enabled.
So eghledger +RTS -M2G -RTS ... caps memory use (an overflow will raise an error rather than consuming all memory),
and+RTS -c uses 20-40% less memory at the cost of speed.
Config files
You can now define custom commands (command aliases), by adding NAME = COMMAND... to the[alias] section of your config file.
COMMAND can be a builtin command, an addon command, another alias, or a shell command prefixed with! , and can be continued on multiple indented lines.
(Shell commands run only from your user config file, or one specified explicitly with--conf .) #
Config files can no longer specify the command to run via a bare first word in the general section; with command aliases able to run shell commands, that was too risky. #
Config file errors now use hledger's standard error format, and say how to run without the config file ( -n ).
--help ,--version and--test now work despite config file errors. #
Fixed: a # inside quotes is no longer misparsed as a comment start; leading whitespace before a section header,
and a final line with whitespace and no newline, are accepted; and--conf /--no-conf flags inside a config file are ignored.
Help
help has been reorganised, and is now an entry point for all hledger docs:
helpwith no arguments (orhledgerwith no command) shows a quick reference card.help commandsshows the full commands list (--builtins,--addonsand--aliaseslimit it).help examples [CMD]shows command examples (like--examples, formerly--tldr).help usage [CMD]shows command options and docs (like-h).help manual [TOPIC]orhelp TOPICshows the manual, in several formats, now including the HTML versions at hledger.org (--webman). Topics are matched by exact match or unique prefix, in the hledger-ui and hledger-web manuals too, andhelp manual -llists them.help install/docs/support/home/sponsor/relnotesopen the corresponding hledger.org page in a web browser. (Arthur Cinader)
When TERM=dumb , or in Emacs shells that don't support TUIs,help manual shows plain text instead of failing to run a viewer.
h is help's official alias, and the-? flag also shows the quick reference. Thedemo command, which played asciinema recordings, is removed.
REPL & run
The REPL now auto-reloads before each command, detecting changes in input files, the config file, or installed addon commands ( --no-watch disables this).
Changes to CSV rules files and their data files are detected too.
It shows a small startup banner, and the journal's file name in the prompt;h andq are help and quit;
help andCMD -h show the same full, paged output as at the command line, and work even when there's a problem in the journal. #
Most general flags given to repl orrun at startup (such as-I ,--strict ,-b /-e ,--depth ,--cost ,--color )
now apply to every command in the session or script (and can be overridden per command).
An-f at startup sets the default journal file(s) for all commands, including addons; a nonexistent default journal file is tolerated. #
Quoted arguments in run /repl command lines and in config files are now tokenised more like the shell:
quotes can enclose part of an argument, sodate:'1 to 15' is the single argumentdate:1 to 15 .
Also like the shell, a lone quote within an argument (egdesc:o'brien ) must now be quoted or avoided. A bad command line gives a proper error. #
run scripts are more robust: running an addon command no longer ends the script. #
run with-O html ,-o FILE.html or--view writes its commands' outputs as one combined html page,
with a folding section for each command, and links to show just titles, charts, or all data.
Eg:hledger run --view -- is -M --chart -- bs -Q --chart .
Translations
hledger, hledger-ui and hledger-web can now be shown in 12 languages:
English, Brazilian Portuguese, Chinese, French, German, Hawaiian, Irish, Italian, Japanese, Russian, Spanish and Ukrainian.
The new--lang=LANG general option (also usable in config files) selects one, for report titles, headings, month names etc;
--lang=auto chooses based on your system locale.
Gaps in human translations are filled by machine translations, which are marked for review.
Native speakers' help is welcome; seehttps://hledger.org/TRANSLATING.html .
(Arthur Cinader, Daniil Iaitskov (Russian), Diego Depaoli (Italian), Henning Thielemann (German), Chunhui Ouyang (Chinese), Simon Michael,#2736 ) #
You can add or override a translation by installing a gettext PO file at $XDG_CONFIG_HOME/hledger/locale/LANG.po ; no compilation is needed.
hledger --write-lang=LANG writes the current po file for a supported language, or a starter file for a new language, there.
Error messages
More error messages use the standard layout, with a position and an excerpt, and are detected correctly by editor addons like flycheck-hledger and flymake-hledger (which have been updated). Single-line positions show the line number just once (FILE:5, not FILE:5-5). Errors about a posting followed by comment lines now mark the correct line. #
Very long "expecting" lists in parse errors are abbreviated, and errors inside a cost amount are reported more specifically. #
Balance assertion failures show a better troubleshooting command: it ends the register at the assertion ( -e ), shows zero-amount postings (-E ),
uses the more precise--ignore-assertions , and escapes or quotes special characters properly.
Getting data in
Data entry
add 's default amounts are better: they are shown with the journal's commodity display styles; they are not shown
with ambiguous digit group marks (like1.000 ); and useful defaults are offered after entering a balance assignment.
It weights similar transactions by their distance from today, not from the journal's latest date, so a future-dated typo doesn't skew the defaults.
(#2645 ,#2656 ) #
Fixed: add no longer saves an entry which would make the journal unreadable.
It now runs all enabled journal checks with the new entry (eg lots must be valid, and with--strict , the strict checks must pass),
and if there's a problem, it shows the error and goes back a step, so you can correct the entry.
Likewise if the entry doesn't balance or fails a balance assertion, it no longer restarts at posting 1.
(#2869 ) #
add andimport now test for faulty filesystems before writing.
Some filesystems, eg an Android shared filesystem in Termux, overwrite when told to append;setup warns about this too.
(#2577 )
Data import
A new init command creates starter files for a new hledger setup, in the current or a given directory.
--layout selects from several file layouts:simple (one journal file),
default (separate account/commodity/payee declaration files, data/prices/rules directories, starterget scripts and csv rules),
oryears (a journal file per year, combined by all.journal).hledger init FILE.journal writes just one self-contained journal.
Existing files are never changed, so init can be re-run to restore missing files.--dry-run shows what would be created. #
get is a new command for fetching transaction data and market prices. It runs two helper scripts which you can customise:
data/getdata , to gather data (eg CSV) files indata/ , andprices/getprices , to download market prices intoprices/ ,
next to the main journal file.--transactions or--prices runs just one of these. Sample scripts are in the hledger repo's bin/ directory,
and are installed byhledger init .get preserves the format of existing prices when merging new ones. #
import with no file arguments now reads all the.rules files in therules/ directory next to the main journal file.
(Files whose name begins with. or_ are skipped; this is useful for included files.)
Andimport -g/--get runsget first. So a complete import workflow can be:hledger import -g [--dry-run] . #
The CSV source andarchive rules now use the journal'sdata/ directory by default:
source looks for bare file names and relative paths first indata/ , then in~/Downloads
(paths beginning with./ or../ are still relative to the rules file);
andarchive saves todata/archive/ (previously, a data directory next to the rules file). #
More than one source rule in a CSV rules file is now an error, suggesting to
use one rules file per data file. Previously all but onesource rule was silently ignored.
(#2862 ) #
Fixed: import no longer writes entries which would make the journal unreadable.
It now runs all enabled journal checks with the new entries (eg balance assertions, valid lot movements,
and with--strict the strict checks), and if there's a problem, it shows the error, writing nothing.
(#2869 ) #
Fixed: import witharchive enabled and multiple downloaded copies of the source file now deletes processed files and always makes progress
(it could stall, reprocessing the oldest file); it archives only when new transactions were actually imported;
andimport --dry-run no longer archives data files when the flag is abbreviated (--dr ). #
CSV error messages are much improved. They show the CSV file and record position with an excerpt; the record's field values with their numbers and names;
the rules file, where each field's rule was defined, and any rules it overrode;
and if an entry converted from CSV is rejected later (eg by balancing), the record it came from.
--debug=2 output for CSV reading is clearer, and shows the if rules that matched each record, with their file and line number. #
CSV rules can transform values by calling functions in %{...} expressions:
upper, lower, capitalize, trim, negate, abs, concat, default, replace, substr, join.
Eg%{capitalize(%desc)} ,%{default(%payee, %desc)} ,%{replace(%desc, "ref#[0-9]+", "")} ,%{join(", ", %note, %ref)} . #
In CSV rules, a hledger field's value can now be referenced in field assignments. So you can eg append to a comment, building it up from several if rules.
And a%(FIELD) interpolation syntax with parentheses is accepted, useful when the field name must be delimited from adjacent text
(account1 assets:%(type)checking ). #
CSV amount values can be amount expressions, like amount1 %price + %fee , as in journal format.
A value counts as an expression if it contains an operator: a* ,/ , or a+ or- which is not a leading or exponent sign.
Within an expression, parentheses group (so-(%price + %fee) is the sum negated).
If there's no operator, values follow the traditional sign conventions (eg parentheses mean negative). #
CSV rules' currency andcurrencyN now set a default commodity, like aD directive, instead of prepending text to amounts.
So amounts which already have a commodity symbol keep it (previouslycurrency $ with€7 gave a$€ commodity).
The value can be an amount showing the symbol's position and spacing, likecurrency 1 USD ;
its number style (eg1.000,00 EUR ) is used as the commodity's default display style.
A value which is not a commodity symbol or amount, likecurrency 123 , is now an error.
Rules that worked before give the same output as before. #
In CSV rules, if tables can use a new ifs keyword, which allows aligning their delimiters (if still works).
The header line can have spaces around field names, spaces around values are ignored, and a blank value no longer assigns that field.
Comment lines and blank lines can be used inside if blocks, and comment lines inside if tables can be indented.
But* at the start of a line no longer begins a comment (previously a matcher line beginning with* was silently ignored, disabling the if block). #
A new merge rule combines several CSV records into one transaction.
merge (ormerge N ) appends the next record(s) to the current record, naming their fields with a _ROWNUM suffix:%description_2 ,%4_2 , etc.
This is useful for banks and brokers which export a currency conversion or stock trade as multiple rows. #
In CSV rules, when a setting like date-format orseparator is declared more than once, the last declaration now wins, as the manual says,
rather than the first (except forskip , where the first still wins).
So an included rules file's settings can be overridden by declarations after theinclude line;
if you declared one before aninclude to override the included file, move it below.
(#2539 ) #
CSV rules files' include directives are handled more robustly: include cycles and unreadable files are reported properly;
errors in included files are reported at the right file and line; and included files handle BOMs and CRLF line endings.
(#2537 ) #
In CSV data, characters which journal format can't represent are now replaced, with a warning:
a semicolon in a description (which would start a comment) becomes., , and a right parenthesis in a transaction code becomes] .
(#2413 ) #
A CSV rules file's data-generating command ( source | CMD ) failing no longer aborts the whole run; it warns and continues, as if no data was found.
So whenimport processes several rules files, one flaky source won't block the rest.
When asource command is run, the message names the rules file responsible. #
Fixed: a CSV rules source | CMD command no longer reads hledger's standard input, which could hang or consume input meant for something else.
A# in asource rule now always starts a comment, even after| . On Windows,source paths with a drive letter are recognised as absolute. #
files is more useful for tools which need to know a journal's input files:
-t/--tree shows the include hierarchy; it also lists the CSV rules files and data files used;
-O json gives each file's path, depth and parent; and it no longer processes the data, so it works with journals
that have errors other than syntax errors, and a missing included file gives just a warning.
Journal format
Accounts
Account directives can now declare account aliases with alias: tags.
Egaccount assets:bank:checking ; alias: checking is like writing analias checking = assets:bank:checking directive at that point.
A Ledger-style indentedalias NAME subdirective is also accepted. #
alias directives, subdirectives and tags are now applied beforeapply account , as in Ledger,
so that a file's aliases keep working when it is included underapply account .
If you hadapply account X and thenalias X:foo = ... , that alias should now be writtenalias foo = ... .
--alias options still apply last, to the full account names.
(#2733 ) #
Account names with an empty part are now an error: they can no longer begin or end with : , or contain:: .
Such names caused confusion and wrong reports (egbs omitted an empty top-level account, anda:b: was a different account froma:b ).
This is checked in journal, timeclock and timedot files, CSV rules, and the add command and hledger-web's add form
(but not in names produced by aliases or--pivot ).
(ledger#3348 ) #
Fixed: apply account ignores a trailing colon, as in Ledger:apply account Assets: now givesAssets:Bank , notAssets::Bank .
(#2858 ) #
Fixed: end aliases also cancelled--alias options, for the rest of that file and the files it included. #
check accounts (and strict mode) no longer require declaring the accounts that hledger chooses for generated postings.
check tags now also checks commodity directives' tags;alias andlots are built-in tags. #
Fixed: a subaccount-inclusive balance assignment like a =* $0 could also change other commodities' balances in subaccounts.
(#2772 ) #
There are three new account types: Gain ( G ), a subtype of Revenue, for capital gains;
Imbalance (M ), a subtype of Equity, for--infer-imbalance ; and UnrealisedGain (U ), a subtype of Equity, not currently used.
When several accounts are declared with the Gain or Conversion type, generated postings use the first declared. #
Account names whose final part is enclosed in curly braces, like assets:{foo} , are lot subaccounts,
and must contain a valid lot name (unless-I /--ignore-lots is used).
Commodities and amounts
Numbers can now also use _ or' as digit group marks.
(Kevin F. Konrad,#273 ,#1489 ) #
With a decimal-mark directive (or CSV rule) in effect, a number using a different decimal mark,
or using the declared mark more than once, is now an error.
(#1985 ,#1904 ) #
Amounts which hledger infers no longer affect display precisions, or entries' balancing precisions.
So an unseen high-precision balancing amount, eg inferred from a precise@ cost, no longer makes it harder to balance the entry;
some reports that used to add unnecessary decimal zeros no longer do so;
and reports more consistently show amounts smaller than their commodity's display precision as0 . #
Posting amounts, and costs, can now be written as arithmetic expressions, like $50.20 + $16.54 ,$800.00 * 1.05 ,($92.00 + $15.00) / 3
or1 GBP @ (1 / 1.14 EUR) .+ ,- ,* ,/ and parentheses are supported.
The results of* and/ are rounded to the entry's decimal places (costs are kept exact).
To avoid clashing with these, an unquoted commodity symbol can no longer begin with( when written before the number,
or with/ when written after it.
See Amount expressions in the manual.
(Martin,#2648 , a bounty funded by James Shubin;#2856 ,#2857 ) #
Commodity directives can now declare commodity aliases, with alias: tags: other symbols (or units) for the same commodity. Eg:
commodity USD 1.00 ; alias: $, alias: US$, alias: "US dollars"
commodity h 1.00 ; alias: 60 min
Amounts written with an alias are converted to the canonical commodity when read (print shows them as written; print -x shows them converted),
so eg$100 and100 USD are the same thing, and can balance each other.
An alias can have a multiplier, for differently-sized units.
Aliases are also used as a last resort exchange rate by-V ,-X and--value , in all file trees;
prices --show-aliases lists these rates.
This is useful eg when your journal and your downloaded price data use different symbols for a currency. #
A repeated commodity declaration (in the same file, an included file, or another -f file) now adds to the earlier one, instead of replacing it:
aliases are combined, a display style replaces the earlier one only if given, and later tags take precedence.
With several-f files, the last file's display style is now used (previously the first's);--debug=1 shows any that differ.
Transaction balancing
Transaction balancing errors are clearer, and show the summed amounts. When rounded amounts being compared look identical, more decimal places are shown. (#2636 ) #
--txn-balancing=exact|old is now--txn-tolerance=entry|display , meaning "balance transactions within
the entry's precision" (preferred) or "within display precision" (deprecated; lets you postpone fixing old journals).
The old spelling still works. #
Fixed: an inferred unit cost could be shown with too few decimal places (eg @ 33.33 B ),
soprint -x output could be rejected as unbalanced when read back.
Now it is shown exactly, or with 8 decimal places if it's a repeating decimal.
In other cases too, print shows repeating decimals with 8 decimal places, not 255. #
Fixed: in entries with balance assignments, check balanced and strict mode didn't catch implicit commodity conversions,
and--txn-balancing had no effect. #
--infer-imbalance addsequity:imbalance postings to exactly balance entries which are
balanced only when rounded to the entry's precision (eg because of a rounded@ cost).
So totals at cost become exactly zero, and the accumulated imbalance can be seen.
The new Imbalance (M ) account type can be used to select a different account.
Other journal features
One or more adjacent comment lines directly above a transaction (a "preceding comment") are now considered part of the transaction, and are shown when it is printed. #
Journal files can now include CSV/SSV/TSV files, or CSV rules files.
include FILE.csv uses a nearby FILE.csv.rules file; for more flexibility, include the rules file and specify the data with asource rule. #
apply year is now scoped, as in Ledger:end apply year restores the previous default year,
so following year-less dates no longer get the block's year.
apply year blocks can be nested, and one left open lasts until the end of its file.
Anend apply year with no matchingapply year is now an error.
(Previouslyapply year was a deprecated alias forY , andend apply year was ignored.)
A bareend orend apply , and an unmatchedend apply account , give clearer errors.
(#2852 ) #
A date: ordate2: tag with an empty value in a posting comment is now accepted, setting no date. This helps when reading Ledger journals.
Assert rules
The new assert directive declares rules, written as queries, which hledger checks whenever it reads the journal,
like balance assertions. Eg:
assert none daily type:A balance:<0 ; no asset accounts are negative at end of day
assert some monthly income:salary ; there's a salary transaction every month
assert none expenses:petty amt:>+500 ; no single petty expense exceeds 500
Each rule's query is run as hledger bal -E QUERY would run it, over the whole journal,
or in each period of its period expression, and must match no rows (none ) or at least one row (some ).
The newbalance: andchange: terms (see Queries) can be used to test the rows' balances and changes;
otherwise, a rule is about which postings exist.
A periodic rule can be followed by indentedskip lines, naming dates or periods to skip checking.
Assert rules are part of the assertions check:-I disables them,-s orcheck assertions re-enables them.
Their scope is the file tree they are declared in.
When a rule fails, the error shows every period in which it failed, some of the matching balances, changes or postings,
and a report command to see more.
(#1738 ,#2719 ) #
hledger check can also check assert rules given as arguments, eghledger check 'assert none daily type:A balance:<0' .
This is handy for trying out a rule, or for rules you don't want to keep in the journal. #
These replace the hledger-check-fancyassertions add-on script, which is removed.
Ledger-styleassert EXPR directives, which hledger used to ignore, are now an error unless adapted to hledger's syntax.
Time logging
In timedot files, a line whose first word looks like a date is now always parsed as a date line, with a clear error if the date is invalid
(instead of being silently treated as a comment or a zero-amount entry).
Lines with an org heading prefix (eg** ) are parsed more consistently. #
Fixed: timedot's mo andy units were 7 times too large; now they are 30 and 365 days, as documented. (Wrong since hledger 1.4.) #
Fixed: timedot and timeclock durations are no longer rounded to 0.01 hours, so totals don't drift, and a timeclock session crossing midnight no longer loses a second.
Investments
Lot tracking
hledger can now track investment lots and calculate capital gains. It tracks each purchase's cost basis, infers and validates lot movements across transactions and accounts, and calculates (or checks) the gain or loss when you sell. In brief: #
Lot tracking is enabled for a commodity by a lots: tag on its commodity directive;
or lot postings are recognised by a cost basis annotation, or an explicit lot subaccount.
Lot calculation and checking is done whenever such entries are present;--ignore-lots (or-I , which now also means this) disables it. #
Cost basis is written as {DATE, "LABEL", COST} , with all parts optional.
Ledger's{COST} [DATE] (NOTE) syntax is also accepted.{{TOTALCOST}} is supported.
Cost basis ({} ) and transacted cost (@ ) are each inferred from the other, so writing either is often sufficient.
In an acquisition, if both are written, they must agree. #
Postings are classified as acquisitions, disposals, transfers or gains.
Disposals balance at cost basis, with a single realised gain posting, which can be written (and is checked) or left out (and is inferred);
this is historical cost accounting, preserving the accounting equation.
Gain accounts are detected by the new Gain (G ) account type, declared or inferred from names likerevenues:gain orincome:capital-gains ;
revenues:gain is used by default. #
Lots are selected for disposal or transfer by a reduction method, set with the lots: tag's value, per commodity or per account:
FIFO, LIFO, HIFO, AVERAGE, or the all-accounts variants FIFOALL, LIFOALL, HIFOALL, AVERAGEALL.
Or you can select lots explicitly, with a cost basis annotation.lots: NONE on an account opts it out (eg for tax-sheltered accounts). #
Transfers between accounts preserve lots' identity and cost. Many forms are understood: multiple sources or destinations, elided amounts, fees (priced or unpriced; a priced fee is split off as a small disposal), and transfers into AVERAGE pools, which are re-averaged. #
Short positions are supported, as lots in a Liability account, where a negative posting opens a lot and a positive one covers it. (#2756 ) #
Internally, each lot has its own subaccount, like assets:broker:{2026-01-15, $50} . These are hidden by default;
the--lots flag shows them in any report, and you can also write them explicitly.
close --clopen --lots carries lots between yearly files. #
print shows lot postings with an explicit cost basis, so its output is re-readable;print --lots shows the per-lot postings,
and the newprint -a/--all shows everything useful for troubleshooting (--explicit --lots --verbose-tags ).
--verbose-tags shows lot postings'ptype tags (acquire, dispose, transfer-from, transfer-to, gain). #
-B/--value=cost converts lot postings at their cost basis, so for lot balances it shows the cost of the units still held, andbse -B balances.
--value=transacted gives the old-B behaviour (proceeds and net cash invested).--gain shows value minus cost basis.
(#2751 ) #
The lots check which validates lot movements, usually run by default, can also be run byhledger check lots .
Lot errors show the entry as written, how hledger interpreted its postings, and eg the lots actually available.
Balance assertions on lot subaccounts can't be checked reliably, and are ignored when lot detail is hidden; the manual explains.
See "Lots and capital gains" in the manual, and https://hledger.org/start-tracking-lots.html .
(#2581 ,#2636 ,#2649 ,#2724 ,#2731 ,#2839 ,#2843 ,#2866 ) #
Holdings
The new holdings report shows your lot-tracked investments' performance, per account and commodity, or per lot (--lots ),
with units, unit/average cost, current price, total cost and market value, portfolio weight, unrealised and realised gains (UGain, RGain), age,
and XIRR annualised return. Multiple cost and value commodities are shown separately, or converted to one with-X COMM .
- In tree mode, accounts with subaccounts or several commodities are heading rows showing their subtree's totals. (Arthur Cinader,#2779 )
- With a report interval (eg
-M), it shows the totals at each period end, up to today, titled eg "Monthly holdings";--change,--cumulativeor-Hselect whether the gain columns show gains during each period, since the report start, or since acquisition (the default). - When the report period has a start date (
-b,-p,date:), the gain columns show the gains during the report period. Eghledger holdings -p todayshows today's gains. - When some holdings have no market price, the totals show the others' value and gains, and a note names the ones excluded.
- When closed positions (fully disposed commodities or accounts) are hidden, as they are without
-E, a note says how many, since the RGain and XIRR totals include them. balance:andchange:queries can select holdings by units, value, or (with-B) cost, egholdings balance:'>$1000'.-S/--sort-amountsorts holdings by Total value, largest first, with unpriced holdings last (or with-B, by Total cost).- With colour, gains are green and losses red.
- It has csv, tsv, html, fods and json output, and can show charts.
- In tree mode, accounts with subaccounts or several commodities are heading rows showing their subtree's totals.
Reporting
Queries
A new "find anywhere" query, written find:PATTERN or::PATTERN , matches a regular expression in any of a transaction's fields
(code, description, comment, tags including hidden and inherited ones, account name, or amount);
and if PATTERN is a period expression, it also matches dates in that period.
This allows many queries to be written more briefly, especially when you're not sure where some text might be.
Eg::2025 ::food matches things in 2025 (or mentioning "2025") and mentioning "food". #
amt: can now include a commodity symbol, to compare only amounts in that commodity:amt:'>$100' ,amt:'<200 EUR' .
This is easier than adding acur: term, which needs regular expression escaping (cur:'\$' amt:'>100' ).
The manual is also corrected:amt: without a commodity symbol matches multi-commodity postings if any of its amounts match. #
any: andall: queries now also work in posting-oriented reports like register, balance and aregister;
previously they had an effect only in commands which show whole transactions, like print.
So those reports can now select postings based on their siblings: eghledger balance expenses any:cash shows expenses which were paid with cash. #
Queries like desc: or:: , with an empty pattern, now match anything. (Previously they gave an error.)
date: query parse errors now show the actual error. #
accounts now respects transaction-specific query terms such asdate: ,status: ,desc: ; these no longer match a declared but unused account.
(Onlyacct: ,depth: ,type: ortag: can match one.)
payees likewise; andpayee: now matches declared payees. #
New change: andbalance: query types match report rows by their summed amounts,
unlikeamt: which matches individual posting amounts.
change: tests a row's change (the sum of its postings);
balance: tests its historical balance at the end of its period.
Eg:
hledger bal expenses change:'>+100' # expense accounts where more than 100 was spent
hledger bal assets balance:'<0' # asset accounts with a negative balance
hledger reg gifts -M change:'>100' # months with more than 100 in gifts
hledger areg checking balance:'<0' # transactions after which checking was overdrawn
hledger print not:change:0 # entries with a tolerated imbalance or unbalanced virtual postings
As with amt: , a commodity symbol (change:'>$100' ,balance:'<0 EUR' ) compares just that commodity.
And an unsigned number tests the magnitude, ignoring sign (sochange:'>100' also matches a change of -150),
while a signed number (or 0) does a signed comparison (egchange:'>+100' ,balance:'<-500' ).
Amounts are tested with their real sign, as shown bybalance (not the adjusted sign shown by--invert orbs /cf /is ).
balance: always means the historical balance, ie calculated from the start of the journal (with or without-H ).
In balance reports, non-matching accounts are left out, as with an account query, so parent balances and totals include just the matching accounts.
Reports
A new transactions (tx ) command lists transactions on one line each. It's like print, but better for a quick overview. #
register with no report interval now hides zero-amount postings unless-E (or--average ) is used,
like register with a report interval, or aregister.
(#2836 ) #
balance has a new--full-names flag, which in tree mode shows full account names;
--no-elide now also works in list mode, adding the parents of the posted-to accounts;
and a newbarewide layout shows bare numbers with a column for each commodity.
(Henning Thielemann,#2429 ,#2661 ) #
aregister now supports-A/--average , showing the running average change per transaction instead of the running balance;
and a new--matched flag, which shows the matched account(s) in each row instead of the other account(s) (the opposite of-r/--related ).
(Caleb Maclennan, Simon Michael,#2540 ) #
Report titles can be customised: --title=TITLE sets a title for most reports (in txt, html or fods output),
--subreport-titles='TITLE1|TITLE2|...' sets the section titles of compound reports likebalancesheet (eg--subreport-titles='Aktiva|Passiva' ),
and--period-titles=compact|dates selects abbreviated or full ISO dates as column headings in periodic reports.
(#2578 ) #
HTML output is improved: with --base-url , every balance report amount links to the corresponding register view, so you can click to see
where an amount comes from; CSS classes are used instead of inline styles, with classes for negative amounts, amounts, dates, and tree depth;
dates and amounts don't wrap; ahledger.css file now overrides the builtin styles (an example is provided);
register, aregister and holdings show a title too; and there are newlines between elements, for readability.
(Arthur Cinader, Simon Michael,#2326 ) #
The commodities ,tags andpayees commands have a--directives flag, which shows directives ready to paste into a journal.
(Use it with--undeclared to generate directives satisfying strict mode.) #
commodities --used now shows only commodities used in transactions; a new--priced flag shows commodities used in P directives.
commodities now supportsdate: queries (and report period options) with these, andtag: queries. #
prices has a new--summary mode; a--locations flag, showing where each price came from;
--show-aliases , showing the rates implied by commodity aliases; and it can be filtered byfind: queries. #
Repeating the --transpose flag now toggles it. In--pivot 's value,account is accepted as a synonym foracct .
A two-year interval's report title now says "Biennial", not "Biannual" (Arthur Cinader). #
Fixed, in balance: multi-period reports using --tree and--transpose together now show only the leaf accounts (#1941 , JoeJoeflyn);
in single-period csv/tsv/html/fods output,--drop no longer truncates the "Total:" heading (#2688 );
single-period HTML/FODS reports respect the commodity display style (Simon Michael, Henning Thielemann,#2584 ,#2588 );
FODS multi-period and compound reports have the correct number of header columns (Henning Thielemann);
and in single-period text reports, account names stay aligned when amounts are wide (Adam Sardo,#1148 ). #
Fixed, in register: with a report interval, account-specific depth limits ( --depth REGEXP=N ) now work correctly (#2423 );
with multiple files, the transaction indexes in csv/tsv/fods/html/json output continue across files instead of restarting;
and postings whose amount couldn't be inferred are omitted (#2571 ). #
Fixed, in aregister: with historical balances, a date2: start date in the query is now honoured (Arthur Cinader). #
Fixed: balance --budget reports no longer lose their goals when the command includes transaction or posting filters,
such asstatus: ,desc: or--cleared . Only the attributes that meaningfully select goals (account, account type, depth, date, commodity) affect them.
Sobal --budget --cleared compares cleared spending against the full goals.
(#2545 ) #
Fixed: --count reports showed counts in the journal's no-symbol commodity style (eg 1.00), rounded their averages to whole numbers,
and bs/bse/is showed negative counts in some sections. Now counts are whole numbers, averages have one decimal place,
and bs/bse/is show positive counts in every section, with their sum as the net total. #
Fixed: --value=WHEN, with nothing after the comma now values in the no-symbol commodity (previously it was read as--value=WHEN ).
-X and--value also accept a double-quoted commodity symbol, so"" also selects the no-symbol commodity.
And-X /--value with a commodity to which no conversion price can be found now prints a warning, instead of silently having no effect.
(#2844 ) #
Fixed, in stats: the elapsed time and txns/s figures once again cover the whole run (since 1.51 they covered only the journal-reading phase).
--oneline (formerly-1 ) has a-q short spelling, and it and-1 /--depth 1 now work independently.
stats is faster on large journals, and shows a base currency inferred for the journal, eg$ (USD) . #
Fixed: roi's TWR is now computed from the investment's value at the end of each day, exactly, at daily granularity.
The previous method assumed an exact valuation was available around each cash flow, and its solving could fail.
Results change for most journals with cash flows between valuations; if you record valuations only occasionally
(eg with--pnl transactions), record one around large deposits and withdrawals.
Also, cash flows are now measured from the investment's perspective (other postings in the transaction, eg fees, no longer affect them),
a holding without a market price is valued at the price of its latest purchase or sale, the value at the end of a period uses the prices of its last day,
and--cashflow shows each cash flow and the TWR steps, for checking the results. These can change IRR results too. See the roi docs.
(Dmitry Astapov,#2420 ,#2824 ,#2825 ) #
Fixed: in roi, a failed IRR or TWR now shows "error" in its own cell, with the rest of the report still shown,
and the reasons shown as a warning after the report (with exit status 0).
Some special cases now have an answer instead of an error: when money is put in and nothing comes back (eg a write-off), IRR is -100%,
and same-day cash flows that add up to zero have an IRR of 0%.
And omitting--pnl now selects no postings, as documented; previously it selected all postings.
(Dmitry Astapov, Arthur Cinader,#2670 ,#2845 )
Charts
hledger now has easy charting built in. Most reports can be shown as charts, with --chart .
In the terminal, these are bar charts, using colour and Unicode block characters when supported.
Charts adapt to the report options and data, showing subperiods, stacked bars, end balances,
contra amounts hatched, largest amounts prioritised, totals/averages, etc. Each commodity gets its own chart.
If csv, tsv or json output is selected, the chart's data is shown instead. #
When colour is available, accounts are coloured by type: assets blue, liabilities amber, equity violet, revenues green, expenses red, with each account of a type in a different shade. Accounts of unknown type get distinct colours. #
--view opens a report in the system's default viewer for its format.
It writes an output file if you didn't specify one (in hledger's cache directory), choosing html format if you didn't specify that.
Eghledger is -M --chart --view , orhledger is -M -o is.fods --view . #
Charts can also be SVG images, with tooltips and light/dark variants, selected by the new svg output format ( -O svg or-o FILE.svg ).
Or, SVG charts can be added to html reports (-o FILE.html --chart ).
(Simon Michael, Arthur Cinader) #
In compound reports like bs and is, all accounts are stacked in one bar per period, on opposite sides of the axis (the diverging layout);
--chart=grouped shows each section's accounts in a bar of their own, side by side, asbalance --chart=grouped does for each account type.
--chart=net also draws the net total.--chart=SCALE (eg--chart=5000 ) draws charts at a fixed scale,
so that separate charts can be compared. These can be combined, eg--chart=grouped,net,5000 . #
holdings has a chart, showing a horizontal bar per holding (or lot) with its cost basis, unrealised gain or loss, and gain percentage;
or with a report interval, the cost basis and value per period (or with--change or--cumulative , the gains).
activity now shows a chart of transactions per week, using the new chart engine;--postings counts postings, per account.
It now supports-w/--width ,-S ,-T ,-A , and svg, html, csv, tsv and json output.
print, exporting
print now aligns posting amounts at their decimal marks. The target column is 53; it is increased when needed.
Balance assertions' operators and amounts are aligned too.
A new--layout option (also supported byadd ,close ,import ,rewrite ) customises this:
--layout=COL sets a different target column, and--layout=hledger1 gives hledger 1's layout. #
In print 's csv/tsv/html/fods/sql output, the debit column now appears before the credit column, following convention.
Inaregister 's csv/tsv/html output, the "change" column is renamed "amount", matching print's, for easier re-importing. #
print --export reproduces the whole journal losslessly, preserving directives, comment lines and blank lines,
for easier reformatting or exporting. Included files are inlined.
With--forecast and/or--auto , the generated transactions and postings are exported instead of their rules. #
print has a newledger output format (-O ledger or-o FILE.ledger ), which uses Ledger's lot syntax,
and with--export , comments out directives which Ledger does not support. Its default format is now called "journal" ("txt" is still accepted). #
print 's beancount output is improved. With--export , it generates the directives Beancount needs (options, commodity, open, prices),
and accounts whose top-level name is not one of Beancount's are prefixed with one based on their account type, if known.
It converts single-letter commodity symbols, the no-symbol commodity, top-level "revenue(s)" accounts, balance assignments and market prices;
it sets booking methods from accounts'lots tags, and shows cost basis before transacted cost;
underscores in account names become dashes rather than being hex-encoded (#2596 ); and non-ASCII letters in tag names are encoded (#2576 ). #
rewrite --diff output can now be applied bypatch orgit apply : each source file is diffed as a whole, with three lines of context.
And changed transactions which have no journal entry to patch (eg ones read from CSV) are left out of the diff and reported on stderr.
(#2548 )
Other commands
setup detects terminal colour support and explains its verdict; warns if the filesystem does not support appending (#2577 );
checks for Gain accounts; no longer reports unused commodity aliases as undeclared; and no longer shows an error message on Windows. #
check : an unknown check name is now reported right away, instead of after reading the journal.
check ordereddates with--forecast now ignores forecast transactions. #
accounts --show-aliases shows each account's aliases, as a comment, and makes account name queries also match aliases.
accounts --locations now also shows where undeclared accounts were first used, and shows locations as FILE:LINE.
Whencheck accounts finds an undeclared account name which is an account alias not in effect there, the error explains alias scope. #
close no longer generates a spurious zero posting for some emptied accounts.
Performance
hledger has been optimised, and this is the fastest and most memory-efficient version yet.
On medium and large journals,balance is 2-3x faster than 1.52, and uses a third less memory.
Unnecessary work is avoided, so you pay only for the features you are using.
Detailed stats, performance tips, and a new set of benchmarks comparing the plain text accounting apps, are athttps://hledger.org/PERFORMANCE.html . #
Interval reports no longer slow down quadratically with the number of periods (a daily register over 100 years spent 2.5s in that alone),
and register and--forecast use constant memory however many periods there are.
(#1683 ) #
Regex replacement no longer takes quadratic time in the length of the text; long texts (eg regex aliases on 2000-character account names) are much faster. check accounts, check payees and check tags are faster with many declarations (eg 0.63s -> 0.20s with 10k transactions and 10k declared accounts). Journals with many balance assertions or quoted commodity symbols are parsed faster, journals with lots are processed faster, and tables with many-line cells (eg register with a many-commodity running balance) are rendered faster (Dmitry Astapov). #
hledger no longer searches PATH for add-ons when the command is a builtin command, for faster startup (eg hledger --version takes 23ms instead of 32ms). #
hledger release binaries are built with megaparsec 9.8.3, which contains our fix for a performance regression in megaparsec 9.3 to 9.8.2, making hledger about 10% faster. Packagers who want the speedup should use megaparsec 9.8.3+. #
--debug=1 now prints a timing line for each phase of hledger's work, with its run time and allocation,
and shows how much of the journal was parsed by the new fast-path parser.
Other
Packaging and API
hledger now requires aeson 2.2.5.1 or newer, avoiding a bug where certain data could trigger memory/CPU exhaustion (https://haskell.github.io/security-advisories/advisory/HSEC-2026-0007.html ). megaparsec 9.8.0 is excluded, to avoid a position marker bug in error messages (megaparsec#572 ). hledger no longer depends on lucid; blaze-html is used for HTML output (Arthur Cinader,#2737 ). #
hledger's source tarball no longer ships the benchmark suite's 1.6MB journal. #
Haskell API changes in the hledger package: Hledger.Cli.Anchor gains LinkOpts and link builders; Balance exports its report specs, spreadsheet parts and titles, with shared functions in Balance.Internal; balanceReportAsText returns Text; setDisplayCommodityBare's parameters are swapped; Hledger.Cli.Xirr is the IRR solver shared by roi and holdings. (Henning Thielemann, Arthur Cinader, Dmitry Astapov)
Examples
- examples/file-layouts (formerly examples/templates) has simple, default, years and year-dirs layouts;
hledger initwrites the first three. - examples/lots/ has lot tracking examples: lots.journal, irr.journal (comparing roi and holdings XIRR), and investments-5y.py, which generates a large investment journal.
- examples/csv/ has new rules for PayPal (json), Kraken (demonstrating
merge), SimpleFIN, Unify Federal Credit Union and GitHub sponsorships. - examples/home-page-example.journal is the example from the hledger.org home page.
- hledger.conf.sample is updated, with command-listing helpers and a custom
watchcommand. - bcexample's beancount prices are converted to P directives, so
-Vworks. - examples/hbcexample.journal is a copy of bcexample.journal with current dates and valid hledger 2 lot entries.
Scripts/addons
getdataandgetpricesare sample scripts for thegetcommand;krakencsvhelps convert Kraken CSV.git-pre-commit-hookis an example git hook which runshledger checkon your journal when its files are being committed.hledger-barallows its flags anywhere among the arguments, and sets the scale with a new-soption.- hledger-check-fancyassertions is removed, replaced by assert rules. The hledger-example* scripts are renamed and updated.
- bashrc: holdings and tx aliases.
Docs
- The hledger manual is reorganised, with more getting started info at the start; Options and Config files consolidated; COMMANDS moved before DATA FORMATS, and grouped like the commands list; detailed command line tips moved to PART 5; and a shorter, better grouped topic list in the website sidebar.
- New sections include: Lots and capital gains (with Recording disposals, Troubleshooting lots and more), Charts, Languages, Amount expressions, Commodity aliases, the assert directive, Transaction balancing, Report titles, print layout, Built-in tests, and hledger 1 and hledger 2 (on migrating and interoperating).
- The CSV docs are reorganised, with clearer explanations of reading the data, finding the data, CSV vs hledger fields, if rules and ifs tables, and rules examples moved into Working with CSV.
- Directives, the alias directive, account aliases, directive scopes and combining file trees are explained more clearly; timedot is rewritten; Tags, Boolean queries, the two-space delimiter, decimal marks and period expressions are clarified. (#1640 ,#1950 ,#2664 ,#2665 ,#2714 )
- The "added in VERSION" and "experimental" labels are dropped throughout the manuals.
hledger-ui 2.0
All changes since hledger-ui 1.52.4.
For the 1.99.x preview releases, and 2.0's changes since the last of them (1.99.6),
see https://hledger.org/relnotes199.html.
See also the hledger changelog, for changes affecting all the hledger tools
(lot tracking, commodity aliases, the :: find query, translations, faster starts and reloads, etc.)
Highlights
The most notable changes since hledger-ui 1.52; each is described below.
- Watch mode is on by default, with no memory leak, and reloads more robustly. (Breaking changes, Fixes, Improvements)
- The
Lkey shows or hides lot subaccounts and per-lot detail, for journals using hledger 2's lot tracking. (Improvements) - Assert rules are checked on load and reload and when
Ire-enables checks. (Improvements) - Translations: the
--langoption shows the UI in other languages. (Improvements) - The journal can be read from stdin, on unix-like systems. (Improvements)
- And hledger's improvements (more speed, commodity aliases, new queries; see the hledger changelog).
Breaking changes
Automatic re is now enabled by default: hledger-ui watches for data and date changes, and reloads automatically.
The new--no-watch flag disables this, re only with theg key.
The rightmost--watch /--no-watch flag wins, so a config file setting can be overridden on the command line. #
With more than one of --cash /--bs /--is /--all /--register , the last one wins,
so a config file's choice can be overridden on the command line. (Previously they had a fixed priority order.) #
--tldr is renamed to--examples (see the hledger changelog).
Fixes
Fixed a long-standing memory leak (and background CPU use) when re in watch mode. Now watch mode has no extra memory/CPU cost, and can be used freely with large journals. (#1825 ) #
hledger-ui gracefully handles more re failures, such as failure caused by a changed CSV file or rules file, or by a file momentarily removed when your editor saves it. Instead of quitting, it now shows the error screen, allowing recovery. #
The transaction screen now always shows the whole journal entry.
Previously with acur: oramt: query in effect, it showed the entry without the non-matching postings.
(A long-standing bug, since hledger 1.23.) #
The mouse wheel now scrolls all the way. Previously it moved the viewport at most to the current selection and then stopped; you had to move the selection with the arrow keys to get any further. #
Pressing DOWN at the last list item, orC-l (recenter) when near the end of a list,
no longer scrolls into blank padding space; hledger-ui now keeps as many items as possible on screen.
(Juan Wajnerman,#2278 ,#2593 ) #
With --pivot , re-enabling checks withI did not really recheck them, so failures went unreported. #
On Windows, the A key (running hledger-iadd), theE key (running$EDITOR ),
and the running of info/man/tldr/pager helpers now correctly quote file paths containing spaces.
(#2646 )
Improvements
The L key toggles showing lot subaccounts and per-lot detail (like the CLI's--lots flag),
for journals using hledger 2's lot tracking.ESC resets it to the startup state. #
hledger-ui checks the new assert rules (see the hledger changelog),
when the journal is loaded or reloaded, and when checks are re-enabled withI .
They always see future-dated ordinary transactions, even when those are hidden behind theF key.
They see transactions generated by periodic rules only when--forecast is used. #
The new --lang option shows hledger-ui's menu and accounts screen names in other languages (see the hledger changelog).
The help dialog and the register screen's labels are not yet translated.
(Arthur Cinader) #
hledger-ui can now read the journal from stdin ( -f- ), on unix-like systems.
With a stdin journal the data can't be re-read or edited, so theg ,a ,A andE keys and watch mode have no effect. #
Changes to CSV rules files now trigger a reload, like changes to data files. #
The transaction screen now refreshes in place when there's a reload. Previously you had to exit and re-enter it. (#1825 ) #
Warnings (eg CSV data warnings, which could appear on every reload) no longer scroll and disrupt the display; they are shown on the bottom line, until the next key press. Also the screen is fully repainted after a reload, repairing any other stray terminal output, and error screen re is less flickery and more robust. #
The E key now jumps to the error position with the Zed and Sublime Text editors, also.
(Rostislav Raykov) #
CTRL-c now quits, likeq , from any screen or mode, including while the help or a minibuffer is open.
Previously it was ignored. #
Clicking a background hledger-ui window now just brings it forward, without also selecting or entering the item under the pointer. #
The -? and--webman flags are added (see the hledger changelog). #
Allow brick 3.x (with 3.1 support from GuillaumedeVolpiano), doclayout 0.6. Exclude megaparsec 9.8.0, to avoid a position marker bug in error messages (megaparsec#572 ).
Docs
- The manual's KEYS section is grouped like the help dialog; the depth keys, help dialog keys,
CTRL-zand editor variables are documented; and the watch mode and BUGS sections are updated.
hledger-web 2.0
All changes since hledger-web 1.52.4.
For the 1.99.x preview releases, and 2.0's changes since the last of them (1.99.6),
see https://hledger.org/relnotes199.html.
See also the hledger changelog, for changes affecting all the hledger tools
(lot tracking, commodity aliases, new queries, translations, faster starts and reloads, etc.)
Highlights
The most notable changes since hledger-web 1.52; each is described below.
- More reports (balance sheet, income statement, cashflow, holdings and more), with options, and new charts. (Reports)
- Paged journal and register views. (Reports)
- A dark mode, and a tidier look. (Appearance)
- Keyboard navigation, like hledger-ui's. (Navigation and keys)
- Translations. (Translations)
- Security hardening. (Security)
- Changes that would make the journal unreadable are refused. (Fixes)
- Less javascript. (Other improvements)
Security
hledger-web now sends a Content-Security-Policy header with every page. This tells your browser to load scripts, styles, images and fonts only from hledger-web itself, and to run only hledger-web's own scripts; so if anything script-like ever reached a page, eg through data in your journal, the browser would refuse to run it. In normal use you should notice no difference. (Arthur Cinader,#2703 ) #
hledger-web now sends the X-Frame-Options: SAMEORIGIN andX-Content-Type-Options: nosniff security headers
on every response, so other sites can't frame its pages for clickjacking, and browsers won't second-guess content types.
(Arthur Cinader) #
Nothing is loaded from third parties any more; two dead third-party script tags, and the unused (always disabled) Google Analytics hook, have been removed. (Arthur Cinader) #
(The XSS and include-injection fixes of 1.52.2 and 1.52.3 are of course included.)
Breaking changes
When listening on a non-local address (set with --host ), hledger-web now allows only read-only access by default.
Add--allow=add or--allow=edit to allow changes. #
Startup options and query arguments now set up the opening page, as url parameters, instead of acting as invisible server-side defaults and filters. So every view is described by its url, and a shared link shows the same view to everyone. But a startup query no longer restricts what hledger-web serves: it becomes the first page's search, which a viewer can edit or clear, and the JSON API serves the whole journal. To serve a restricted view, serve a restricted file. (Arthur Cinader) #
Pages are now shown in the viewer's language, when a translation is available (see Translations below).
--lang en keeps hledger-web in English. #
Some keyboard shortcuts have changed, to match hledger-ui (see Navigation and keys below). #
In JSON output, postings' ptype field is renamed topreal . #
--tldr is renamed to--examples (see the hledger changelog).
Fixes
The add form, JSON API (PUT /add), edit and upload now refuse a change which would make the journal unreadable.
They check it as the next read (with hledger-web's startup options) would, and on failure leave the file unchanged.
Eg /add can no longer add unbalanced transactions, the add form now checks balance assertions,
and edit and upload now respect--strict and-I .
(#2864 ,#2869 ) #
hledger-web no longer exits prematurely when its page is in a background browser tab (browsers may run background tabs' timers much less often). Now it exits 15 minutes after its last page is closed (was 2 minutes), and a page pings as soon as it is foregrounded again. And when a page can't reach the server, it shows a notice saying hledger-web is no longer running and how to continue, instead of failing silently on the next click. (Arthur Cinader,#2722 ) #
The register now shows the to/from account names when restricted by a type: query, instead of blank cells.
(Arthur Cinader) #
The upload form now shows the name of the chosen file. (Arthur Cinader) #
/favicon.ico and /robots.txt no longer return 404 when hledger-web is run outside its source directory. robots.txt now also asks crawlers not to index the site. (Arthur Cinader) #
Browsers now check for updated scripts and styles, so they don't keep using old ones after an upgrade.
Reports
hledger's balance, balance sheet, income statement, cashflow and holdings reports are now available in hledger-web.
Every amount links to the register it is derived from, column headings link to the report for that period,
and a "Report:" row links the report pages to one another.
The balance sheet has Equity as an option, and the balance report is called All accounts, as in hledger-ui.
The holdings report is for journals using lots; in tree mode, accounts are heading rows with subtotals,
and lots fold beneath their holdings. When its report period has a start date, it shows the gains during that period.
It can also show a report interval, likeholdings -M , with a Gains option choosing what the gain columns cover.
Gains and losses are shown in green or red, and thez key shows or hides closed positions.
(Henning Thielemann, Arthur Cinader, Simon Michael) #
hledger-web now opens on the balance sheet, rather than the journal,
and with a default report interval, chosen to suit the period shown (monthly for up to two years, quarterly for up to six, otherwise yearly).
Pages show depth 1 by default: just the top-level accounts, so that tables and charts start simple and readable.
- and+ steps and a List/Tree switch beside a table's Account heading make deeper accounts easy to reach. #
The report pages have an Options panel, offering most of hledger's report options and filters (report interval, changes or end balances, depth, valuation, lots etc.), so reports can be reshaped in the browser. The options are kept as you move between pages, and every view has a shareable url. (Arthur Cinader, Simon Michael) #
Reports show a chart at the top, drawn by hledger's new chart engine (see the hledger changelog).
The Chart and Data buttons, or thec andd keys, show or hide the chart and the data (persistently),
so you can use hledger-web with either or both visible.
When there's more than one commodity,[ and] step between their charts.
Charts are redrawn to fit when the page's width changes, and show their tooltips immediately, also on touch screens.
This replaces the old register chart; jQuery and Flot are no longer used.
(Simon Michael, Arthur Cinader,#2800 ,#2784 ) #
The Chart option chooses the Diverging (default) or Grouped layout, and the N key shows or hides the net total line.
The--chart startup option accepts the same values as the commands'--chart : a layout,net , and SCALE amounts. #
The sidebar now always lists the full account tree, for navigation, whatever the search.
It has its own persistent depth, starting at 1, adjustable with the fold carets, its- and+ controls, or a shift-DIGIT key.
Its balances are now hidden by default, making pages with a large journal about twice as fast, and smaller;
clicking the Balances heading, or pressing theb key, toggles them.
They are now historical balances, as of the report's end date (previously, the changes during the search's period).
A button shows or hides the sidebar, on all screen sizes. #
The journal and register views are now paged, showing the newest 1000 matching transactions and page navigation links. When the matches span more than one year, a years row links to each year (grouped by decade when there are more than twenty). Account links from a transaction open the account register at the appropriate page. (Arthur Cinader,#586 ) #
The register can start from the balance brought forward ( accum=historical ), so its running balance is the account's balance
rather than a total of the transactions shown. The oldest row shows the brought-forward balance, and links to the earlier transactions.
A running balance of many commodities shows just the row's own commodities, eliding the others.
(Arthur Cinader,#2784 ) #
Tree mode now folds items at the requested depth, and you can click individual items to expand them. Boring parent accounts are squashed, and the depth limit corresponds to account depth, as on the command line. In list mode, account names show their parent path dimmed, and a prefix shared by all the accounts is shown once. (Arthur Cinader, Simon Michael) #
Links in the journal, register and sidebar now behave consistently: an account name opens its view, an amount opens the register it comes from, and a date narrows to that day. The sidebar's amounts are now links, and its Journal link keeps the current search. (Arthur Cinader) #
Report urls are simpler, and queries and parameters are used more consistently,
eg/register?account=assets:bank orinterval=monthly . Old bookmarks still work.
(Simon Michael, Henning Thielemann) #
Search supports hledger's new query types: :: (find: ),change: andbalance: , andamt: with a commodity symbol.
The search help is updated. (See the hledger changelog.) #
Percentages that can't be calculated now show plain amounts with an explanation, instead of an error page. (Arthur Cinader)
Appearance
hledger-web now has a dark mode, enabled automatically when the browser or system is in dark mode. (Arthur Cinader,#2706 ) #
The journal and register tables have been tidied up: digits in amounts are shown with equal width, so numbers line up neatly in a column; column headers are small and muted; and the zebra striping is replaced by a faint highlight on the row under the pointer. Amounts and their commodity symbol no longer break across lines. (Arthur Cinader,#2718 ) #
Transaction tooltips, shown when hovering over a transaction in the journal or a register, are now drawn in a fixed-width font, so amounts and comments line up as in the journal; long lines wrap, and the tooltip stays within the window. (Arthur Cinader,#2716 ) #
The sidebar keeps its scroll position when you click an account or navigate, and on wider screens the sidebar and the main content scroll independently. A long or multi-commodity balance no longer covers its account name. Pages keep their scroll position too. (Arthur Cinader,#2679 ) #
Journal and register headings name the search's dates, like other pages. #
hledger-web now has its own favicon: a gold coin struck with an equals sign. (Arthur Cinader)
Navigation and keys
Navigation links are now also shown at the top of the page, so you can navigate with the sidebar closed. (Arthur Cinader) #
g then a key goes to another page, via a dropdown menu, so you can navigate to most places with the keyboard. #
Keyboard shortcuts for adjusting report options are provided, similar to hledger-ui's. (Arthur Cinader, Simon Michael) #
a (open the add form) now works on all pages.f toggles full window mode, showing only the report.
/ puts the cursor at the end of the search field.escape exits the search field or full window mode, in addition to cancelling things.
delete andbackspace clear the search, as in hledger-ui. #
n andp go to the next and previous page;n no longer opens the add form (usea for that). #
Keyboard focus is managed better; after a page load or a search, keyboard scrolling and shortcuts work without having to click the page first. #
The help popup has been cleaned up, and links to hledger-web's manual on the website. (Arthur Cinader, Simon Michael)
Translations
- hledger-web can be shown in 12 languages (see the hledger changelog).
The language is chosen by a
_LANGquery parameter (which saves a browser cookie), a previously saved cookie, or the browser's Accept-Language header; or it can be fixed at startup with the--langoption. See the manual's LANGUAGE section. (Arthur Cinader)
Other improvements
--port 0 lets the OS choose a free port. The chosen port is reported in the startup message and used in the default base url,
so scripts can discover it. This works in the default--serve-browse mode too.
(Arthur Cinader,#2559 ) #
hledger-webs running at different ports on one host remember their own report and display options. (Simon Michael, Arthur Cinader) #
Changes to CSV rules files now trigger a reload, like changes to data files. #
The web UI's javascript has been modernised, replacing all the vendored libraries (jQuery, Bootstrap's scripts, Flot and others)
with standard browser features: autocomplete suggestions use a native<datalist> ,
the button beside the date field opens the browser's own date picker (typed smart dates like "today" still work),
and the add and help dialogs use the native<dialog> element. Pages load much less javascript.
(Arthur Cinader,#2702 ) #
The -? and--webman flags are added (see the hledger changelog). #
hledger-web now requires wai-app-static >=3.1.9 and yesod-form >=1.4.12, and no longer depends on lucid ( #2737 ). megaparsec 9.8.0 is excluded, to avoid a position marker bug in error messages (megaparsec#572 ).
Docs
- The manual has new WEB UI, REPORTS, URL PARAMETERS and LANGUAGE sections, an updated JSON API section,
and says
--allow=edit/--allow=addinstead of the old "capability" terms.
project changes 2.0
All general project changes since hledger 1.52.4.
For the 1.99.x preview releases, and 2.0's changes since the last of them (1.99.6),
see https://hledger.org/relnotes199.html.
For package-specific changes, see the hledger package changelogs.
- The hledger repo has moved to the hledgerorg github organisation: https://github.com/hledgerorg/hledger . Old links redirect.
The main branch is now
main. (#2681 )
AI usage
- hledger 2 is developed with careful AI assistance: all changes are steered, reviewed and tested by Simon or a contributor.
(If you want software built without any help from AI tools, choose hledger 1.x.)
https://hledger.org/AI.html is our AI policy and FAQ, with the rationale and usage reports.
Commits disclose their AI usage, which is journalled in doc/ai/ (
just ai ...shows reports). First-time contributors' pull requests may not use AI tools. Security fixes for hledger 1 may be backported from AI-assisted fixes, at the maintainer's discretion.
Docs
- New docs: AI (policy and FAQ), IMPACT (the project's external impacts), RULES (repo policies, old and new, in one place), STYLE (rules for changes to hledger-web's appearance), TRANSLATING (a guide for translators, and tooling details for developers; Arthur Cinader), Upgrading to hledger 2, Start tracking lots, Charts (on the website)
- New specs and notes: SPEC-assert, SPEC-balance-change-queries, SPEC-charts, SPEC-finalising, SPEC-holdings, SPEC-lots (with a tested comparison of lot handling in Ledger, Beancount and hledger), SPEC-print, SPEC-special-postings; NOTE-performance; PLAN-gain-terms, PLAN-release-2.0
- BENCHMARKS is renamed to PERFORMANCE and rewritten for both users and developers, with performance tips and detailed stats for hledger and other PTA apps
- CHANGELOGS is retired, superseded by RELEASING and the changelogs skill
- CODE: added module maps, reading order, conventions and debug output; queries vs report options; report periods, intervals and date spans
- CONTRIBUTING, DEVFAQ, DEVWORKFLOWS, TESTS and other dev docs: a developer quick start; updated for current tools, scripts and test suites; general cleanup and consolidation; "last updated" lines added to docs more than a year old (#2528 )
- CREDITS, DECISIONS, FINANCE, FUNDING, ISSUES, README: updates
- Install: added Building outside the source tree; the release notes' binary install instructions are fixed and simplified (#2707 )
- PULLREQUESTS and the pull request template: many edits, linking to the AI policy
- REGRESSIONS, FINANCE: the regression bounties are discontinued
- RELEASING: consolidated into a single release script, grouped into phases, and revised after each release
- The Ledger and Beancount pages are updated
Website
- hledger.org uses the latest mdbook; pages' tables of contents are in the sidebar; and the hledger manual's sidebar sections are properly indented, with 10 top level entries instead of 48.
Tools/infrastructure
- AI skills: changelogs, release, credits, translations, binary-badges and regen-shelltests skills help AI assistants with those tasks; the pcc skill runs hledger's pre-commit checks
- ai:
just ai ...recipes report AI usage from Claude Code sessions, commit messages' "AI usage:" lines, and the doc/ai journal - benchmarking: scripts moved into bench/, updated;
just perftest; generatejournal has --start and --days, for sparse and dense journals (Arthur Cinader) - build: git changes now recompile only the GitInfo module (7.8s -> 4.8s for hledger); stack-prof.yaml is a profiling build config; stack configs use recent nightly snapshots, with GHC 9.14 the default; an experimental hx build tool config
- changelogs:
just changelogspre-cleans its drafts (routine commits dropped, AI usage lines stripped, breaking changes lifted to the top, possible duplicates flagged), and finds its resume point even after a rebase;just changelogs-checkverifies resume points, issue links and leftover draft markers; changelog section headings are simplified - chartsdemo:
just chartsdemo,chartsdemo-html,chartsdemo-pageandchartsdemo-imagesshow or save a representative set of charts, from examples/hbcexample.journal - checkanchors (
just anchortest): checks that #anchor links in the manual sources point to existing headings - CI: third-party actions and runner images updated; the addon functional tests run again (they had been accidentally excluded since 2017); hledger-web's browser tests run on pull requests, as a non-blocking check; an experimental mac workflow uses the hx build tool
- errors tests: converted to shelltest v3 format, with more examples
- functest: tests are isolated from the user's home directory; sorting uses LC_COLLATE=C, as in CI; more threads are used
- generaloptionshelp, installpage:
justrecipes automating the manuals' general options help and the Install page's version bumps - hledger-web: an on-demand Playwright browser test suite (
just browsertest); the favicon's sources and generator script; the systemd service file is updated (Patrick van de Glind) - i18n: i18n-extract.py collects translatable strings into hledger-lib/locale/hledger.pot, and checks catalogs for stale and untranslated entries;
just i18n-pot,i18n-check,i18n-merge,i18n-pseudo,i18n-web LANG(Arthur Cinader, Simon Michael) - Justfile: recipes recompile ./Shake when needed, avoiding stale scripts;
just holdings-*recipes try the holdings command against example data;just devver(formerlydevtag-push);just hackagerevise;just site-update - release automation:
just ghrelassembles the github release on github, as a draft, andjust ghrel-publishmakes it public after review; ANNOUNCE has sized versions for Mastodon and Bluesky/X - tools/regen-shelltests.py regenerates expected output in functional tests after a deliberate output change
credits 2.0
Simon Michael,
Arthur Cinader,
Henning Thielemann,
Dmitry Astapov,
Kevin F. Konrad,
Chunhui Ouyang,
Juan Wajnerman,
Martin,
Adam Sardo,
AidenTHu,
Andreas Pauley,
Caleb Maclennan,
Daniil Iaitskov,
Diego Depaoli,
GuillaumedeVolpiano,
JoeJoeflyn,
Joshua Chapman,
Juliano Solanho,
Patrick van de Glind,
Rostislav Raykov.
The amount expressions work was a bounty funded by James Shubin.
#
Install #
The hledger Install page lists the easiest ways to install a recent release,
such as brew on macos, choco/ scoop/ winget on Windows, or eget on all platforms.
Or, follow these instructions to install the specific release binaries below:
GNU/Linux, 64-bit Intel
At the command line:
curl -fL https://github.com/hledgerorg/hledger/releases/download/2.0/hledger-linux-x64.tar.gz | tar -xzv -f- -C/usr/local/bin hledger hledger-ui hledger-web
hledger --version; hledger-ui --version; hledger-web --version # should show 2.0
Prefix tar with sudo if /usr/local/bin is not writable.
Mac, 64-bit ARM or Intel
Open a terminal window.
(Don't download these binaries with your web browser - they won't get authorised.)
On ARM macs:
sudo mkdir -p /usr/local/bin
curl -fL https://github.com/hledgerorg/hledger/releases/download/2.0/hledger-mac-arm64.tar.gz | sudo tar -xzv -f- -C/usr/local/bin hledger hledger-ui hledger-web
hledger --version; hledger-ui --version; hledger-web --version # should show 2.0
On Intel macs:
sudo mkdir -p /usr/local/bin
curl -fL https://github.com/hledgerorg/hledger/releases/download/2.0/hledger-mac-x64.tar.gz | sudo tar -xzv -f- -C/usr/local/bin hledger hledger-ui hledger-web
hledger --version; hledger-ui --version; hledger-web --version # should show 2.0
If the version check shows an older version, you have another hledger earlier in $PATH; which -a hledger will find it.
Windows, 64-bit ARM or Intel
In a powershell window (press WINDOWS-R, powershell, ENTER).
(Don't download the zip with your web browser - programs downloaded that way may be blocked when you run them.)
cd ~
curl.exe -fLO https://github.com/hledgerorg/hledger/releases/download/2.0/hledger-windows-x64.zip
Expand-Archive hledger-windows-x64.zip -Force -DestinationPath "$env:LOCALAPPDATA\Programs\hledger"
$env:LOCALAPPDATA\Programs\hledger (ie C:\Users\YOURNAME\AppData\Local\Programs\hledger) is not in $env:Path by default,
so if $env:Path doesn't show it, add it once:
[Environment]::SetEnvironmentVariable('Path', "$env:LOCALAPPDATA\Programs\hledger;" + [Environment]::GetEnvironmentVariable('Path','User'), 'User')
$env:Path = "$env:LOCALAPPDATA\Programs\hledger;$env:Path" # for this window; new windows will pick it up automatically
Then:
hledger --version; hledger-ui --version; hledger-web --version # should show 2.0
If the version check shows an older version, you have another hledger earlier in $env:Path; where.exe hledger will find it.
These are 64-bit Intel binaries; they also run on ARM machines (emulated).
They may also work on Windows 7:
use Windows Explorer to extract hledger-windows-x64.zip into a folder of your choice,
then open a command window (WINDOWS-R, cmd, ENTER) and run the hledger programs.
Next steps
Once installed, run hledger, and see the Docs.