Commit Graph

2611 Commits

Author SHA1 Message Date
Simon Michael
b3aff7a394 imp: add: avoid deprecated time function 2022-03-25 20:10:18 -10:00
Simon Michael
7092ef9a89 fix: commented test for #1849 2022-03-25 19:42:49 -10:00
Simon Michael
97e57c2cb5 imp: doc: clarify relative dates in periodic rules (#1845) 2022-03-25 16:44:57 -10:00
Simon Michael
9a8fb529f3 imp: add a test clarifying periodic txns with forecast (#1845) 2022-03-25 16:30:35 -10:00
Stephen Morgan
31c7c5d1ca fix: Clean up build failures due to redundant imports and duplicate
function.
2022-03-26 11:37:32 +11:00
Stephen Morgan
603b2e9f09 ref: Use ExceptT String IO a instead of IO (Either String a).
This increases composability and avoids some ugly case handling. We
re-export runExceptT in Hledger.Read.

The final return types of the following functions has been changed from
IO (Either String a) to ExceptT String IO a. If this causes a problem,
you can get the old behaviour by calling runExceptT on the output:
readJournal, readJournalFiles, readJournalFile

Or, you can use the easy functions readJournal', readJournalFiles', and
readJournalFile', which assume default options and return in the IO
monad.
2022-03-25 14:23:27 -10:00
Simon Michael
4eeb646912 test: errors: doc updates 2022-03-20 07:21:31 -10:00
Simon Michael
5281c5d647 imp: allow pivoting on 'status' also 2022-03-18 21:38:31 -10:00
Simon Michael
2ed4201e36 test: errors: doc updates 2022-03-18 12:47:12 -10:00
Simon Michael
10160351e9 test: errors: doc updates 2022-03-18 12:32:54 -10:00
Simon Michael
81c7f91202 test: errors: doc updates 2022-03-18 12:31:28 -10:00
Simon Michael
726978d1c5 test: errors: doc updates 2022-03-18 12:22:36 -10:00
Simon Michael
78da46c789 test: errors: doc updates 2022-03-18 12:10:36 -10:00
Simon Michael
d3cabb5494 test: errors: doc updates 2022-03-18 12:01:50 -10:00
Simon Michael
25e706eca0 test: errors: doc updates 2022-03-18 11:03:21 -10:00
Simon Michael
8729fc0c47 test: errors: note versions 2022-03-18 09:02:06 -10:00
Simon Michael
512ebdfd5f test: errors: fix link, update summary 2022-03-18 08:50:20 -10:00
Simon Michael
eaa6e202f3 test: errors: show current errors in doc, generated by showall 2022-03-18 08:25:58 -10:00
Simon Michael
f7625343f6 test: errors: rename tests like check command's checks 2022-03-18 07:16:04 -10:00
Simon Michael
2b2d643333 test: errors: make tests runnable 2022-03-18 06:59:33 -10:00
Simon Michael
3775b97f04 test: errors: document 2022-03-17 19:44:47 -10:00
Simon Michael
6510ba3c95 test: examples for reproducing journal errors 2022-03-17 17:38:26 -10:00
Stephen Morgan
e6bf04fce3 fix: aliases: Make sure we can escape forward slashes in account
aliases, but otherwise the regular expression handler handles escapes.
2022-03-16 19:01:03 -10:00
Stephen Morgan
cbdd86f4dc imp: reg: areg: Align to first 1000 postings by default, rather than 100.
This has the same performance characteristics for a big decrease in alignment
issues. 1000 postings seems to still put it under the memory bottleneck.
2022-03-11 13:25:38 -10:00
Simon Michael
129f37cfe6 reg: tweak --align-all help (#1839) 2022-03-11 07:16:55 -10:00
Simon Michael
64d1927384 reg: document --align-all (#1839) 2022-03-11 07:16:33 -10:00
Stephen Morgan
c0cc9e73c1 dev: reg: areg: Be more clever about register and aregister alignment.
When rendering register or aregister reports, calculate the amount /
balance width based on the first 100 items, and start rendering in that
way. If you encounter a longer one, update and continue rendering. This
will result in adjustment of column width for long reports, but allows
us to save a lot more performant/efficient.

This can be disabled with the new --align-all flag.

We also only render each amount once, rather than twice as before, by
storing the rendered amount in a tuple.
2022-03-11 06:47:48 -10:00
Stephen Morgan
cbc985d411 dev: reg: areg: Speed up reg and areg by only aligning to first 1000 items. 2022-03-10 17:42:04 -10:00
Stephen Morgan
4a80551406 fix: price: Make sure inferred market prices have the correct sign with
total prices. (#1813)

Also reduce duplication for inferring market prices (previously it was
done separately in both Hledger.Data.Journal and
Hledger.Cli.Commands.Prices), and remove *TotalPriceToUnitPrice
functions, since unit prices cannot represent all total prices.

Add a helper function numDigitsInt to get the number of digits in an
integer, which has a surprising number of ways to get it wrong.
2022-03-10 17:34:49 -10:00
Simon Michael
25e3cca2e1 doc: regex aliases update (#1832) 2022-03-10 17:13:34 -10:00
Stephen Morgan
a65e64115a fix: alias: Allow escaped characters in regular expression aliases. (#982) 2022-03-10 17:00:03 -10:00
Stephen Morgan
19ed6d3f00 cln!: sourcepos: Use megaparsec-supplied sourcePosPretty.
Change showSourcePos to sourcePosPretty, and showSourcePosPair to
sourcePosPairPretty.
2022-03-10 16:56:28 -10:00
Simon Michael
f0e00b3a43 ;doc: update changelogs 2022-03-10 16:55:46 -10:00
Simon Michael
460a1fc209 ;doc: update manuals 2022-03-07 09:33:11 -10:00
Simon Michael
2b978869dd doc: journal: clarify == assertions 2022-03-07 08:49:03 -10:00
Simon Michael
af7a5f98e3 ;cabal: update cabal files 2022-03-05 13:24:48 -10:00
Simon Michael
5aab2cbf40 ;pkg: bump version to 1.25.99 2022-03-05 13:24:48 -10:00
Simon Michael
5707abbd69 doc: changelog tweaks 2022-03-04 20:25:42 -10:00
Simon Michael
e4ca7187fe doc: finalise changelogs for 1.25 2022-03-04 17:51:59 -10:00
Simon Michael
2ee914bdc7 ;doc: update changelogs 2022-03-04 17:04:50 -10:00
Stephen Morgan
2f47ae05c6 fix: csv: Allow unicode in field references for csv. (#1809) 2022-02-06 14:16:17 -10:00
Simon Michael
71f9c7985f doc: changelog updates from release branch 2022-02-05 22:09:20 -10:00
Simon Michael
ef4da90538 ;doc: update changelogs 2022-02-05 14:57:53 -10:00
Simon Michael
5076389161 ;doc: account types 2022-02-03 16:38:22 -10:00
Simon Michael
dea13e08ab ;doc: account account types tweak (#1822) 2022-02-03 16:27:19 -10:00
Simon Michael
8ef82f5cd8 ;doc: account type updates (#1822) 2022-02-03 15:41:12 -10:00
Simon Michael
4ec441925a ;doc: account type updates (#1822) 2022-02-03 15:37:23 -10:00
Stephen Morgan
31fdcdb8ef !imp: type: Change the default account inference for Cash accounts to only match
^assets?(:.+)?:(cash|bank|che(ck|que?)(ing)?|savings?|current)(:|$)

This should have no effect outside the cash report.

The rule for auto-detecting "Cash" (liquid assets) from account names
has changed in this release - see [Account types]. This is to simplify
how account types are detected and configured. If you use the cashflow
report without explicitly declaring accounts as Cash, you might notice a
change, and might need to add explicit account type: tags.
2022-02-03 15:32:00 -10:00
Stephen Morgan
2e4cfccf1b fix: types: Make sure type: query will correctly match subtypes, so
type:a will also match cash accounts, and type:e will also match
conversion accounts.
2022-02-03 15:32:00 -10:00
Stephen Morgan
73925ae965 fix: types: Ensure auto postings can match against and be matched by type: queries.
This requires checking parent accounts for any new accounts introduced by auto postings which do not exist in the original journal.

Also refactor journalFinalise to only call journalPostingsAddAccountTags once, and use fewer intermediate variables.
2022-02-03 15:32:00 -10:00
Stephen Morgan
a16c88b1b1 fix: Make sure cash and conversion account types are correctly
determined when there are no explicit declarations.
2022-02-03 15:32:00 -10:00
Simon Michael
4aa06d7920 ;doc: account types: edits 2022-02-02 17:40:47 -10:00
Simon Michael
b96b6c406e ;doc: account types: rewrite/expand 2022-02-02 17:15:39 -10:00
Simon Michael
807717805a feat: accounts: --types shows account types (#1820) 2022-02-01 18:06:19 -10:00
Simon Michael
dbbd300aa2 ;dev: accounts: test cleanup 2022-02-01 18:03:46 -10:00
Simon Michael
0f8ede3038 ;doc: document how aliases can break account types (#1820) 2022-02-01 14:47:30 -10:00
Simon Michael
cb040dbe29 imp: type: forgot the tests 2022-01-31 16:44:13 -10:00
Simon Michael
336c4a7b33 imp: cleaner error messages when parsing cli (less "user error") 2022-01-31 16:44:13 -10:00
Simon Michael
9c872c2d9c imp: areg: clearer, more consistent error messages 2022-01-31 16:44:13 -10:00
Simon Michael
45127dc5f5 feat: new type: query for easy matching by account type
type:TYPES, where TYPES is any of the (case insensitive) letters
ALERXCV, matches accounts by their declared or inferred type.
(See https://hledger.org/hledger.html#account-types.)
This should work with most commands, eg:

    hledger bal type:al
    hledger reg type:x

API changes:

Journal has a new jaccounttypes map.
The journalAccountType lookup function makes it easy to check an account's type.
The journalTags and journalInheritedTags functions look up an account's tags.
Functions like journalFilterPostings and journalFilterTransactions,
and new matching functions matchesAccountExtra, matchesPostingExtra
and matchesTransactionExtra, use these to allow more powerful matching
that is aware of account types and tags.
2022-01-31 16:44:13 -10:00
Stephen Morgan
91441bad8f test: Make sure --today is passed to --forecast tests so they keep
working.
2022-01-31 15:12:04 -10:00
Simon Michael
248ddf9378 dev: more thorough Journal anonymisation, and a note (#1817) 2022-01-30 09:47:52 -10:00
Simon Michael
3472c3cb6d ;dev: number anon tests 2022-01-30 09:47:52 -10:00
Simon Michael
3d57fa32c2 ;doc: querying by tags, on accounts and generally (#1817) 2022-01-30 09:47:52 -10:00
Simon Michael
56be63e6f1 feat: queries can now match account tags (#1817)
Accounts, postings, and transactions can now all be filtered by the
tags in an account's declaration. In particular it's now possible to
more reliably select accounts by type, using their type: tag rather
than their name:

    account myasset       ; type:Asset
    account myliability   ; type:Liability

    $ hledger accounts tag:type=^a
    myasset

Accounts inherit tags from their parents.

API changes:
A finalised Journal has a new jdeclaredaccounttags field
for easy lookup of account tags.
Query.matchesTaggedAccount is a tag-aware version of matchesAccount.
2022-01-30 09:47:52 -10:00
Simon Michael
2f48307c63 dev: query-tag.test -> format 3 2022-01-30 09:47:52 -10:00
Stephen Morgan
df4949ad1a imp!: journal: Remove deprecated account type code syntax from account
directives.

Previously, you declare an account type with the following format:
account assets  A
This has been deprecated since 1.13, and should now be declared with one
of:
account assets  ; type:A
account assets  ; type:asset
2022-01-28 12:38:38 -10:00
Stephen Morgan
1d9be4c2de cln: print, close: Check the show_costs_ option instead of directly
checking the --show-costs flag.
2022-01-26 08:07:11 -10:00
Stephen Morgan
ba0eec9132 ref: Return the interval split in reportSpan, to reduce the number
of different places we call splitSpan and ease refactoring.
2022-01-26 08:05:37 -10:00
Stephen Morgan
2a51b6e9a4 fix: layout: Commodity symbols should be omitted in --layout=bare when
all amounts are zero. (#1789)
2022-01-26 07:58:14 -10:00
Stephen Morgan
55a022a941 fix: strict: Make sure forecast transactions and auto postings are
checked with --strict. (#1810)
2022-01-26 07:57:13 -10:00
Patrik Keller
2cf4c221de Manual: clarify reference from --strict to check 2022-01-26 07:45:13 -10:00
Simon Michael
e16fa51dd5 imp: nicer invalid balance assignment errors (fix tests) 2022-01-21 17:45:23 -10:00
Stephen Morgan
8cd9e81c34 fix: budget: Make sure boring parents of unbudgeted accounts are not
elided if they have a budget. (#1800)

This only affects calls with --budget and -E, but not with --no-elide.
2022-01-21 09:11:04 -10:00
Simon Michael
d9b0184720 ;doc: changeslogs: edit 2022-01-21 08:38:59 -10:00
Simon Michael
41b68714ff ;doc: update manuals 2022-01-21 08:32:29 -10:00
Simon Michael
fbf826a813 ;doc: update CLI usage texts 2022-01-21 08:32:29 -10:00
Simon Michael
8daef36c29 ;doc: update changelogs 2022-01-21 08:32:29 -10:00
Simon Michael
1716a3e55c ;doc: roi: dear lord fix links again 2022-01-21 08:20:05 -10:00
Simon Michael
209a726e26 ;doc: roi: make links useful in plain text docs
And update how-to url.
2022-01-21 08:17:55 -10:00
Simon Michael
beeb7b157c ;doc: roi: fix link 2022-01-21 08:13:26 -10:00
Simon Michael
bf2ac4f18b ;doc: roi: formatting 2022-01-21 08:13:26 -10:00
Stephen Morgan
57d055b643 fix: cost: Add inferred equity postings during journal finalisation, so
they can be matched by queries.
2022-01-16 18:37:18 -10:00
Simon Michael
f7a3f510be ;doc: describe no-symbol commodity checking (#1772) 2022-01-16 08:24:30 -10:00
Stephen Morgan
5006e26995 imp: check: Do not check commodities for zero amounts with empty
commodity. (#1767)
2022-01-16 08:11:02 -10:00
Simon Michael
dbcd235f9e ;doc: update manuals 2022-01-15 08:56:45 -10:00
Simon Michael
6e12be15df ;doc: update CLI usage texts 2022-01-15 08:56:45 -10:00
Simon Michael
9444e20c3d ;doc: update changelogs 2022-01-15 08:56:45 -10:00
Simon Michael
fb834777a6 ;fix: doc: update help/help-feedback links (#1807) 2022-01-15 08:53:48 -10:00
Stephen Morgan
f13ac2812f imp: smartdates: Simplify and generalise the SmartDate constructor and
parsers to allow for arbitrary numbers of periods in relative dates.

We now accept smart dates like “in 5 days, 5 weeks ahead, in -6 months, 2 quarters ago”.
2022-01-11 13:31:29 -10:00
Simon Michael
0e5ae2baac ;doc: update changelogs 2022-01-06 06:42:34 -10:00
Simon Michael
d82210cea9 ;doc: update changelogs 2022-01-05 18:09:23 -10:00
Simon Michael
757c548c17 ;doc: update changelogs 2022-01-05 08:12:44 -10:00
Simon Michael
d1bc3bbb32 ;doc: update changelogs 2022-01-01 15:55:08 -10:00
Simon Michael
326b2309bc ;doc: csv: tweak 2021-12-30 09:22:57 -10:00
Dmitry Astapov
ce54fb8ae9 ;roi: fixes #1791 (fix TWR when investment=0, several pnls per day) 2021-12-27 08:10:22 -10:00
Simon Michael
737ab13284 journal: doc updates for aliases corrupting account names (#1788) 2021-12-22 15:14:37 -10:00
Simon Michael
713f7eab65 journal: doc updates for aliases corrupting account names (#1788) 2021-12-22 15:08:01 -10:00
Simon Michael
9c173bc18b journal: tests/docs for aliases corrupting account names (#1788) 2021-12-22 14:59:13 -10:00
Simon Michael
cfee37ab36 ;doc: fix conversion & cost lists 2021-12-21 11:01:39 -10:00