Add a new account type Gain with single-letter code G as a subtype of
Revenue, similar to how Cash is a subtype of Asset and Conversion is a
subtype of Equity. This enables tracking capital gains/losses separately
while still including them in income statements and close --retain.
Usage: account revenues:capital ; type: G
- type:G matches only Gain accounts
- type:R matches both Revenue and Gain (subtype matching)
- Auto-detection from account names matching:
^(income|revenue)s?:(capital[- ]?)?(gains?|loss(es)?)(:|$)
e.g. income:gains, revenue:capital-gains, income:losses
For now, `hledger add` with the stackage build of hledger 1.51.2+ will once again show ANSI junk.
Dev builds, the github release binaries, stackage builds of hledger-1.50..1.51.1,
and stackage hledger builds in future snapshots with a GHC that provides the fixed haskeline,
will remain free of that bug.
Previously LEDGER_FILE=foo hledger add did, but hledger -f foo add didn't.
Now they both consistently will error if given a glob
(a path contining [, {, *, or ?) that matches nothing,
rather than auto-creating a file with a glob-like name.
Hledger.Utils.IO:
expandPathOrGlob
This restores the pre-1.50.3 behaviour of add and import, which once
again auto-create a missing file (specified by -f or LEDGER_FILE or
the builtin default path) rather than giving an error.
This fixes#2514 and refines the fix for [#2485].
There's also an improvement: they no longer create it unconditionally at the start;
they create lazily, when they have data to write.
Hledger.Read:
defaultExistingJournalPath
defaultExistingJournalPathSafely
readPossibleJournalFile
Hledger.Cli.Utils:
withPossibleJournal