Commit Graph

3499 Commits

Author SHA1 Message Date
Simon Michael
d8a3c9fa3e dev: no need to style amounts when converting to cost 2023-09-02 06:46:14 +01:00
Simon Michael
644635b918 imp: print: show a disambiguating decimal mark when needed
Eg "1,000" (with , as a thousands separator and no decimal digits) is
now displayed with a decimal mark: "1,000.".

"1 000" (where space is a thousands separator) is less ambiguous,
but we do the same thing (eg "1 000.") for consistency, and also to
help disambiguate when forgetting to quote a numeric commodity symbol
(eg "1234 0" where 1234 is a symbol that should have been in double quotes).
2023-09-02 06:46:14 +01:00
Simon Michael
f620a3e0ea dev: showAmountB: clarify 2023-09-02 06:46:14 +01:00
Simon Michael
4bd0dd7ab0 fix: print: don't round in implicit conversions (fix #2079) 2023-09-02 06:46:14 +01:00
Simon Michael
77aeb18bbd fix:print:style balance assertion costs; more styling api; HasAmounts class 2023-09-02 06:46:14 +01:00
Simon Michael
97be1646f1 dev: AmountStyle: make setting the precision optional
This simplifies the code for styling amounts with or without precision.
But it complicates the semantics (Nothing is useful only when setting style).
Not sure if it's the best way.
2023-09-02 06:46:14 +01:00
Simon Michael
85845e51b2 dev: AmountStyle: rename, reorder fields more mnemonically
Since this type is about to change anyway.
2023-09-02 06:46:14 +01:00
Simon Michael
9f0840456d dev: consolidate amount styling as a new (interim) api 2023-09-02 06:46:14 +01:00
Simon Michael
9b15d34f9c dev: amounts: cleanups 2023-09-02 06:46:14 +01:00
Simon Michael
d3cc31780a dev: AmountStyle: improve debug output 2023-09-02 06:46:14 +01:00
Simon Michael
ff730f775b imp:print: zero posting amounts are now shown with commodity & style
print now shows zero posting amounts with their original commodity
symbol and the corresponding style (instead of stripping the symbol).

If an inferred amount has multiple zeroes in different commodities,
a posting is displayed for each of these.

Possible breaking changes:

