Commit Graph

960 Commits

Author SHA1 Message Date
Stephen Morgan
3969eb2679 lib!: lib,cli,ui,web: For accountTransactionsReport, generate the overall
reportq from the ReportSpec, rather than being supplied as a separate
option.

This is the same approach used by the other reports, e.g. EntryReport,
PostingReport, MultiBalanceReport. This reduces code duplication, as
previously the reportq had to be separately tweaked in each of 5
different places.

If you call accountTransactionreport, there is no need to separately
derive the report query.
2021-07-22 19:00:37 -10:00
Simon Michael
6569c2aca7 ;doc: update changelogs 2021-07-20 22:24:39 -10:00
Simon Michael
9aac520edd deps: allow megaparsec 9.1 2021-07-20 20:38:39 -10:00
Simon Michael
a83c2f6950 ;cln: ui: clarify watch loop 2021-07-20 20:38:39 -10:00
Simon Michael
87f575e643 ref: bal: rename some report types to clarify/sync with docs
ReportType -> BalanceCalculation
 ChangeReport -> CalcChange
 BudgetReport -> CalcBudget
 ValueChangeReport -> CalcValueChange

BalanceType -> BalanceAccumulation
 PeriodChange -> PerPeriod
 CumulativeChange -> Cumulative
 HistoricalBalance -> Historical

ReportOpts:
 reporttype_ -> balancecalc_
 balancetype_ -> balanceaccum_

CompoundBalanceCommandSpec:
 cbctype -> cbcaccum

Hledger.Reports.ReportOptions:
 balanceTypeOverride -> balanceAccumulationOverride