showMixedAmountLinesB, showAmountB, showAmountPrice now preserve
commodityful zeroes when rendering. This is intended to improve print output,
but it seems possible it might also affect balance and register reports,
though our tests show no change in those.
2023-08-27 07:34:09 +01:00
Simon Michael
35c0fd692c dev: clarify showAmountB 2023-08-27 07:34:09 +01:00
Simon Michael
28cdcd1bfd dev: clarify orderedAmounts 2023-08-27 07:34:09 +01:00
Simon Michael
3f050d45a9 dev: improve showMixedAmountLinesB doc 2023-08-27 07:34:09 +01:00
Simon Michael
c9e9145318 dev: clarify missingamt/missingmixedamt docs 2023-08-27 07:34:09 +01:00
Jay Neubrand
97943b206c make groupByDateSpan return data when first period has unbounded begin 2023-08-25 18:40:50 +01:00
Simon Michael
115b639ec2 ;doc: update manuals 2023-08-22 08:41:22 +01:00
Simon Michael
5f1bf0404a imp:check: more intuitive "balanced..." check names
balancedwithautoconversion -> autobalanced
balancednoautoconversion   -> balanced
2023-08-22 08:38:52 +01:00
Simon Michael
c1c28aea3f imp:journal: match equity conversion postings more tolerantly (fix #2041)
Equity conversion postings and cost amounts were being matched up too
exactly, causing valid entries with redundant conversion postings and
costs to be rejected. Now the amounts are compared with the precision
(number of decimal places) used in the conversion posting's amount.
Eg, here the first posting's 209.60495 GEL cost is recognised as a
match for the third posting's -209.60 GEL, using the latter's two
digit precision:

    2023-01-01
        Assets               -84.01 USD @ 2.495 GEL  ; 209.60495 GEL
        Equity:Conversion     84.01 USD
        Equity:Conversion   -209.60 GEL
        Assets               209.60 GEL
2023-07-15 16:21:00 -10:00
Simon Michael
d19690e5bd dev:Transaction: refactor/clarify transactionInferCostsFromEquity 2023-07-15 16:19:45 -10:00
Simon Michael
516a5cb448 dev: equity/cost analysis: process in parse order, better debug output
More intuitive posting numbering, making troubleshooting easier.
2023-07-15 16:17:08 -10:00
Simon Michael
ed456a3f8c imp:check:recentassertions: improve the error message's suggestion
The suggested sample balance assertion now uses the same commodity
symbol as in the failing posting (the first, if there are more than
one). Also the cleared mark has been removed.
2023-07-13 09:01:57 -10:00
Simon Michael
002773f650 imp:check:recentassertions: give a more useful error location
hledger check recentassertions now reports the error at the first
posting that's more than 7 days later than the latest balance
assertion (rather than at the balance assertion).  This is the thing
actually triggering the error, and it is more likely to be visible or
at least closer when you are working at the end of a journal file.
2023-07-12 19:54:18 -10:00
Simon Michael
1cfcb7fa76 ;cln: journalAddInferredEquityPostings -> journalInferEquityFromCosts 2023-07-04 13:21:55 -10:00
Simon Michael
8d429b5ac4 pkg:cabal: update cabal files 2023-07-01 08:14:23 -10:00
Simon Michael
1a0b745c28 pkg: add support for aeson 2.2, add upper bound 2023-07-01 08:14:23 -10:00
Simon Michael
1bd1c55bd6 ;pkg: update tested-with 2023-07-01 07:34:46 -10:00
Simon Michael
f4508e73d3 ;cabal: update cabal files 2023-06-16 12:11:53 -10:00
Simon Michael
110861ee83 ;pkg: allow megaparsec 9.4 2023-06-16 12:11:08 -10:00
Simon Michael
03e0bb9c57 ;doc: update changelogs 2023-06-14 19:06:46 -10:00
Simon Michael
79a1f1dd97 ;doc: update changelogs 2023-06-13 22:04:33 -10:00
Simon Michael
068cec31eb imp:cli: desc is now preferred for pivoting on description.
`description` still works for compatibility (undocumented).
2023-06-09 08:04:06 -10:00
Eric Mertens
e668506d26
feat: cli: Support colon-delimited --pivot (#2050)
feat:cli: --pivot now can construct an account name from multiple colon-delimited fields
2023-06-09 08:00:01 -10:00
Simon Michael
873c7339a6 ;cln: comment 2023-06-08 06:40:46 -10:00
Simon Michael
3357c27390 fix: accept entries with unmatched equity conversion postings (#2045)
Since 1.29, we unconditionally run part of the --infer-cost logic to
identify redundant costs/equity postings. This was too strict, raising
an error whenever it could not find postings matching the equity
postings.  Now we do this (and also the explicit --infer-costs
operation) as a best effort, leaving transactions unchanged if we
can't detect matching postings. This is consistent with
--infer-equity, --infer-market-prices, -B and -V.
2023-06-06 20:44:03 -10:00
Simon Michael
122e7dae94 cln: try to clarify transactionInferCostsFromEquity a bit 2023-06-06 20:43:32 -10:00
Simon Michael
57cc76ae2e ;doc: update changelogs 2023-06-02 10:25:24 -10:00
Simon Michael
5410f87953 ;doc: update changelogs 2023-06-02 08:07:52 -10:00
Simon Michael
21d6b00597 ;doc: update manuals 2023-06-01 16:35:11 -10:00
Simon Michael
286ee105da ;cabal: update cabal files 2023-06-01 16:34:52 -10:00
Simon Michael
9ae87a73fa ;pkg: bump version to 1.30.99 2023-06-01 16:34:52 -10:00
Simon Michael
34c401d1cf imp: Revert "imp: cli: make some reporting flags toggle on/off when repeated"
This reverts commit 57c0205107.

Toggling means it can be hard to know if the feature is on or off.
This needs more testing.
2023-06-01 16:32:44 -10:00
Simon Michael
ecf266a808 ;doc: merge 1.30 changelogs 2023-06-01 16:29:35 -10:00
Simon Michael
3f08394c6c ;doc: update changelogs 2023-05-31 22:03:50 -10:00
Simon Michael
d7f0398542 ;cln: doc: fix garbled haddock for journalDateSpan, journalDateSpanBothDates
hopefully
2023-05-27 12:01:20 -10:00
Simon Michael
d19d866446 fix: use costs when balancing a txn with a balance assignment (fix #2039)
Transaction balancing is supposed to balance costs, but these were
being stripped when calculating balance assignments, causing us to
wrongly reject this transaction when the last amount is left implicit,
unlike Ledger:

2023-01-01
    Assets                AAA -1.1 @@ CCC 2
    Assets                BBB -1.2 @@ CCC 3
    Expenses:Fees         CCC  0.2
    Assets                                  = CCC 4.9

I'm not sure why costs were being stripped. I seem to have added it
in 2019 (to Journal.balanceNoAssignmentTransactionB in 3b47b58ae),
but this bug seems to be present even before that.
2023-05-27 08:34:11 -10:00
Simon Michael
d2cefedffb ;doc: update manuals 2023-05-26 09:28:53 -10:00
Simon Michael
4a61caefd7 fix: infer amountless unbalanced virtual postings as zero
They were effectively zero already, but print always showed them with no amount, even with -x, which was unclear.
2023-05-20 17:41:59 -10:00
Simon Michael
e832c344c1 dev: comment 2023-05-20 17:29:06 -10:00
Simon Michael
029b59093b feat: csv: rules files can be read directly; data file can be specified
CSV rules files can now be read directly, eg you have the option of
writing `hledger -f foo.csv.rules CMD`. By default this will read data
from foo.csv in the same directory.  But you can also specify a
different data file with a new `source FILE` rule. This has some
convenience features:

- If the data file does not exist, it is treated as empty, not an
  error.

- If FILE is a relative path, it is relative to the rules file's
  directory. If it is just a file name with no path, it is relative
  to ~/Downloads/.

- If FILE is a glob pattern, the most recently modified matched file
  is used.

This helps remove some of the busywork of managing CSV downloads.
Most of your financial institutions's default CSV filenames are
different and can be recognised by a glob pattern.  So you can put a
rule like `source Checking1*.csv` in foo-checking.csv.rules,
periodically download CSV from Foo's website accepting your browser's
defaults, and then run `hledger import checking.csv.rules` to import
any new transactions. The next time, if you have done no cleanup, your
browser will probably save it as something like Checking1-2.csv, and
hledger will still see that because of the * wild card. You can choose
whether to delete CSVs after import, or keep them for a while as
temporary backups, or archive them somewhere.
2023-05-19 09:09:21 -10:00
Simon Michael
ddae3af8a3 lib: Hledger.Utils.IO: added expandGlob, sortByModTime 2023-05-19 09:09:21 -10:00
Simon Michael
3d2ef21081 lib: Hledger.Utils.IO: more robust monochrome pretty/debug printing 2023-05-18 07:19:36 -10:00
Simon Michael
83de76b67a lib: Hledger.Utils.IO: avoid excessively wide "compact" prettyprinting 2023-05-18 07:19:36 -10:00
Simon Michael
76f336695c lib: Hledger.Utils: added multicol 2023-05-18 07:19:36 -10:00
Simon Michael
577e4b6347 fix!: csv: skip now counts non-blank lines more robustly (fix #2024)
Inner empty lines were not being skipped automatically, contrary to
docs. Now all empty lines are skipped automatically, and the `skip`
rule is needed only for non-empty lines, as intended.

This may be a breaking change: it's possible that the `skip` count
might need to be adjusted in some CSV rules files.
2023-05-11 17:06:12 -10:00
Simon Michael
69be1d4ef7 ;dev: csv: refactor, clarify 2023-05-11 15:44:56 -10:00
Simon Michael
70d4c0c638 ;dev: csv: refactor, clarify 2023-05-11 15:35:05 -10:00
Simon Michael
755c3d3dbb ;dev: csv: refactor 2023-05-11 15:34:31 -10:00
Simon Michael
57c0205107 imp: cli: make some reporting flags toggle on/off when repeated
This can be useful to override defaults in scripts.
These flags will now toggle when repeated on the command line:

--invert
--transpose
-r/--related
-%/--percent
-E/--empty
-N/--no-total
-T/--row-total
-A/--average
-S/--sort-amount
2023-05-09 11:10:12 -10:00
Simon Michael
8735af77df lib: add toggleopt, for flags that toggle when repeated 2023-05-09 10:08:52 -10:00
Simon Michael
147d49c66c dev: cln: drop Hledger.Data.RawOptions.inRawOpts 2023-05-09 10:02:24 -10:00
Simon Michael
75a6c1e510 fix: "every 29th/30th/31st day of month" dates with a start date (fix #2032)
Since hledger 1.25, "every Nth day of month" period rules with N > 28
could be off by a couple of days if given certain forecast start dates.
Eg `~ every 31st day of month` with `--forecast='2023-03-30..'`.
2023-05-03 19:18:35 -10:00
Simon Michael
bbecd611f1 imp: timedot: make one multi-posting transaction per date line (#1754)
Descriptions and comments are now more straightforward and similar to
journal format.
2023-05-03 19:18:35 -10:00
Simon Michael
50349f81f7 imp: timeclock: support comments and tags (fix #1220)
Breaking change: previously timeclock descriptions could contain
semicolons. Now a semicolon in the description will end it and
start a comment (which may contain tags).
2023-05-03 00:05:11 -10:00
Simon Michael
f7f86a709b imp: timedot: fix day description/comment parsing; parse posting comments/tags 2023-05-02 17:03:03 -10:00
Simon Michael
1b19f3d330 dev: timedot: clarify, cleanup 2023-05-02 17:02:30 -10:00
Simon Michael
a771c8fc19 imp: revert 2b5194238 imp: generate auto postings on forecast transactions by default (#2027)
I found at least one user for whom this would be a breaking change
(they generate forecast txns, and have auto posting rules, but don't
want the latter applied to the former). I guess it's better to keep
things as they were for now: if you need auto postings on your
forecast txns you must use two flags, --forecast --auto.
2023-04-30 08:08:26 -10:00
Simon Michael
7f713f6a44 imp: Generated/modified txns/postings are now tagged only with --verbose-tags 2023-04-29 18:25:11 -10:00
Simon Michael
2b5194238b imp: generate auto postings on forecast transactions by default 2023-04-29 16:00:14 -10:00
Simon Michael
9ebcd9ec28 fix: process postings in date order when inferring balance assignments (fix #2025) 2023-04-27 17:15:21 -10:00
Simon Michael
9d0eb20ac5 ;dev: improve comment 2023-04-27 09:17:29 -10:00
Simon Michael
f5c3bbcaf0 fix: cli: posting comment lines no longer disturb the error marker (fix #1927) 2023-04-26 22:53:01 -10:00
Simon Michael
1be06c87c4 feat: bal: A new --count report type counts postings instead of amounts. 2023-04-20 14:36:41 -10:00
Simon Michael
996ccb0ea2 ;doc: changes: merge from 1.29.2 branch 2023-04-07 14:26:45 -10:00
Simon Michael
ae23a18f87 ;doc: update changelogs 2023-04-07 11:31:25 -10:00
Simon Michael
1c5dee2339 fix: doc: update manuals; regenerate all info manuals (fix #2023) 2023-04-06 14:13:39 -10:00
Simon Michael
1de8600067 imp: cli: try to ensure less (and its more mode) show ANSI (fix #2015)
If you use some other $PAGER, you will have to configure it to show
ANSI yourself (or disable ANSI, eg by setting NO_COLOR=1).
2023-04-06 11:13:00 -10:00
Simon Michael
c661fa7763 dev: lib: refactor pager 2023-04-06 11:12:56 -10:00
Simon Michael
6e7575317a imp: "type:" queries now see through aliases/pivots, like acct: (fix #2018)
When doing a type: match we now also check the original unaliased,
unpivoted posting, as when doing an acct: match. This is effectively
how things worked with the older account type detection in hledger <1.27.
2023-04-06 11:12:35 -10:00
Simon Michael
c03d6b1123 imp: print: --match makes better choices
Previously, similarity completely outweighed recency, so a
slightly-more-similar transaction would always be selected no matter
how old it was. Now similarity and recency are more balanced,
and it should produce the desired transaction more often.
There is also new debug output (at debug level 1) for
troubleshooting.
2023-03-27 15:21:42 -10:00
Chris Lemaire
891853d2f2 queries: Update boolean queries to be case-insensitive
That is, the query operators AND, OR, and NOT are now case-insensitive.
Queries are otherwise left the same as they were.
2023-03-27 10:29:26 -10:00
Chris Lemaire
cddbae6467 queries: Prefix boolean queries with expr:
Boolean queries are now prefixed with an 'expr:' prefix, making them
completely separable from old queries and making the addition of them a
little more migration proof.

The tests are updated accordingly, changes made to the tests previously
are removed and extra cautious documentation is also removed.
2023-03-27 10:29:26 -10:00
Chris Lemaire
4f143d6bec queries: Update documentation on boolean queries
Also add a test to check that the assertion on how boolean queries
combine with space-separated queries works.
2023-03-27 10:29:26 -10:00
Chris Lemaire
35db1cae4f queries: Add generalised boolean queries
This commit changes some of the functions in the Query module and
changes the overall way to parse queries. Instead of using the words''
split function, this commit starts to fully parse the query, as it's
seen as a type of expression.

AND, OR, NOT, and space operators can be used. The space operator
simulates the behaviour from before, leaving a minimal amount of tests
that need to be adjusted to comply to the new behaviour.
2023-03-27 10:29:26 -10:00
Simon Michael
c2ab616c2d dev: unbreak recent change, don't re-export Color/ColorIntensity for now 2023-03-18 20:19:50 -10:00
Simon Michael
b9af9ab367 ;doc: update changelogs 2023-03-18 20:10:25 -10:00
Simon Michael
4d7d982f83 ;cabal: update cabal files 2023-03-18 20:06:55 -10:00
Simon Michael
be8e64e498 imp: lib: export more terminal size, ANSI style/color helpers
Hledger.Utils.IO (and therefore Hledger and Hledger.Cli.Script) added:

    getTerminalHeightWidth
    getTerminalHeight
    getTerminalWidth
    Color(..)
    ColorIntensity(..)
    bold'
    faint'
    black'
    red'
    green'
    yellow'
    blue'
    magenta'
    cyan'
    white'
    brightBlack'
    brightRed'
    brightGreen'
    brightYellow'
    brightBlue'
    brightMagenta'
    brightCyan'
    brightWhite'
    rgb'
2023-03-18 19:59:00 -10:00
Simon Michael
207cad0dfb ;doc: update changelogs 2023-03-18 01:43:05 -10:00
Simon Michael
5ddb6028ed ;dev: lib: cleanup 2023-03-16 21:52:37 -10:00
Simon Michael
5655c533fa ;doc: merge release changelogs 2023-03-16 17:45:43 -10:00
Simon Michael
0f63a35ea3 ;doc: update changelogs 2023-03-16 15:45:16 -10:00
Simon Michael
fe3477797b ;doc: update changelogs 2023-03-16 14:56:25 -10:00
Simon Michael
ee29893040 dev: fix Hledger.Utils.String import 2023-03-16 14:48:59 -10:00
Simon Michael
cc41704c92 ;doc: update changelogs 2023-03-16 14:44:50 -10:00
Simon Michael
d3e4f8547c imp: lib: Hledger.Utils.String: more string strippers
added:
strip1Char
stripBy
strip1By

Not used in hledger right now, but useful to offer in our scripting prelude.
2023-03-16 14:35:37 -10:00
Simon Michael
44805f96ef ;dev: ui, web: fixes for ghc 9.6; cleanup (#2011) 2023-03-15 20:43:51 -10:00
Simon Michael
658a650bb2 ;dev: lib: another Balancing fix after ghc 9.6 support (#2011) 2023-03-15 20:26:57 -10:00
Simon Michael
3932bafc78 ;cabal: update cabal files 2023-03-14 10:42:52 -10:00
Simon Michael
c790aa6145 ;dev: lib: also build with GHC 9.6.1; add base-compat 2023-03-14 10:42:48 -10:00
Simon Michael
9ceb74062d ;doc: update manuals 2023-03-11 13:28:02 -10:00
Simon Michael
f75110f49c ;cabal: update cabal files 2023-03-11 13:27:25 -10:00
Simon Michael
a0ca339c46 ;pkg: bump version to 1.29.99 2023-03-11 13:27:25 -10:00
Simon Michael
2e3872c3f1 ;doc: changelogs: 1.29 2023-03-11 13:26:30 -10:00
Simon Michael
6dc91588e4 fix: lib: avoid using pager on Windows, part 2 2023-03-10 20:58:11 -10:00
Simon Michael
b83eb136cc ;cabal: update cabal files 2023-03-10 19:14:30 -10:00
Simon Michael
41e838ef83 fix: lib: avoid using pager on Windows, the package is not supported 2023-03-10 19:14:13 -10:00
Simon Michael
56c38b1b29 fix: areg: handle an extra account query correctly (fix #2007) 2023-02-21 10:04:07 -10:00
Simon Michael
44400e840c dev: lib: clarify accountTransactionsReportItem 2023-02-21 09:47:59 -10:00
Simon Michael
7408bc02df lib: Hledger.Data.RawOptions: add unsetboolopt 2023-02-20 16:24:54 -10:00
Simon Michael
fa70f160ae imp: partial/inferred dates are flexible, full dates are not (#1982)
DateSpans are now now aware of exact/flexible dates.
2023-02-17 07:24:19 -10:00
Simon Michael
032ffd112b imp: cli: report intervals can now start on arbitrary dates
Eg, where previously -p 'monthly from 1/15' or -M -b 1/15 would always
adjust the report start date to 1/1,
unless you used the special -p 'every 15th day of month from 1/15' form,
now the start date will not be adjusted. (It is still adjusted if
the report date is not specified explicitly, eg inferred from the journal).

This keeps behaviour consistent between report periods and periodic transactions.

'in' period expressions, like 'in 2023-01', are a grey area; they
do specify a start date (2023-01-01), although they look a bit implicit.
So previously, -p 'weekly in 2023-01' would adjust the start date to
the preceding monday (2022-12-26), but now it will start exactly on
2023-01-01 (a sunday, which also causes ugly verbose column headings).

To ensure monday based weeks and simple report headings here,
you would have to explicitly specific a start date that is a monday,
eg -p 'weekly from 2022-12-26 to 2023-02'.
2023-02-17 07:24:19 -10:00
Simon Michael
5537a251f3 imp: journal: periodic txns need not start on an interval boundary
Eg, ~ monthly from 1/15 now works, instead of giving an error message.
2023-02-17 07:24:19 -10:00
Simon Michael
0c74744626 fix: test: fix periodic transaction pretty-printing (#1988) 2023-02-17 07:24:19 -10:00
Simon Michael
7a9b0fd94c feat: check: the tags check checks tag names 2023-02-16 11:56:22 -10:00
Simon Michael
614697acf7 feat: journal: tag directive declares tag names 2023-02-16 11:56:22 -10:00
Simon Michael
f4160d5397 ;doc: bump man page dates 2023-02-04 07:06:18 -10:00
Simon Michael
c51ebe7b8c imp: journal: remove the "adjacent conversion postings" check again
I find that single conversion postings are sometimes needed, eg with
paypal.
2023-02-01 13:30:21 -10:00
Simon Michael
9381b46004 fix: lib: fix terminal lightness detection 2023-01-27 16:51:05 -10:00
Simon Michael
79914cbe74 fix: cli: avoid showing color detection escape sequence when piped 2023-01-27 10:50:56 -10:00
Simon Michael
110711a2a2 fix: cli: restore workaround to avoid showing escape codes in emacs 2023-01-27 10:00:07 -10:00
Simon Michael
eed8a06906 fix: cli: don't highlight help when TERM=dumb 2023-01-27 06:06:17 -10:00
Simon Michael
bb5d473955 fix: lib: don't use $PAGER when TERM=dumb 2023-01-27 06:01:49 -10:00
Simon Michael
45808c8e13 imp: cli: add terminalLightness; tweak IsLight threshold; embolden banner 2023-01-26 22:11:20 -10:00
Simon Michael
3ae9a5e0bc ;cabal: update cabal files 2023-01-26 22:11:20 -10:00
Simon Michael
1da4fd1eaf imp: lib: terminal colour detection
added:
terminalIsLight
terminalFgColor
terminalBgColor
2023-01-26 22:11:20 -10:00
Simon Michael
0de3acabcb cabal: update cabal files 2023-01-25 19:16:08 -10:00
Simon Michael
4387e6ffb5 pkg: stack: bump to latest snapshots, depend on text-ansi, add extra deps 2023-01-25 19:15:45 -10:00
Simon Michael
de330bdfce imp: journal: check for adjacent conversion postings only in strict mode
This avoids breaking existing journals if, say, they happen to have
a single "equity:trading" posting somewhere.
2023-01-25 19:00:29 -10:00
Simon Michael
9c5bcfea85 dev: transactionInferCostsFromEquity: clarify partitionPs 2023-01-25 19:00:29 -10:00
Simon Michael
76f8eaf91a imp: journal: ignore redundant costs; --infer-costs more robustly
You can now write both @/@@ costs and corresponding equity conversion postings
in a transaction at any time, not just when using --infer-costs or --infer-equity.
hledger will recognise the redundancy and ignore it.

One thing has become more strict: hledger now requires conversion postings
to occur in adjacent pairs; an odd number of them is not allowed.
(Conversion postings are postings to accounts of type `V`/`Conversion`,
or named `equity:conversion`, `equity:trade`, `equity:trading`,
or subaccounts of these.)

And, --infer-costs now works in transactions with an implicit amount
(inferring costs from equity now happens after transaction balancing,
not before).
2023-01-25 19:00:29 -10:00
Simon Michael
7432769d3c lib: add journalMarkRedundantCosts to help with balancing; slight refactoring 2023-01-25 19:00:29 -10:00
Simon Michael
dd1ded3646 ;cabal: update cabal files 2023-01-25 17:25:34 -10:00
Simon Michael
d77d76e17f imp: cli: use $PAGER when help output is taller than terminal
This works with hledger, hledger -h and hledger CMD -h.
2023-01-25 17:20:27 -10:00
Chris Lemaire
43c9f018dc journal: Account directives reject account names with brackets
Previously, the accounts passed to account directives would be stripped
of their surrounding brackets, but the required behaviour is to have
account directives plain reject bracketed accounts. This change ensures
that accounts in account directives may not start with a bracket
character.
2023-01-24 13:40:01 -10:00
Simon Michael
9497472e64
Merge branch 'master' into 1984-source-name-and-position-for-forecast 2023-01-23 16:04:00 -10:00
Chris Lemaire
4ada2a3fbc journal: Fully unbracket AccountNames in account directives
Currently an account name like "a:(aa)" will not have (aa) unbracketed.
However, this seems reasonable since the full name is unbracketed and
thus will not be confused with virtual or virtual-balanced posting.
2023-01-23 12:43:13 -10:00
Chris Lemaire
9443fe0e0d journal: json: Add source positions to forecast transactions 2023-01-21 22:30:30 +01:00
Simon Michael
e5f3c0ecdb lib: transactionInferCostsFromEquity: adjust to "cost" terminology 2023-01-20 21:47:44 -10:00
Simon Michael
5ca8752e48 lib: journalBalanceTransactions, balanceTransactionHelper cleanups 2023-01-20 20:23:27 -10:00
Simon Michael
5b27554f0a dev: note why inferring costs from equity before balancing 2023-01-19 20:57:02 -10:00
Simon Michael
cf469c080d lib: journalInferCosts -> journalInferCostsFromEquity 2023-01-19 20:25:41 -10:00
Simon Michael
28eb8be4fa lib: BalancingOpts{infer_transaction_prices_ -> infer_balancing_costs_} 2023-01-19 20:21:31 -10:00
Simon Michael
c0950c0900 lib: Hledger.Data.Balancing: inferBalancingPrices -> transactionInferBalancingCosts 2023-01-19 09:36:12 -10:00
Simon Michael
7ecf7ef27b lib: Hledger.Data.Balancing: inferBalancingAmount -> transactionInferBalancingAmount 2023-01-19 09:28:30 -10:00
Simon Michael
402b4265f8 lib: Hledger.Data.Journal: transactionAddPricesFromEquity -> transactionInferCostsFromEquity 2023-01-19 09:22:55 -10:00
Simon Michael
dfea6eaee2 lib: Hledger.Data.Journal: journalAddPricesFromEquity -> journalInferCosts 2023-01-19 09:17:56 -10:00
Simon Michael
dfebf3174c imp: csv: check assigned account names are valid (parseable) (#1978) 2023-01-11 21:42:47 -10:00
Simon Michael
93f74f7a0e lib: Hledger.Data.Dates: intervalStartBefore -> intervalBoundaryBefore 2023-01-11 20:51:24 -10:00
Simon Michael
fc8fe8ee46 ;doc: update manuals 2023-01-10 23:34:47 -10:00
Simon Michael
e891eecb8b dev: add TypeOperators pragma to satisfy ghc 9.4 2023-01-10 19:33:31 -10:00
Simon Michael
a9b63bb694 fix: csv: skip header lines before attempting to parse records (#1967) 2022-12-27 12:21:20 -10:00
Simon Michael
71bd102b4b fix: journal: don't generate bad assertion when assigning with cost (fix #1965) 2022-12-26 10:21:44 -10:00
Simon Michael
0f2fe39e43 cabal: update cabal files 2022-12-22 20:32:03 -10:00
Simon Michael
d0eaa8cf5a dev: force megaparsec 9.3 in stack build plans where supported
For the useful dbg tool.
2022-12-22 20:31:47 -10:00
Simon Michael
4b36d852b4 imp: journal: ignore ((valuation expressions)) after amounts (ledger compat) 2022-12-22 20:06:28 -10:00
Simon Michael
3b91a8475a cabal: update cabal files 2022-12-22 19:26:16 -10:00
Simon Michael
e9e8f350f2 dev: require megaparsec 9.3+ in dev build, for its useful dbg tool
The 9.3 version works with our parsers.
2022-12-22 19:25:57 -10:00
Simon Michael
1ea2bcc83f imp: journal: also parse (lot notes) in amounts (ledger compat)
and rename lotpricep -> lotcostp
and instrument some amount parsers for debugging with megaparsec's dbg
2022-12-22 19:07:40 -10:00
Simon Michael
aa54c3273a dev: lib: clarify some amount parsers; describe Ledger lot notation
amountpwithmultiplier -> amountp'
amountpnolotpricesp   -> amountnobasisp
amountwithoutpricep   -> simpleamountp
priceamountp          -> costp
2022-12-22 09:15:43 -10:00
Simon Michael
b1e08ffe46 imp: journal: python directive also consumes empty lines (ledger compat) 2022-12-22 02:30:29 -10:00
Simon Michael
e2ddf1e685 imp: add "since" as a synonym of "from" in period expressions (ledger compat) 2022-12-22 02:12:25 -10:00
Simon Michael
85e9fbcf7d imp: journal: allow an empty double-quoted commodity symbol
"" is equivalent to writing no symbol.
But it's now possible to declare market prices for the no-symbol
commodity, which occurs eg with timedot data.

P 2022-01-01 "" $100
2022-12-22 01:53:06 -10:00
Simon Michael
a070875fe6 imp: journal: ignore end apply year, end apply tag, drop "pop" (ledger compat) 2022-12-22 01:50:27 -10:00
Simon Michael
a5d6b42322 imp: journal: ignore end apply fixed, end apply tag directives (ledger compat) 2022-12-22 01:12:56 -10:00
Simon Michael
af5645ebb7 imp: journal: ignore python, eval directives (ledger compat) 2022-12-22 00:50:43 -10:00
Simon Michael
2e77586d1b imp: journal: ignore value directives (ledger compat) 2022-12-22 00:38:51 -10:00
Simon Michael
fb7134c9a0 imp: journal: ignore tag subdirectives (ledger compat) 2022-12-22 00:34:33 -10:00
Simon Michael
c58b9e6ac9 imp: journal: accept apply year as another synonym for Y (ledger compat) 2022-12-22 00:27:35 -10:00
Simon Michael
2357a7a750 dev: journal: ignore CLI flags in journal 2022-12-21 23:40:43 -10:00
Simon Michael
abd104ccee imp: journal: ignore more ledger directives (ledger compat)
apply fixed, apply tag, assert, bucket, A, capture, check, define, expr

And reorder the directivep parsers.
2022-12-21 23:04:58 -10:00
Simon Michael
e09ab0936a imp: journal: accept @ as a prefix of directives (ledger compat) 2022-12-21 22:56:32 -10:00
Simon Michael
95d7679f6d imp: journal: accept year as a synonym for Y (ledger compat) 2022-12-21 22:27:08 -10:00
Simon Michael
826a7cfb2a imp: journal: ignore payee subdirectives 2022-12-21 22:09:15 -10:00
Simon Michael
bf6a2a7ccf imp: journal: ignore commodity subdirectives other than format 2022-12-21 22:08:54 -10:00
Simon Michael
b73916323a ;dev: note transaction price deprecation in haddock 2022-12-10 19:01:48 -10:00
Simon Michael
ace185f7d2 ;doc: update old manual links 2022-12-10 18:56:47 -10:00
Simon Michael
b50d60cfea ;doc: csv, timeclock, timedot: clarify comment lines (#1953) 2022-12-06 10:38:50 -10:00
Simon Michael
f3b0a1f513 ;doc: update manuals 2022-12-01 12:24:23 -08:00
Simon Michael
8da21f1195 ;cabal: update cabal files 2022-12-01 12:23:10 -08:00
Simon Michael
740ea50e4c ;pkg: bump version to 1.28.99 2022-12-01 12:23:10 -08:00
Simon Michael
cbbfb82474 doc: 1.28 changelog headings 2022-12-01 12:21:09 -08:00
Simon Michael
fa8f6ae302 lib: Debug: breakpoint doesn't support windows yet, drop for now 2022-12-01 12:20:29 -08:00
Simon Michael
d76e47b586 ;doc: update changelogs 2022-11-30 17:13:09 -05:00
Felix Yan
66b51472f2 Allow megaparsec 9.3
Builds fine and all tests pass.
2022-11-30 05:12:04 -05:00
Simon Michael
5283c280bf ;cabal: update cabal files 2022-11-26 00:13:02 -05:00
Simon Michael
3a6955d3e2 dev: add stack9.4.yaml for building with latest nightly/ghc 9.4.3 2022-11-25 23:45:17 -05:00
Simon Michael
4399076a0a ;doc: lib: update BalanceAssertion doc 2022-11-10 19:01:53 -10:00
Simon Michael
6d2687e67d fix: debug logging: fix non-logging ptrace*IO, dbg*IO 2022-11-07 14:50:13 -10:00
Simon Michael
b0966adc93 dev: debug logging: ".log" suffix instead of ",logging"; improve docs 2022-11-06 09:01:12 -10:00
Simon Michael
78771e900b dev: lib: support debug logging to file in a few more places for hledger-ui 2022-11-06 09:01:12 -10:00
Simon Michael
9a8a8a75a2 imp: ui: start on balance sheet screen: better initial screen stack 2022-11-06 07:59:45 -10:00
Simon Michael
b079bbdb4e dev: lib: Hledger.Utils cleanup 2022-11-04 22:19:24 -10:00
Simon Michael
79047ccc43 dev: lib: consolidate some utils in Hledger.Utils.IO 2022-11-04 19:14:36 -10:00
Simon Michael
fc8aa5253a dev: lib: Hledger.Utils.Print -> Hledger.Utils.IO 2022-11-04 18:39:31 -10:00
Simon Michael
6fcd85aac3 dev: lib: Hledger.Utils cleanup, explicit exports 2022-11-04 12:59:10 -10:00
Simon Michael
80249c3e8a dev: lib: Utils cleanups 2022-11-04 09:51:25 -10:00
Simon Michael
5bc977442a dev: lib: remove NOINLINE pragmas HLS doesn't complain about 2022-11-03 17:58:32 -10:00
Simon Michael
0608a76243 dev: lib: extract progArgs, minimise unsafe IO
It is exported from the increasingly-inaccurately-named
Hledger.Utils.Print for now.
2022-11-03 17:58:13 -10:00
Simon Michael
80eb461063 ;doc: update manuals 2022-11-03 16:07:55 -10:00
Simon Michael
988c164ec8 imp: debug logging improvements; hledger-ui logs to hledger-ui.log only
Hledger.Utils.Debug's "trace or log" functions are now controlled as
follows: to enable logging, append ",logging" to the program name at
startup (using withProgName). This also works when running in GHCI.
And they log to PROGNAME.log, not debug.log.

All (hopefully) debug logging in the hledger packages is now "trace or
log" capable.

This means that hledger-ui should now log all debug output to
./hledger-ui.log, with none of it appearing on the console.
2022-11-03 16:07:54 -10:00
Simon Michael
3d26fc30eb ;doc: update changelogs 2022-10-31 13:18:36 -10:00
Simon Michael
603fae70c0 dev: lib: clean up/simplify debug helpers 2022-10-31 11:26:11 -10:00
Simon Michael
fbd2ed5a44 ;cabal: update cabal files 2022-10-29 13:04:58 -10:00
Simon Michael
ddb3ea777e imp: lib: move hledger-specific things out of Hledger.Utils.Debug
Moved from Hledger.Utils.Debug to Hledger.Utils.Parse:
traceParse
traceParseAt
dbgparse
2022-10-29 13:04:47 -10:00
Simon Michael
fd82fa48c9 imp: lib: separate Hledger.Utils.Print
Moved from Hledger.Utils.Debug to Hledger.Utils.Print:
pshow
pshow'
pprint
pprint'
colorOption
useColorOnStdout
useColorOnStderr
outputFileOption
hasOutputFile
2022-10-29 12:39:46 -10:00
Simon Michael
7fd25809e8 dev: fix customErrorBundlePretty import warnings 2022-10-07 07:43:28 -10:00
Simon Michael
a759a6e02e dev: lib: note changed cost handling in amount arithmetic 2022-10-07 06:34:34 -10:00
Simon Michael
3a4f23df95 imp: lib: Hledger.Data.Amount: showMixedAmountOneLine now shows costs 2022-10-07 06:34:34 -10:00
Simon Michael
de5a97600c imp: lib: Hledger.Read.Common: rename/add amount parsing helpers
removed:
 amountp'
 mamountp'

added:
 parseamount
 parseamount'
 parsemixedamount
 parsemixedamount'
2022-10-07 06:34:34 -10:00
Simon Michael
82a503cbf5 imp: lib: Hledger.Utils.Parse: export customErrorBundlePretty
for pretty-printing hledger parse errors.
2022-10-07 06:34:34 -10:00
Simon Michael
33dba1945d dev: lib: Text.Megaparsec.Custom notes 2022-10-07 06:34:34 -10:00
Simon Michael
01387548e7 feat: csv: intra-day-reversed compensates when days' txns are reversed
As in eg vanguard CSV.
2022-10-06 22:21:55 -10:00
Simon Michael
15b2e7d586 fix: csv: ignore extra whitespace in account rule when detecting virtual postings
Reported by CruxOfTheB in chat.
2022-10-03 07:50:23 -10:00
Simon Michael
928cc6d615 ;doc: update manuals 2022-10-01 16:09:26 -10:00
Simon Michael
3b24d9465b imp: csv: new timezone rule; convert zoned date-times to local dates (#1936)
Previously, CSV date-times with a different time zone from yours
(with or without explicit timezones in the CSV) could give off-by-one
dates, because the CSV timezone was ignored.

Now,

1. you can use the `timezone` rule to indicate which other
   timezone a CSV is implicitly using

2. CSV date-times with a timezone - whether declared by rule or
   parsed with %Z - are localised to the system time zone
   (or another set with the TZ environment variable).
2022-10-01 14:50:35 -10:00
Simon Michael
130604a2e0 ;cabal: update cabal files; migrate to hpack 0.35/stack 2.9 2022-09-19 18:23:26 -10:00
Simon Michael
a3c2e2c1ba doc: changelogs 2022-09-18 10:02:25 -10:00
Simon Michael
a2be9a0bce ;doc: update changelogs 2022-09-18 08:28:03 -10:00
Simon Michael
0a501941ee dev: lib: ReportTypes: hlint fix 2022-09-14 16:57:54 -10:00
Simon Michael
5c14ed2ec9 dev: lib: clarify dlogAt's doc 2022-09-10 12:44:21 -10:00
Simon Michael
bc810063a5 dev: lib: improve ReportSpec doc 2022-09-07 09:53:11 -10:00
Simon Michael
427005037e cabal: update cabal files 2022-09-01 18:37:57 -07:00
Simon Michael
e5bb4f0b66 ;pkg: bump version to 1.27.99 2022-09-01 18:37:40 -07:00
Simon Michael
38ce19847b doc: update changelogs 2022-09-01 18:36:39 -07:00
Simon Michael
7631d0efa0 ;doc: update manuals 2022-09-01 18:36:34 -07:00
Simon Michael
651d584bb0 ;doc: update changelogs 2022-09-01 15:48:46 -07:00
Simon Michael
6d45630014 dev: lib: fix recently broken doctest 2022-08-29 11:15:35 +01:00
Simon Michael
79792b3368 cabal: update cabal files 2022-08-29 11:15:35 +01:00
Simon Michael
ab01c7c2a2 lib: re-enable doctests with ghc 8.10, to improve CI test 2022-08-29 11:09:16 +01:00
Simon Michael
b46cb8a7f7 cabal: update cabal files 2022-08-23 12:16:25 +01:00
Simon Michael
bfb632dd8e dev: lib: Hledger.Data.Amount: drop amount, use nullamt always 2022-08-23 12:16:15 +01:00
Simon Michael
c80c72d7cd dev: lib, cli, bin: enable/fix name shadowing warnings
And a few other cleanups.
2022-08-23 12:16:15 +01:00
Simon Michael
e5578e5c4e ;cabal: update cabal files 2022-08-23 02:02:19 +01:00
Simon Michael
9584ebb439 imp: lib: Hledger.Utils.Debug: re-export Debug.Breakpoint
And add breakpoint as a dependency and enable its GHC plugin in all
the hledger packages, so that breakpoint's helpers can be used easily.
2022-08-23 02:02:19 +01:00
Simon Michael
6a4680d561 imp: pkg: drop support for GHC 8.6 and 8.8
Slightly motivated by a desire to depend on the new breakpoint
library, which requires GHC 8.10+. With GHC 9.0 in Debian,
it seems time to drop these.
2022-08-23 02:02:19 +01:00
Simon Michael
b7b09f991a imp: lib: Hledger.Utils.Debug: fix debug logging to file
dlog has been replaced by more reliable functions for debug-logging
to a file, useful for debugging TUI apps like hledger-ui:
dlogTrace
dlogTraceAt
dlogAt
dlog0
dlog1
dlog2
dlog3
dlog4
dlog5
dlog6
dlog7
dlog8
dlog9

Monochrome pprint' and pshow' have been added.

New dependency: deepseq
2022-08-23 00:50:51 +01:00
Simon Michael
423f3bd155 ;doc: update manuals 2022-08-22 07:59:02 +01:00
Stephen Morgan
c966a0f413 fix!: cbr: Remove old account type query code. (#1921)
This replaces the old journal*AccountQuery with the new Type query. This
enables uniform treatment of account type, and fixes a subtle bug
(#1921).

Note that cbcsubreportquery no longer takes Journal as an argument.
2022-08-21 08:27:51 +01:00
Simon Michael
b32b130045 dev: lib: fix a failing doctest 2022-08-18 05:08:10 +01:00
Simon Michael
101e2f7426 imp: add a missing space after colon in some debug output 2022-08-16 09:13:30 +01:00
Simon Michael
3003a18c94 dev: lib: hlint improvements 2022-08-16 09:13:30 +01:00
Simon Michael
a3096d0549 dev: journalFilePath, include: show (unknown) instead of nothing
Probably not user-visible, but might improve debug logging slightly.
2022-08-16 09:13:30 +01:00
Simon Michael
1f08a8a94e fix: fix multi-file account display order; improve file read logging (#1909) 2022-08-16 09:13:30 +01:00
Simon Michael
07e3dca735 imp: at --debug 5, log account declarations info while parsing (#1909) 2022-08-16 09:13:30 +01:00
Simon Michael
3d6e363461 lib: save account directive positions, for troubleshooting (#1909) 2022-08-16 09:13:30 +01:00
Simon Michael
b46aa1330f fix: don't reverse account display order with include files (#1909) 2022-08-05 13:44:56 +01:00
Simon Michael
09d66c5fc1 fix: account display order is now tracked across all files (fix #1909) 2022-08-04 19:05:52 +01:00
Simon Michael
7063eba13c fix: bal: budget goal amounts now respect -c styles (fixes #1907) 2022-08-03 17:43:04 +01:00
Simon Michael
229fe6ac58 fix: areg, ui: show transactions normally with a type: query (#1905)
accountTransactionsReport was not account types-aware.
There might be more of these lurking.
2022-08-03 10:38:42 +01:00