2021-07-15 14:22:20 -10:00
Simon Michael
f54e645dbf test: ui: outliner tip 2021-07-15 09:57:16 -10:00
Stephen Morgan
5f53da87e0 fix: ui: Make sure that you can scroll between matching transactions in
TransactionScreen. (#1607)

Make sure that the previous register screen is updated whenever we
scroll in TransactionScreen.
2021-07-15 09:46:56 -10:00
Simon Michael
8d68193c88 ;fix: doc: info: avoid directory paths in directory metadata (#1594)
In each info manual's DIR-ENTRY metadata, it's best to use just the
filename, with no subdirectory. This should facilitate working info
manuals in packaged versions of hledger, eg in nix.

I don't remember the detail of why I added those and I'm not going to
spend a couple of hours retesting; hopefully no other significant
workflows will be affected.

I have left the subdirectory paths in the dir file - this is intended
for hledger developers and they hopefully don't cause a problem there.
2021-07-14 09:07:56 -10:00
Simon Michael
964a019368 ;doc: changelogs: minor release headings 2021-07-13 18:39:43 -10:00
Simon Michael
1f9d89879d ;doc: update changelogs 2021-07-13 18:39:40 -10:00
Simon Michael
ce526305bf ;test: ui: transaction: add a test for up/down key (#1607) 2021-07-13 12:34:25 -10:00
Simon Michael
b8f0900edb ;dev: doc: update manuals 2021-07-12 18:50:06 -10:00
Simon Michael
68e7ff4644 ;doc: finalise changelogs 2021-07-03 14:51:51 -10:00
Simon Michael
52ebfb3dce ;doc: changelog edits 2021-07-03 11:45:50 -10:00
Simon Michael
4971b106ef ;doc: changelog edits 2021-07-02 16:10:56 -10:00
Simon Michael
d5d19f8419 ;update manuals 2021-07-02 12:42:34 -10:00
Stephen Morgan
55f42c3d1e ui: Do not reset cost and value flags on reload. 2021-07-02 10:07:03 +10:00
Stephen Morgan
307bd9366d ui: In TransactionScreen, set the current transaction and index in
tsInit based on the previous RegisterScreen. Use the RegisterScreen
logic for selecting the new transaction when we cannot find the existing
one.

This enables us to get rid of regenerateTransactions. There is now
different behaviour in the transaction screen when the journal is
reloaded and the transaction being viewed is no longer available, but I
have not been able to find an example which exhibits this different
behaviour. I think it is better to have consistent behaviour between the
register screen and transaction screen when determining which to select.

This corrects a bug where you had to reload twice to reset the valuation
and cost flags, due to the elimination of regenerateTransactions.
2021-07-02 10:07:03 +10:00
Stephen Morgan
613efba1bc ui: Do not log to debug.log when regenerating journal in Transaction
screen (#1556). Also really clear cost setting when doing so.

Since plog is no longer used anywhere, and tends to create bugs when it
is, we remove it.
2021-06-30 16:07:32 -10:00
Simon Michael
43a909f824 doc: changelogs draft
And add big headings, for fun and to help me tell them apart.
2021-06-30 15:30:57 -10:00
Simon Michael
2f56368647 ;update manuals 2021-06-28 22:39:06 -10:00
Simon Michael
26bc5e6df3 ;update cabal files 2021-06-28 22:38:12 -10:00
Simon Michael
544450f557 ;bump version to 1.22 2021-06-28 22:37:47 -10:00
Simon Michael
fc62cebd10 ;update manuals 2021-06-27 21:47:33 -10:00
Simon Michael
6cd565a511 ;doc: fix dir entry paths so they work both in info and emacs (#1585) 2021-06-27 21:45:48 -10:00
Simon Michael
2d87298a68 ;doc: slightly simplify dir entries, use higher-level texinfo format (#1585) 2021-06-27 21:24:51 -10:00
Simon Michael
7c12c1eb00 ;update manuals 2021-06-27 19:36:52 -10:00
Simon Michael
eae4922d12 doc: info directory entries: fixes, cleanup (#1585) 2021-06-27 17:26:00 -10:00
Simon Michael
945834bff3 ;update manuals 2021-06-27 17:01:59 -10:00
Simon Michael
1c9a7f1bc4 doc: make hledger manuals show up in Info's directory
This continues the work begun by #1585. It moves each info manual's
directory metadata to the top of the file, where it needs to be.
I couldn't see a way to do this with pandoc/makeinfo, so the Shake
recipe prepends it from a separate file.

With this metadata in place, the hledger info manuals can be added to
an Info dir file using install-info. Eg:

$ install-info hledger/hledger.info /usr/local/share/info/dir
$ info

Secondly, the Shake "manuals"/"infomanuals" recipes now also generate
an Info dir file in each package directory, so you can also just add
the package directories to your INFOPATH. Eg:

$ export INFOPATH=~/src/hledger/hledger:~/src/hledger/hledger-ui:~/src/hledger/hledger-web:$INFOPATH
$ info
2021-06-27 17:01:59 -10:00
Damien Cassou
a9dd54d7b4 ;update manuals 2021-06-27 15:11:29 -10:00
Damien Cassou
f5633199dc ;doc: add DIR section to hledged.m4.md for the info file (#806)
This is used by `install-info` to generate an entry in the info
directory.
2021-06-27 15:11:29 -10:00
crocket
5725fb8ab7 Improve editor support
Documentation for editFileAtPositionCommand is made more
precise.

This commit makes it possible for hledger-ui to open
a file at the last line on emacs and kakoune.

It also prevents hledger-ui from opening an editor with
imprecise arguments. Passing imprecise arguments to editors
can cause undefined behaviors in editors.

I tested it with emacs(client), nano, vscode, kakoune,
nvim, and vis.
2021-06-16 14:11:36 -10:00
Simon Michael
6df8b6d46e ;ui: editFileAtPositionCommand doc tweaks (#1572) 2021-06-15 17:37:00 -10:00
crocket
aa0a8d079b Add support for kakoune editor 2021-06-15 17:24:35 -10:00
Simon Michael
a4db52aa05 ;update manuals 2021-06-15 06:24:25 -10:00
Simon Michael
665fec83cd
Merge pull request #1560 from Xitian9/rationalisevaluation
Clean up valuation functions, and make clear which to use where.
2021-06-07 19:02:44 -10:00
Stephen Morgan
0f1837816d lib,cli,ui,web: Add check balancednoautoconversion command, which checks that
transactions are balanced possibly using explicit prices, but without
inferring any prices. This is included in --strict mode.

Renames check autobalanced to check balancedwithautoconversion.
2021-06-07 18:58:58 -10:00
Stephen Morgan
68e975adf1 lib,cli,ui,web: Remove unused LANGUAGE pragmas. 2021-06-07 17:33:54 -10:00
Stephen Morgan
c87290e5f5 ui: Remove unnecessary CPP when dropping support for GHC 8.4. 2021-06-07 17:33:54 -10:00
Stephen Morgan
55308e1ca8 lib,cli,ui,web: Remove unnecessary CPP when dropping support for GHC 8.2. 2021-06-07 17:33:54 -10:00
Stephen Morgan
56e87f934c ui: Use Text instead of String in RegisterScreen. 2021-06-03 23:23:54 -10:00
Simon Michael
b681cde62d ;update cabal files 2021-06-03 14:08:47 -10:00
Simon Michael
58b481ca5b stack: updated tested-with to 8.6+ 2021-06-03 14:07:39 -10:00
Stephen Morgan
bf063e4538 cli,ui,web: Display full git description in --version report if able.
Remove unused prognameanddetailedversion code branches.
2021-06-02 19:46:18 -10:00
Simon Michael
6a3019c5a8 ;update manuals 2021-05-18 10:51:03 -10:00
Simon Michael
d3b20675d0 tools: really regenerate the cabal files with stack's hpack
hpack has dropped the hash at last, this should help a lot to reduce
edit conflicts and commit noise.
2021-05-14 16:14:06 -10:00
Simon Michael
17b241eb64 ui: don't write debug.log when toggling V (#1556) 2021-05-14 11:38:14 -10:00
Simon Michael
41c8e1f6ef ;regen cabal files with latest stack's hpack (0.34.4) 2021-05-14 08:17:56 -10:00
Stephen Morgan
53611be6e9 lib,ui: Do all cost conversion and price stripping in journalSelectingAmountFromOpts. 2021-05-07 21:51:15 +10:00
Stephen Morgan
5e7b69356f lib: Change internal representation of MixedAmount to use a strict Map
instead of a list of Amounts. No longer export Mixed constructor, to
keep API clean (if you really need it, you can import it directly from
Hledger.Data.Types). We also ensure the JSON representation of
MixedAmount doesn't change: it is stored as a normalised list of
Amounts.

This commit improves performance. Here are some indicative results.

hledger reg -f examples/10000x1000x10.journal
- Maximum residency decreases from 65MB to 60MB (8% decrease)
- Total memory in use decreases from 178MiB to 157MiB (12% decrease)

hledger reg -f examples/10000x10000x10.journal
- Maximum residency decreases from 69MB to 60MB (13% decrease)
- Total memory in use decreases from 198MiB to 153MiB (23% decrease)

hledger bal -f examples/10000x1000x10.journal
- Total heap usage decreases from 6.4GB to 6.0GB (6% decrease)
- Total memory in use decreases from 178MiB to 153MiB (14% decrease)

hledger bal -f examples/10000x10000x10.journal
- Total heap usage decreases from 7.3GB to 6.9GB (5% decrease)
- Total memory in use decreases from 196MiB to 185MiB (5% decrease)

hledger bal -M -f examples/10000x1000x10.journal
- Total heap usage decreases from 16.8GB to 10.6GB (47% decrease)
- Total time decreases from 14.3s to 12.0s (16% decrease)

hledger bal -M -f examples/10000x10000x10.journal
- Total heap usage decreases from 108GB to 48GB (56% decrease)
- Total time decreases from 62s to 41s (33% decrease)

If you never directly use the constructor Mixed or pattern match against
it then you don't need to make any changes. If you do, then do the
following:

- If you really care about the individual Amounts and never normalise
  your MixedAmount (for example, just storing `Mixed amts` and then
  extracting `amts` as a pattern match, then use should switch to using
  [Amount]. This should just involve removing the `Mixed` constructor.
- If you ever call `mixed`, `normaliseMixedAmount`, or do any sort of
  amount arithmetic (+), (-), then you should replace the constructor
  `Mixed` with the function `mixed`. To extract the list of Amounts, use
  the function `amounts`.
- If you ever call `normaliseMixedAmountSquashPricesForDisplay`, you can
  replace that with `mixedAmountStripPrices`. (N.B. this does something
  slightly different from `normaliseMixedAmountSquashPricesForDisplay`,
  but I don't think there's any use case for squashing prices and then
  keeping the first of the squashed prices around. If you disagree let
  me know.)
- Any remaining calls to `normaliseMixedAmount` can be removed, as that
  is now the identity function.
2021-05-01 09:45:29 -10:00
Stephen Morgan
dd5773253b ui: For account screen, if the accounts and amounts are too wide, allocate space proportionally. 2021-04-14 14:18:24 -10:00
Stephen Morgan
203b12bfd9 ui: In account screen, elide amounts which go past the specified width.
Also leave at least 15 spaces width for account names.
2021-04-14 14:18:24 -10:00
Simon Michael
25322e489e ui: add tests for query filtering (#1523) 2021-04-12 12:58:51 -10:00
Simon Michael
bd41d1bd11 ui: tests: clean up, update for #1468 2021-04-12 12:47:50 -10:00
Simon Michael
dbe7ef0157 ui: setFilter: note error-ignoring behaviour 2021-04-12 12:06:11 -10:00
Simon Michael
b13df845c0 ui: register: fix queries, broken in 1.21 (#1523) 2021-04-12 12:05:35 -10:00
Simon Michael
4578d5d329 ui: work around ghc 9.0 build failure (#1503)
Also remove obsolete shebang line.
2021-04-06 07:45:49 -10:00
Simon Michael
eb2da22f63 ;update cabal files 2021-04-04 08:03:57 -10:00
Simon Michael
ba1e91c302 drop support for GHC 8.0
Prior to this commit,
- hledger still builds with GHC 8.0
- hledger-ui does if you use the build plan specified by stack8.0.yaml,
  but you are likely to hit problems if you let cabal pick one
  (https://github.com/jtdaugherty/vty/issues/198 and others)
- hledger-web might, if you could find the right build plan

The hassles are enough and GHC 8.0 is old enough (first released in
2016) that I'm letting it go; 8.2 is the new minimum version for all
hledger packages.

This allows a bunch of cleanups to conditional imports, which I leave
for later.

Also, updated the tested-with minor versions.
2021-04-04 07:54:22 -10:00
Simon Michael
d0940bf8ce ;update cabal files 2021-03-29 08:19:54 -07:00
Simon Michael
4e644840bc lib, etc: add now-required lower bound on containers (#1514) 2021-03-29 08:19:28 -07:00
Stephen Morgan
4609e79f2c lib,cli,ui,web: A number of AccountName and Journal functions which are
supposed to produce unique sorted use Sets internally to be slightly
more efficient. There is also a new function journalCommodities.
2021-03-23 11:26:30 -07:00
Simon Michael
d87751ef2e ;doc: ui, web: make image paths absolute 2021-03-21 09:10:50 -07:00
Simon Michael
d5a227f18c ;doc: ui, web, contributing: fix image urls 2021-03-21 07:45:37 -07:00
Simon Michael
7fad876014 ;update manuals 2021-03-18 07:22:42 -07:00
Stephen Morgan
d6a4310d8f lib,cli,ui,bin: Eliminate all uses of Mixed outside of Hledger.Data.Amount.
Exceptions are for dealing with the pamount field, which is really just
dealing with an unnormalised list of amounts.

This creates an API for dealing with MixedAmount, so we never have to
access the internals outside of Hledger.Data.Amount.

Also remove a comment, since it looks like #1207 has been resolved.
2021-03-18 09:47:59 +11:00
Simon Michael
ae57e76cb3 ;update cabal files 2021-03-12 06:59:30 -08:00
Simon Michael
36cbc2b068 bump base upper bound to allow GHC 9.0 2021-03-12 06:58:46 -08:00
Simon Michael
5573538fdc ;update cabal files 2021-03-10 13:50:50 -08:00
Simon Michael
e050790d4c ;bump version to 1.21.99 2021-03-10 13:50:49 -08:00
Simon Michael
5cdbd04974 ;finalise manuals 2021-03-10 11:12:06 -08:00
Simon Michael
532a4622ac ;finalise changelogs 2021-03-10 11:10:13 -08:00
Simon Michael
00beaf1423 ;update cabal files 2021-03-10 08:24:59 -08:00
Simon Michael
eeddfc2509 ;bump version to 1.21 2021-03-10 08:24:58 -08:00
Simon Michael
f82bdb15e4 ;update changelogs 2021-03-10 08:24:12 -08:00
Simon Michael
269b25bc8d doc: edited changelogs 2021-03-09 09:31:28 -08:00
Simon Michael
faf68f3def ;doc: bump changelogs to latest revision 2021-03-08 15:16:54 -08:00
Simon Michael
ec4d131d22 ;doc: cherry pick recent edited changelogs from 1.21-branch 2021-03-08 15:15:57 -08:00
Simon Michael
325aa15f74 ;doc: restore changelogs up to a5f9f8ce0 2021-03-08 15:14:47 -08:00
Simon Michael
54b95af9ff ;doc: merge 1.20.3, 1.20.4 changelogs from 1.20-branch 2021-03-08 15:12:39 -08:00
Simon Michael
ffb985f1a2 ui, web: make --man and --info work, similar to hledger
(cf #1410)
2021-03-03 05:57:31 -08:00
Simon Michael
f7bbb39a77 ;regenerate cabal files with the hpack version in current stack
To minimise warnings. They got regenerated by a commit for #1471.
2021-02-18 13:42:40 -08:00
Simon Michael
b92a842728 ;update manuals 2021-02-17 12:07:23 -08:00
Arnout Engelen
ad2ab3c823 Make sure to round up for the 'to' date 2021-02-17 09:05:13 -08:00
Simon Michael
d865ec5d65 lib: refactor: more consistent amount precision helpers
Hledger.Data.Amount:
renamed:
setAmountPrecision -> amountSetPrecision
setFullPrecision -> amountSetFullPrecision
setMixedAmountPrecision -> mixedAmountSetPrecision
added:
mixedAmountSetFullPrecision
2021-02-05 16:09:49 -08:00
Simon Michael
2a4170dd3b ui: transaction: show all decimal places (like print, cf #931)
On the accounts screen and register screen we round amounts according
to commodity styles, but when you drill down to a transaction you
probably want to see the unrounded amounts.
2021-02-04 08:13:55 -08:00
Stephen Morgan
c9eb7d1bcf lib,cli,ui: Separate costing from valuation; each can now be specified
independently.

You can now combine costing and valuation, for example "--cost
--value=then" will first convert to costs, and then value according to
the "--value=then" strategy. Any valuation strategy can be used with or
without costing.

If multiple valuation and costing strategies are specified on the
command line, then if any of them include costing
(-B/--cost/--value=cost) then amounts will be converted to cost, and for
valuation strategy the rightmost will be used.

--value=cost is deprecated, but still supported and is equivalent to
--cost/-B. --value=cost,COMM is no longer supported, but this behaviour can be
achieved with "--cost --value=then,COMM".
2021-01-28 13:57:48 -08:00
Stephen Morgan
130739e3ef lib,cli,ui: Introduce *ApplyCostValuation functions, which perform both
costing and valuation.

This currently is given a dummy NoCost argument and is equivalent to
"maybe id (*ApplyValuation ...)", but provides a constant interface so
that internal behaviour can be changed freely.
2021-01-28 13:57:48 -08:00
Simon Michael
507648383d ui: register: show all txns in/under an account at depth limit (#1468)
As in 1.19. This was broken since 2020-09-02 c45663d41.
2021-01-24 09:54:18 -08:00
Simon Michael
2e5ac08b69 ;ui: add a manual test for #1468 2021-01-23 17:04:51 -08:00
Stephen Morgan
83110e8820 lib,cli: Extend AtThen valuation to all report types.
Also adds a postingDate argument to amountApplyValuation, and re-orders
the ValuationType and (Transaction/Posting) arguments to
(transaction/posting)ApplyValuation, to be consistent with
amountApplyValuation.
2021-01-05 14:42:09 -08:00
Stephen Morgan
7d3cf1747a lib: Make consistent naming scheme for showMixedAmount* functions,
add conversion between old API and new API in the documentation.
2021-01-02 15:08:09 +11:00
Stephen Morgan
e4e533eb9f lib,cli,ui: Replace some uses of String with Text, get rid of some unpacks, clean up showMixed options. 2021-01-02 15:08:09 +11:00
Stephen Morgan
13c111da73 lib,cli,ui: Use WideBuilder for Tabular.AsciiWide.
Move WideBuilder to Text.WideString.
2021-01-02 15:08:09 +11:00
Stephen Morgan
b9c00dce61 lib,cli,ui: Implement all showMixed* functions in terms of DisplayAmountOpts and WideBuilder. 2021-01-02 15:08:09 +11:00
Stephen Morgan
e3ec01c3c6 lib,cli,ui: Use Text for showDate and related. 2021-01-02 15:08:09 +11:00
Stephen Morgan
74b296f865 lib,cli: Make showTransaction return Text rather than String. 2021-01-02 15:08:09 +11:00
Stephen Morgan
7e44b89bb4 lib: Remove unused label on TranspactionReport and AccountTransactionsReport. 2021-01-02 15:08:09 +11:00
Stephen Morgan
5752f1c5cb lib,cli: Use Text Builder for Account Transaction Reports. 2021-01-02 15:08:09 +11:00