Commit Graph

1991 Commits

Author SHA1 Message Date
Stephen Morgan
7aa3d3e760 lib,cli: Some efficiency improvements in register reports.
Strip prices after valuing postings in PostingsReport.
Use renderRow interface for Register report.

For reg -f examples/10000x10000x10.journal, this results in:
- Heap allocations decreasing by 55%, from 68.6GB to 31.2GB
- Resident memory decreasing by 75%, from 254GB to 65GB
- Total (profiled) time decreasing by 55%, from 37s to 20s
2021-03-21 07:10:27 -07:00
Stephen Morgan
d54e276658 lib: Split showMixedAmountB into showMixedAmountB and showAmountsB, the
former being a simple wrapper around the latter.

This removes the need for the showNormalised option, as showMixedAmountB
will always showNormalised and showAmountsB will never do so.

We also strip prices from MixedAmount before displaying if not displaying prices.
2021-03-21 07:10:27 -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
Stephen Morgan
dabb3ef82e lib,cli,ui,bin: Create a new API for MixedAmount arithmetic. This should
supplant the old interface, which relied on the Num typeclass.

MixedAmount did not have a very good Num instance. The only functions
which were defined were fromInteger, (+), and negate. Furthermore, it
was not law-abiding, as 0 + a /= a in general. Replacements for used
functions are:
0 -> nullmixedamt / mempty
(+) -> maPlus / (<>)
(-) -> maMinus
negate -> maNegate
sum -> maSum
sumStrict -> maSum

Also creates some new constructors for MixedAmount:
mixedAmount :: Amount -> MixedAmount
maAddAmount :: MixedAmount -> Amount -> MixedAmount
maAddAmounts :: MixedAmount -> [Amount] -> MixedAmount

Add Semigroup and Monoid instances for MixedAmount.
Ideally we would remove the Num instance entirely.

The only change needed have nullmixedamt/mempty substitute for
0 without problems was to not squash prices in
mixedAmount(Looks|Is)Zero. This is correct behaviour in any case.
2021-03-18 09:47:21 +11:00
Stephen Morgan
fb02d86884 lib: Do not do any valuation with --value=cost, perform AtEnd valuation with --value=cost,COMM. 2021-03-10 12:42:01 +11:00
Simon Michael
51d582e845 also keep supporting --value=cost,COMM for now (#1499) 2021-03-09 07:37:52 -08:00
Stephen Morgan
efb37c3343 lib: Default to PeriodChange report when using ValueChangeReport. 2021-03-05 10:09:14 -08:00
Stephen Morgan
3f408c2117 lib,cli: Restore old --change option for per-period summation, use --sum for basic ValueChange balance report. 2021-03-05 10:09:14 -08:00
Simon Michael
2505c69f80 lib: transactionFile 2021-03-03 06:44:25 -08:00
Stephen Morgan
edaaef897b lib: Do not include price directives in journalDateSpan. Only include
price directives after the last transaction/posting date if using
--value=end.

Also enlarges the reportspan to encompass full intervals for budget
goals.
2021-03-03 05:26:55 -08:00
Stephen Morgan
7f2536a2a7 lib,cli: Add --valuechange report type for calculating change of value
of accounts, restore --value=end behaviour to that of hledger-1.19.
2021-02-27 18:42:02 -08:00
Stephen Morgan
351648e4fa lib,cli: Add --periodic option to indicate PeriodChange accumulation (renamed from --change). 2021-02-27 18:42:02 -08:00
Stephen Morgan
f0655d1c7f lib: (amount|mixedAmount)(Looks|Is)Zero functions now check whether
both the quantity and the cost are zero. This is usually what you want,
but if you do only want to check whether the quantity is zero, you
can run mixedAmountStripPrices (or similar) before this.

(multiply|divide)(Mixed)?Amount now also multiply or divide the
TotalPrice if it is present, and the old
(multiply|divide)(Mixed)?AmountAndPrice functions are removed.
2021-02-23 14:54:39 -08:00
Stephen Morgan
9d527a9926 lib: normaliseHelper now uses a strict Map for combining amounts
internally, closing a big space leak.

This also now combines Amounts with TotalPrices in the same commodity
when normalising; amounts with TotalPrices were previously never
combined.
2021-02-23 14:54:39 -08:00
Stephen Morgan
ecca7f4e0c lib: Distinguish between an Amount having quantity (or rounded quantity 0), and having both quantity and totalprice 0 (or rounded to 0). 2021-02-23 14:54:39 -08:00
Stephen Morgan
81b778a389 lib: Make fields of Amount, AmountPrice, AmountStyle, and DigitGroupStyle strict. 2021-02-23 14:54:39 -08:00
Stephen Morgan
2ada289e28 lib: Include sign in TotalPrice in Amount, rather than relying on the sign of
aquantity.

Journal entries still require a positive @@ price, but now the sign is
set after parsing, rather than when converting in amountToCost.

The reason for this change is that, if we're going to perform arithmetic
on Amount with TotalCost, then the presence of aquantity=0 means that
amountToCost would render the total cost as 0, because signum 0 == 0.
This makes journal entries like the following impossible to balance:
2000-01-01
    a  0 @@ 10 A
    b  -10 A
2021-02-23 14:54:39 -08:00
Stephen Morgan
a65ef7cd19 lib: Consume list immediately in commodityStylesFromAmounts.
This reduced the maximum heap size per thread from ~850K to ~430K in a
real-world register test.
2021-02-23 14:54:39 -08:00
Simon Michael
5e7c4fc7bc add, print --match: prioritise infix matches
If the search description occurs in full within the other description,
that match gets a +0.5 score boost.
2021-02-20 14:08:47 -08:00
Simon Michael
44508f58c8 add, lib: debug output, refactor similar transactions lookup
add --debug=1 shows the top hits for similar past transactions.

added:
Hledger.Cli.Utils.journalSimilarTransaction
 provides --debug=1 output

changed:
Hledger.Cli.Commands.Add.transactionsSimilarTo -> Hledger.Data.Journal.journalTransactionsSimilarTo
 now takes an extra number-of-results argument
2021-02-20 13:41:37 -08:00
Simon Michael
b31e40ceca lib: avoid shady Not (Or []) in account type queries 2021-02-13 14:58:06 -08:00
Simon Michael
6c392e9f43 bs: don't let just a Cash declaration hide Asset accounts
Clarify the account type queries a bit, and don't let a
declaration of account as Cash cause the fallback regex
for Asset accounts to be ignored.
2021-02-13 14:54:04 -08:00
Simon Michael
b9d33a4294 bs: just declaring a Cash account no longer hides Asset accounts
Since Cash is also an Asset, declaring an account as Cash also disabled the fallback regexp for Asset accounts.
2021-02-13 08:09:45 -08:00
Simon Michael
50bfc26ca7 ;lib: commentAddTagNextLine was broken
It would not add the tag when a comment already existed.
This affected hledger-print-location.hs and probably
the generated-transaction: tag in periodic transactions.
2021-02-12 13:56:02 -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
d5ed8090fa ;lib: document AmountPrecision 2021-02-05 16:09:49 -08:00
Simon Michael
37e49ada70 cli: rename --infer-value to --infer-market-price
For clarity; infer-value was too vague. The old spelling remains
supported for compatibility, but is now deprecated.
When typing, --infer-market or even --infer (for now) is sufficient.
2021-02-05 15:16:39 -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
Simon Michael
f52117120b lib: refactor: rename journal/transaction mapping helpers
Hledger.Data.Journal:
changed:
mapJournalTransactions -> journalMapTransactions
mapJournalPostings -> journalMapPostings
removed:
mapTransactionPostings

Hledger.Data.Transaction:
added:
transactionMapPostings
2021-02-04 08:13:55 -08:00
Simon Michael
6101368954 print: always show all decimal places (#931)
Ensures parseable and more sensible-looking output in more cases, and behaves more like Ledger's print.

There is still an issue with adding trailing zeroes, which would be nice to prevent.
2021-02-04 08:13:55 -08:00
Simon Michael
0274b30742 print: don't add decimal places in assertion/assignment amounts either (#1465) 2021-02-04 06:46:09 -08:00
Simon Michael
201f967411 print: show all decimal places in assertion/assignment amounts (#1465)
Overriding the commodity style, per https://hledger.org/hledger.html#commodity-display-style.
2021-02-03 18:11:44 -08:00
Stephen Morgan
b619b68f71 doc: Remove references to --value=cost, replacing them with --cost.
Since this is option is now just an alias for -B/--cost, and since it
may be removed soon, we make it undocumented, though it will still
behave as before. --value=cost,COMM is unsupported as well.
2021-01-28 13:57:48 -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
Stephen Morgan
9881ec9652 lib: Use mapMixedAmount more, decreasing reliance on internal representation of Mixed. 2021-01-28 13:57:48 -08:00
Stephen Morgan
9cf5015958 lib: bal --value=end without --historical should not report on fluctuation in value of historical postings. 2021-01-28 13:57:48 -08:00
Simon Michael
bf328e4e3c lib: matchesDescription, matchesPayeeWIP 2021-01-17 16:37:38 -08:00
Simon Michael
422329fbfa lib: journalPayeesUsed, journalPayeesDeclaredOrUsed 2021-01-17 16:37:38 -08:00
Simon Michael
db9b034037 lib: Journal: avoid a build failure if monad-extras is installed 2021-01-17 16:37:38 -08:00
Stephen Morgan
5d664fc528 lib: Expose textConcatBottomPadded. 2021-01-15 12:56:48 -08:00
Stephen Morgan
217bfc5e74 lib: Rename alignCell to textCell, minor cleanups. 2021-01-15 12:56:48 -08:00
Stephen Morgan
9ad0eef69b lib: Update textConcatTopPadded to use Tabular.AsciiWide, same as concatTopPadded. 2021-01-15 12:56:48 -08:00
Stephen Morgan
2c2bd8b27e lib: Refactor unlinesB to be cleaner and more efficient. 2021-01-15 12:56:48 -08:00
Simon Michael
e1e97f977e ;journal: hints for possible future work related to #1461 2021-01-13 18:15:10 -08:00
Simon Michael
034c317496 journal: allow commodity directive to set style of no-symbol commodity (#1461)
(cherry picked from commit c5571f6468ab11ffe3cd3f86a86f0b3253be10d1)
2021-01-13 17:57:18 -08:00
Stephen Morgan
2b545caae5 lib: Calculate value at posting date for register --value=then -M. 2021-01-12 18:20:21 -08:00
Stephen Morgan
b203822cd1 lib: Make sure to add a newline to the end of aregister report. 2021-01-10 20:50:46 -08:00
Simon Michael
c21b666130 csv: handle more sign variations, eg a sign by itself
simplifySign now covers a few more sign combinations that might arise.
And in particular, it strips a standalone sign with no number,
which simplifies sign flipping with amount-in/amount-out.
2021-01-07 10:06:38 -08:00
Simon Michael
4952ac22a1 ;lib: valuation: improve --debug=2 output 2021-01-07 08:59:04 -08:00
Simon Michael
1ad919bc6d lib: add level argument to fix traceAtWith 2021-01-07 08:57:25 -08:00
Stephen Morgan
c40db2b1eb lib: Make sure AtEnd valuation behaviour is consistent between single- and multi-period reports (#1424). 2021-01-05 14:42:09 -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
Simon Michael
3d7d5c0db7 new price search that really finds the shortest path (#1443)
This one should also reliably prevent runaway searches in the event of more bugs, giving up after 1000 iterations.
2021-01-04 18:42:51 -08:00
Simon Michael
7c9303a15c lib: valuation: simplify price search code
This version tries counting recursions instead of path length, but I
think they are the same.
2021-01-03 09:49:00 -08:00
Simon Michael
73678393b1 lib: valuation: don't hang when finding prices (fixes #1439)
Searching for prices during valuation no longer now properly excludes
price loops, avoiding near infinite looping with certain
configurations of market prices. Also we now always use a direct price
when available, rather than searching unnecessarily.

Price searching progress info, useful for troubleshooting, is now
displayed with --debug=2.

There could still be some corner cases we don't handle correctly. We
now give up with an error message if the searched price chains get too
long (> 1000). More importantly, we should also give up if the search
iterates too many times, but this is not done yet.
2021-01-02 07:13:07 -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
1f891a4145 doc: Fix some outdated documentation. 2021-01-02 15:08:09 +11:00
Stephen Morgan
e63138ef7d lib,cli: Assorted fixes for older GHC. 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
07a7c3d3a8 lib: Use Text and Text builder only in postingAsLines. 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
0a686e220e lib: Use AmountDisplayOpts for showAmount*, reducing need for many different named functions. 2021-01-02 15:08:09 +11:00
Stephen Morgan
c86e8a9794 lib: Implement showAmountHelper using AmountBuilder. 2021-01-02 15:08:09 +11:00
Stephen Morgan
5dedec83da lib: showamountquantity shows directly, rather than parsing string output of show instance for Quantity. 2021-01-02 15:08:09 +11:00
Stephen Morgan
f998a791cf lib: Remove unused optional width argument for StringFormat. 2021-01-02 15:08:09 +11:00
Stephen Morgan
462a13cad7 lib,cli: Use Text Builder for Balance commands. 2021-01-02 15:08:09 +11:00
Stephen Morgan
089564b04b lib,cli: Use Text for CompoundPeriodicReport titles. 2021-01-02 15:08:09 +11:00
Stephen Morgan
541c4fc18c lib,cli: Use Text for CSV values. 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
Stephen Morgan
12a6435c51 lib: Add wrap convenience function. 2021-01-02 15:08:09 +11:00
Stephen Morgan
646ee0bce5 cli: Using Text Builder for posting reports. 2021-01-02 15:08:09 +11:00
aragaer
2084b845e0 journal: Ignore AUTO commodity when strict checking
AUTO commodity is a placeholder for postings with missing amounts. It
should be ignored when doing a strict commodity check.

Fixes #1419
2020-12-31 09:54:23 -08:00
Simon Michael
8306420b61 check: also check "accounts"/"commodities" on demand
(cherry picked from commit 0c2bf54f2955e3a25fd0282acc42608f957abaea)
2020-12-31 08:33:36 -08:00
Simon Michael
31ea37a785 ;check: accounts, commodities, payees, ordereddates: improve errors
Error messages for these four are now a bit fancier and more
consistent. But not yet optimised for machine readability.
Cf #1436.

Added to hledger-lib: chomp1, linesPrepend[2].
2020-12-30 18:13:34 -08:00
Simon Michael
e59603a04a ;check errors: drop unwanted newline & "strict mode" prefix 2020-12-30 18:08:31 -08:00
Damien Cassou
b47d582583 ;check: fixes 2020-12-30 18:08:31 -08:00
Simon Michael
3c232fbd7d check: add "payees" check requiring payee declarations 2020-12-30 18:08:30 -08:00
Damien Cassou
e092b38631 ;lib: add 'payee' directive 2020-12-30 18:08:30 -08:00
Stephen Morgan
a64d1aa6d0 bin: Update bin scripts for current hledger-lib.
(cherry picked from commit bc4aef17b7fa13ec0754b93325e1c5e5ee04f1e7)
2020-12-30 08:59:03 -08:00
Simon Michael
12447ffab7 ;lib: restore list of hledger debug levels 2020-12-26 17:27:28 -08:00
Stephen Morgan
e406cebcce lib: Remove unused AtDefault constructor for ValuationType. 2020-12-19 11:59:44 -08:00
Stephen Morgan
46093b8de7 lib,ui: For hledger-ui, do valuation for all valuation types, not just
AtCost and AtDefault.

Remove unused valuationTypeIs* functions.
2020-12-19 11:59:44 -08:00
Stephen Morgan
cdec0f9382 lib: Remove special handling of now-inaccessible AtDefault valuation constructor.
This simplifies all the *ApplyValuation functions, as they no longer
need mreportdate or multiperiod arguments.
2020-12-19 11:59:44 -08:00
Stephen Morgan
0c23619ae7 lib: Valuation has changed; and -V now acts like --value=end. 2020-12-19 11:59:44 -08:00
Stephen Morgan
8981b3e196 lib: Include empty columns in MultiBalanceReports.
This was previously done for CompoundBalanceReport and when --empty was
called; this makes the behaviour consistent.
2020-12-18 20:54:08 -08:00
Stephen Morgan
439eddc8b9 lib: Include price directives when calculating journal end date. 2020-12-16 19:04:33 -08:00
Simon Michael
9617d0dd81 ;lib: multibalancereport sorting implementation notes (#1414, #1415) 2020-12-14 09:36:34 -08:00
Stephen Morgan
92645cca14 lib: Sorting accounts by amount should also consider account name after amounts. 2020-12-14 06:48:47 -08:00
Simon Michael
349ffd7c0b updateReportSpecFromOpts -> updateReportSpec[With] 2020-12-12 12:05:44 -08:00
Simon Michael
a10f9f4ea9 ;lib: comment 2020-12-11 11:11:15 -08:00
Simon Michael
44d59eab23 ;lib: Hledger.Utils.Debug: haddock 2020-12-09 13:55:55 -08:00
Simon Michael
51e3e9cbfa ;lib: Hledger.Utils.Debug: improve module haddock 2020-12-09 13:23:30 -08:00
Simon Michael
e33667f580 check: support quoted check name + args
A "hledger check" argument may now be a quoted string containing
the check name followed by space-separated arguments, for
checks which make use of those. This means the check command
can replicate "check-dates --unique" and (in principle)
"check-fancyassertions ASSERTIONS..". Eg:

hledger check "dates --unique"

I think it'll be better for checks to take no arguments or options,
so this is probably just a transitional feature for compatibility.
2020-11-29 20:48:31 -08:00
Simon Michael
8c23a16bf8 journal: strict mode also requires commodity declarations 2020-11-27 17:54:55 -08:00
Simon Michael
ec3ad14ae5 strict mode: -s/--strict requires posted accounts to be declared 2020-11-26 08:48:16 -08:00
Simon Michael
ea0d4901ab lib: journalApplyAliases performance tweak 2020-11-25 21:06:31 -08:00
Simon Michael
0dc8eca68a lib: remove partial code from journalApplyAliases etc. 2020-11-25 21:06:31 -08:00
Simon Michael
94b3f090be csv, timedot, timeclock: respect --alias options (fix #859)
Command-line account aliases now also affect transactions read
from these formats (not just journal format).

lib: journalApplyAliases, transactionApplyAliases, postingApplyAliases
helpers have been added.
2020-11-24 09:17:01 -08:00
Simon Michael
9b9f2543d8 ;lib: regexReplace: note the kind of RegexError still possible 2020-11-24 09:16:08 -08:00
Simon Michael
221a6d9001 lib: new more robust price lookup implementation, fixing #1402 2020-11-23 18:08:41 -08:00
Simon Michael
d60c1f764d lib: partial valuation fix, more debug output for #1402 2020-11-22 13:10:31 -08:00
Simon Michael
654ab4243a ; comments 2020-11-20 16:45:40 -08:00
Simon Michael
4a74680a22 ;lib: rename some budget report helpers
The new names are of course verbose, but more consistent and revealing.
2020-11-19 14:59:08 -08:00
Simon Michael
372c9724a8 bal: improve budget, MultiBalanceReport debug output
Comply with debug levels policy, clarify some labels.
2020-11-19 14:42:46 -08:00
Simon Michael
5bb9006b6c bal: support CSV output for --budget reports (#1155) 2020-11-18 16:29:04 -08:00
Simon Michael
5d4a6cd47e ;csv: tweak CsvRules Show for consistency with others 2020-11-18 07:14:28 -08:00
Simon Michael
ec2a774b18 cli, lib: move functional tests into hledger/test/ 2020-11-16 08:47:41 -08:00
Simon Michael
0ce9c352ec add: don't let number style disturb the default (Fixes #1378) 2020-11-14 11:08:01 -08:00
Simon Michael
1f94aa1628 ;lib: make file modification/reloading helpers more robust (#1390)
Work on hledger-web tests showed some bad behaviour, in particular
journalReloadIfNewer would always reload a journal read from a string
or stdout. This is now fixed, and an ugly read.show conversion has
been cleaned up.

Hledger.Cli.Utils API changes:

removed:
- journalSpecifiedFileIsNewer
- fileModificationTime

added:
- utcTimeToClockTime

changed:
- journalFileIsNewer now requires a file argument
2020-11-13 16:28:35 -08:00
Simon Michael
70f95e9f2c ;doc: journal: clarify that it's the first-seen digit group style 2020-11-10 09:29:04 -08:00
Simon Michael
8bdb28a991 csv, journal: infer style from first amount, as documented, not last
This has been broken since hledger 1.12 (!)
2020-11-10 08:58:28 -08:00
Simon Michael
f43c7e41d1 csv, journal: debug output
The prolific "assignment" output is now at level 9.
2020-11-10 08:39:32 -08:00
Simon Michael
a97daaf322 lib: replace pretty-show with pretty-simple
pretty-simple, already used in .ghci, will hopefully give nicer debug
output, including for values which don't have Read-able Show output.
This should mean that we can start removing custom string-like Show
instances that were a workaround for pretty-show.

We are using the latest version (4.0.0.0) to get compact output.
Here's some old pretty-show output:

 CsvRules
   { rdirectives = [ ( "skip" , "1" ) ]
   , rcsvfieldindexes = [ ( "date" , 1 ) , ( "amount" , 2 ) ]
   , rassignments = [ ( "amount" , "%2" ) , ( "date" , "%1" ) ]
   , rconditionalblocks = []
   }

And the new pretty-simple output:

 CsvRules
   { rdirectives=
     [ ( "skip", "1" ) ]
   , rcsvfieldindexes=
     [ ( "date", 1 ), ( "amount", 2 ) ]
   , rassignments=
     [ ( "amount", "%2" ), ( "date", "%1" ) ]
   , rconditionalblocks= []
   }

Non-compact pretty-simple output would be:

 CsvRules
     { rdirectives=
         [
             ( "skip"
             , "1B"
             )
         ]
     , rcsvfieldindexes=
         [
             ( "date"
             , 1
             )
         ,
             ( "amount"
             , 2
             )
         ]
     , rassignments=
         [
             ( "amount"
             , "%2"
             )
         ,
             ( "date"
             , "%1"
             )
         ]
     , rconditionalblocks=[]
     }

Also:

- Account's Show instance no longer converts : to _ in account names

- drop unused pretty-show dependency from hledger, hledger-ui packages

- regenerate hledger-lib with the older hpack that's shipped in stack
2020-11-10 08:06:11 -08:00
Simon Michael
66af4962a1 ;lib: drop a todo, seems ok 2020-11-09 17:14:38 -08:00
Simon Michael
bfb5c6ee2a lib: global commodity display styles can be set in InputOpts or Journal, overriding all others 2020-11-09 17:14:37 -08:00
Simon Michael
0eddbe7a4b ;lib: reader cleanups 2020-11-09 17:14:37 -08:00
Stephen Morgan
74ce7be556 lib,ui: Make sure ReportSpec is updated when updating ReportOpts. 2020-11-09 16:30:15 -08:00
Stephen Morgan
3caf82c003 lib: Remove Empty Query constructor, which does nothing and has done so
for a very long time.
2020-11-09 11:21:40 -08:00
Stephen Morgan
c25612b8de lib: Refactor to eliminate confusing variables. 2020-11-08 17:11:05 -08:00
Stephen Morgan
4cd3ed15a0 lib: Use simpler MultiBalanceReport valuation calculations in more cases. 2020-11-08 17:11:05 -08:00
Stephen Morgan
35a83fbd8c lib: For MultiBalanceReport, report change in valuation rather than valuation of change. 2020-11-08 17:11:05 -08:00
Simon Michael
524e23bc37 csv: decimal-mark rule to help with number parsing
Journal keeps a new piece of parsing state, a decimal mark character,
which can optionally be set to force the number format expected by all
amount parsers.
2020-11-08 16:39:03 -08:00
Simon Michael
4242a8592a ;csv: refactor amount parsing 2020-11-08 16:39:03 -08:00
Simon Michael
dae007a372 cleanup 2020-11-08 16:39:03 -08:00
Stephen Morgan
166951dc69 bal: Sort amounts after negating when using invert_ (#1283, #1379) 2020-11-05 10:35:47 -10:00
Stephen Morgan
83a518af99 lib,cli,ui: In ReportOpts, store query terms term-by-term in a list in
querystring_.

This helps deal with tricky quoting issues, as we no longer have to make
sure everything is quoted properly before merging it into a string.
2020-11-04 08:47:30 -08:00
Stephen Morgan
3abc9f5985 lib: When calculating elisions, don't skip over some amounts. 2020-11-04 14:25:21 +11:00
Stephen Morgan
6d7bd9e475 lib: Implement concat(Top|Bottom)Padded in terms of renderRow, allowing them to be width aware. 2020-11-04 14:25:21 +11:00
Stephen Morgan
a620ab9666 lib: Expand Tabular.AsciiWide to allow multiline cells, either top or bottom aligned. 2020-11-04 14:25:21 +11:00
Stephen Morgan
dcb884c5ff lib: Align postings to unnormalised amount widths. 2020-11-04 14:25:20 +11:00
Stephen Morgan
0bebda7313 lib,cli,ui: Elide amounts to a width of 32 characters, rather than 22 characters. 2020-11-04 14:25:20 +11:00
Stephen Morgan
7e47c11fda lib: Remove some uses of pad(Left|Right)Wide to ensure we're using the
width provided by showMixed.

Also refactor renderTable to be a bit clearer, and to avoid duplicate
calculations.
2020-11-04 14:25:20 +11:00
Stephen Morgan
b39de5989f lib: Refactor and improve comments for new mixed amount display functions. 2020-11-04 14:25:20 +11:00
Stephen Morgan
9de238757b lib,cli,ui: Introduce showMixed*Unnormalised, eliminate most direct calls of strWidth.
This introduces some new helper functions which are exactly the same
as what we had before, but do not call
normaliseMixedAmountSquashPricesForDisplay, so that we can use the new
functions for displaying Transaction and Posting. It also goes through
and gets rid of most uses of the old showMixed* functions which would
benefit from using the new interface.
2020-11-04 14:25:20 +11:00
Stephen Morgan
162a936360 lib: BudgetReport uses new renderTable inteface, now has more compact output.
This changes showMixedAmountElided so that the width to elide to is
given as an argument, rather than fixed at 22 characters. This
actually uses the new renderTable interface. Mostly this is just an
internal change, but since we have more information about the widths
of things, we can actually get rid of some superfluous spaces in the
budget report output, previously there to make sure it stayed aligned
with the largest reasonable contents.
2020-11-04 14:25:20 +11:00
Stephen Morgan
33369dfa6c lib: renderTable can now receive alignment and width specifications on all cells, and has an option to display the outer border.
This gives renderTable a little more customisation. Before any of the
commits of this PR, render would just receive a string to display in
each cell. After the second commit of this PR it would also receive a
width of the string (in place of stripping ANSI sequences and then
calculating the width). After this commit, it now also takes an
alignment, so you can make cells left or right aligned. The function
render calls renderTable with appropriate options to give the same
behaviour as before. Also, previously render would always put a border
around the table. We would take this output, and would sometimes strip
the border by dropping the first and last rows, and first and last
characters of every row. I've just added an option to control whether
to put the border in, so we can just not add it in the first place,
rather than stripping it later. Note that this is again just defining
helper functions; this extra power is not yet used anywhere.
2020-11-04 14:25:20 +11:00
Stephen Morgan
a2b7a03fc4 lib,cli: bal uses new amount display functions, no longer needs to strip ansi. 2020-11-04 14:25:20 +11:00
Stephen Morgan
57d7b223a2 lib: Write new showMixedAmount* functions which keep track of length.
Previously showMixedAmountElided would show two amounts and then the
elision string if necessary. Now it will display as many Amounts as it
can subject to the condition that the amounts plus the elision string
fit within 22 characters.
2020-11-04 14:25:20 +11:00
Stephen Morgan
db97fae348 lib: Add documentation for CBCSubreportSpec. 2020-10-23 16:15:41 -07:00
Stephen Morgan
795134777c lib: Add Functor instance for CompoundPeriodicReport. 2020-10-23 16:15:41 -07:00
Stephen Morgan
affc8d10f2 lib: Generalise CBCSubreportSpec to allow more subreport control. 2020-10-23 16:15:41 -07:00
Stephen Morgan
6e65d4e071 lib: Export some MultiBalanceReport helper functions. 2020-10-23 16:15:41 -07:00
Stephen Morgan
c5abefc72f lib: Add documentation for ReportSpec. 2020-10-23 14:14:11 -07:00
Stephen Morgan
260283e2f1 lib,cli,ui,web: Introduce ReportSpec, which holds ReportOpts, the day of
the report, and the parsed Query.
2020-10-23 14:14:11 -07:00
Stephen Morgan
19ab222599 lib,cli: Remove old impure ReportOpts date functions. 2020-10-23 14:14:11 -07:00
Stephen Morgan
2aaab4b1b7 lib: Make Default instances clearer, remove Default instance for Bool. 2020-10-23 14:14:11 -07:00
Stephen Morgan
ff0c5bc743 lib,ui: Store the original query string in ReportOpts, provide a function for regenerating ReportOpts. 2020-10-23 14:14:11 -07:00
Stephen Morgan
64e3e5c54d lib: Improve documentation for StringFormat, remove type alias for Valuation. 2020-10-23 14:14:11 -07:00
Stephen Morgan
1171c23eee lib,cli,ui: Ensure ReportOpts always has today_ set. 2020-10-23 14:14:11 -07:00
Stephen Morgan
efc9758f82 lib: Make sure reportspan doesn't interfere with correctly determining valuation date. 2020-10-23 14:14:11 -07:00
Stephen Morgan
c45663d41d lib,cli: Store parsed Query in ReportOpts, rather than an unparsed
String.
2020-10-23 14:14:11 -07:00
Stephen Morgan
103308e795 lib,cli: Store StringFormat in ReportOpts, rather than unparsed String.
StringFormat now also takes an optional overline width, which is
currently only used by defaultBalanceLineFormat.
2020-10-23 14:14:11 -07:00
Stephen Morgan
f76cdc4317 lib: Remove checkReportOpts and checkRawOpts.
checkRawOpts has been a no-op for at least four years, and
checkReportOpts only makes sure that depth_ is positive, which is taken
care of by the maybeposintopt parser.
2020-10-23 14:14:11 -07:00
Stephen Morgan
5a6d38fdf2 lib: For ymd date parsing, don't consume invalid date components. 2020-10-18 21:28:46 -07:00
Stephen Morgan
97545018f4 lib: quoteIfNeeded should not escape the backslashes in unicode code points. 2020-10-18 21:08:25 -07:00
Simon Michael
08ee311875 journal: fix error when P directive has a zero price (#1373) 2020-10-18 20:48:14 -07:00
Stephen Morgan
7808aae682 lib: Remove un-necessary silencing of deprecation warning (relevant functions are no longer used) 2020-10-09 01:47:57 -07:00
Stephen Morgan
e57d911355 lib: Export OrdPlus and constructors. 2020-10-09 01:47:57 -07:00
Simon Michael
c5513ba722 ;tweak a few parse errors for clarity, consistency (#1329) 2020-09-19 08:10:39 -07:00
Simon Michael
f78dc639a5 fix a slowdown with report rendering in 1.19.1 (#1350)
stripAnsi is called many times during rendering (by strWidth), so
should be fast. It was originally a regex replacement, and more
recently a custom parser. The parser was slower, particularly the one
in 1.19.1. See #1350, and this rough test:

time118ish = timeIt $ print $ length $ concat $ map (fromRight undefined . regexReplace (toRegex' "\ESC\\[([0-9]+;)*([0-9]+)?[ABCDHJKfmsu]") "") testdata
time119    = timeparser (many (takeWhile1P Nothing (/='\ESC') <|> "" <$ ansi))
time1191   = timeparser (many ("" <$ try ansi <|> pure <$> anySingle))
timeparser p = timeIt $ print $ length $ concat $ map (concat . fromJust . parseMaybe p) testdata
testdata = concat $ replicate 10000
    [ "2008-01-01 income               assets🏦checking            $1            $1"
    , "2008-06-01 gift                 assets🏦checking            $1            $2"
    , "2008-06-02 save                 assets🏦saving              $1            $3"
    , "                                assets🏦checking  ..m$-1\ESC[m\ESC[m            $2"
    , "2008-06-03 eat & shop           assets:cash           ..m$-2\ESC[m\ESC[m             0"
    , "2008-12-31 pay off              assets🏦checking  ..m$-1\ESC[m\ESC[m  ..m$-1\ESC[m\ESC[m"
    ]

ghci> time118ish
4560000
CPU time:   0.17s
ghci> time119
4560000
CPU time:   0.91s
ghci> time1191
4560000
CPU time:   2.76s

Possibly a more careful parser could beat regexReplace. Note the
latter does memoisation, which could be faster and/or could also use
more resident memory in some situations.

Ideally we would calculate all widths before adding ANSI colour codes,
so we wouldn't have to wastefully strip them.
2020-09-10 18:07:40 -07:00
Stephen Morgan
600dab3976 lib: Correctly strip ansi sequences with no numbers/semicolons. 2020-09-06 19:11:28 -07:00
Simon Michael
a9fbaaf284 ;partial comment cleanups 2020-09-03 09:52:00 -07:00
Simon Michael
c2929939e4 make account type autodetection (& hledger-smooth) case insensitive again (#1341)
lib: added case-insensitive variants of the accountNameToRegex functions.
2020-09-03 09:52:00 -07:00
Simon Michael
58f989715a Replace our stringly Regex with a safer compiled Regexp type
This PR #1330, addressing #1312 (parseQuery is partial) and #1245
(internal server error).

User-visible changes:

- hledger-web now handles malformed regular expressions
  (eg, a query consisting of the single character `?`) gracefully,
  showing a tidy error message instead "internal server error".

API/internal changes:

- The Regex type alias has been replaced by the Regexp ADT, which
  contains both the compiled regular expression (so is guaranteed to
  be usable at runtime) and the original string (so can be serialised,
  printed, compared, etc.) A Regexp also knows whether is it case
  sensitive or case insensitive. The Hledger.Utils.Regex api has changed.

- Typeable and Data instances are no longer derived for hledger's
  data types; they were redundant/no longer needed

- NFData instances are no longer derived for hledger's data types.
  This speeds up a full build by roughly 7%. But it means we can't
  deep-evaluate hledger values, or time hledger code with Criterion.
  https://github.com/simonmichael/hledger/pull/1330#issuecomment-684075129
  has some ideas on this.

- Query no longer has a custom Show instance

- Some internal use of regexps was replaced by text replacement or
  parsers.

- Hledger.Utils.String: quoteIfNeeded now actually escapes quotes in
  strings; dropped escapeQuotes

- Hledger.Utils.Tree: dropped some old utilities

- dropped some obsolete code for the old --display option

Merge branch 'regexp' into master
2020-09-01 10:33:33 -07:00
Stephen Morgan
7d1e6d7d12 lib: Fix quoteIfNeeded so it actually escapes quotes. 2020-09-01 11:41:55 +10:00
Stephen Morgan
07dd30c1e5 lib,cli,ui: Change to consistent naming scheme for Hledger.Utils.Regex. 2020-09-01 11:36:34 +10:00
Stephen Morgan
5b647902c9 lib: Filter starting balances by subreport query in compoundBalanceReportWith. 2020-08-31 09:07:11 -07:00
Stephen Morgan
b91b391d08 lib: Replace some regex functions with parsers. 2020-08-31 22:44:41 +10:00
Stephen Morgan
20b39a5dd0 lib: Remove unused --display code.
This was dropped back in 2014, and getting rid of this removes a use of
regular expressions.
2020-08-31 20:45:37 +10:00
Stephen Morgan
8dfffb1e61 lib,web: Replace regex functions with simple text replacement. 2020-08-31 20:45:28 +10:00
Stephen Morgan
2cd7877c46 lib: Remove unnecessary NFData instances. 2020-08-31 15:41:36 +10:00
Stephen Morgan
af31d6e140 lib,cli,ui: Remove redundant Typeable and Data instances.
Also add some explicit import lists.
2020-08-31 15:41:30 +10:00
Stephen Morgan
01f5a92761 lib: Improve Read and Show instances for Regexp, get rid of custom show instance for Query. 2020-08-31 12:04:47 +10:00
Stephen Morgan
e3b2c94353 lib: Remove unneeded total Query code. 2020-08-31 12:04:47 +10:00
Stephen Morgan
e5371d5a6a lib,cli,ui,web: Make Regexp a wrapper for Regex. 2020-08-31 12:04:45 +10:00
Stephen Morgan
ccd6fdd7b9 lib: Remove unused Tree functions. 2020-08-31 11:51:25 +10:00
Stephen Morgan
7182fa4746 lib: Improve documentation for amountRoundedQuantity, fix a typo. 2020-08-30 23:01:04 +10:00
Stephen Morgan
f6fa76bba7 lib,cli: Get rid of magic values for asprecision, use a sum type instead. 2020-08-30 23:00:35 +10:00
Stephen Morgan
ee1ef9606b lib: Fail when parsing number with more than 255 decimal places. 2020-08-30 22:30:24 +10:00
Stephen Morgan
ba59fed6b2 lib: Replace more instances of fromIntegral with safer versions. 2020-08-30 22:20:58 +10:00
Stephen Morgan
ca2e55c954 lib: Replace some fromIntegral with toInteger. 2020-08-30 22:20:58 +10:00
Stephen Morgan
b5ed2067d9 lib: Make aprecision and DigitGroupStyle use Word8 instead of Int. exponentp now parses an Integer rather than an Int. 2020-08-30 22:20:53 +10:00
Stephen Morgan
371b349b2e lib,cli: Replace parsedate and mkdatespan with direct applications of fromGregorian, transaction now takes Day instead of a date string. 2020-08-29 15:08:28 -07:00
Stephen Morgan
2fd678e415 lib,cli,ui: Remove old CPP directives made redundant by version bounds. 2020-08-29 15:08:28 -07:00
Simon Michael
a3c749f9e7 csv: fix inferring separator from .ssv/.tsv file extensions
This was documented but untested and may have never worked.
2020-08-21 08:59:55 -07:00
Stephen Morgan
32e184f9a8 lib: Elide boring parents in tree mode even when using --empty. 2020-08-11 17:24:50 -07:00
Simon Michael
542052478d ;lib: Types pragmas 2020-08-10 06:22:40 -07:00
Simon Michael
b76caae338 fix doctest breakage (#1312) 2020-08-08 08:53:55 -07:00
Stephen Morgan
f2dcbd2fee lib: Make ill-formed SmartDates unrepresentable. 2020-08-07 14:20:08 -07:00
Simon Michael
27d6b21dff lib: Hledger.Query: add total variants of matches* functions (#1312)
matchesAccount_
matchesAmount_
matchesCommodity_
matchesPosting_
matchesPriceDirective_
matchesTags_
matchesTransaction_

These don't yet have tests of their own, but were converted
mechanically from the originals which should help.
2020-08-07 07:53:00 -07:00
Simon Michael
108c548240 journal: when an account alias contains a bad regexp, show details
lib: accountNameApplyAliases, accountNameApplyAliasesMemo are now
total
2020-08-06 15:27:40 -07:00
Simon Michael
3822c27bfe ;lib: regex: rename & export RegexError, export toRegex_, docs (#1312) 2020-08-06 15:25:58 -07:00
Simon Michael
4957008890 ;lib: regex utilities: cleanup (#1312) 2020-08-06 11:35:04 -07:00
Simon Michael
a112085092 lib: add alternate regex utilities that don't call error (#1312) 2020-08-06 11:18:08 -07:00
Simon Michael
ede4bfd5b4 ;mark more partial functions (#1312) 2020-08-05 17:29:43 -07:00
Simon Michael
3f55c23603 ;review, tag all error calls with an easier to find PARTIAL: comment (#1312) 2020-08-05 16:08:33 -07:00
Simon Michael
242c05fc9a lib, journal: parseQuery, modifyTransactions are now total (#1312)
modifyTransactions now also requires a reference date, for parsing queries.
Relative dates are now permitted in auto posting rules.
2020-08-05 13:44:04 -07:00
Simon Michael
7751d6947c lib: parseAmountQueryTerm: allow whitespace around arg parts (#1312)
Whitespace around the operator, sign, or number is now tolerated.
2020-08-05 13:44:04 -07:00
Simon Michael
38a4704641 lib: make parseAmountQueryTerm total, improve docs/tests (#1312) 2020-08-05 13:44:04 -07:00
Stephen Morgan
08ad220448 lib: In quarterdatespanp, use yearp and allow uppercase Q. 2020-08-04 09:10:53 -07:00
Henning Thielemann
9c9701fe7d lib: quarterdatespanp (fixes #1247) 2020-07-31 17:37:41 -07:00
Henning Thielemann
ccac09fb1b lib: doubledatespanp: fix and re-enable doctest 2020-07-31 17:37:41 -07:00
Stephen Morgan
dc41cee2b0 lib: datep now requires years to be at least four digits. 2020-07-31 17:22:27 -07:00
Stephen Morgan
ffb5cf0773 lib: Ensure parsed years have at least 4 digits. 2020-07-31 17:22:27 -07:00
Stephen Morgan
7b9f9ae49c lib: Refactor reportingintervalp to be more compact and do less backtracking. 2020-07-31 17:22:27 -07:00
Stephen Morgan
696d9c73b0 lib: Remove unnecessary try in parsers, replace unnecessary string' with string, rewrite some parsers in applicative style. 2020-07-31 17:22:27 -07:00
Dmitry Astapov
a82c383370 lib: disallow tabs in simplecommoditysymbolp (fixes #1301) 2020-07-28 15:33:47 -07:00
Stephen Morgan
081ee390ab lib: Change skipMany spacenonewline to takeWhileP Nothing isNonNewlineSpace. 2020-07-22 14:58:53 -07:00
Simon Michael
d738ca8c60 ;lib: cleanups 2020-07-19 06:13:38 -07:00
Simon Michael
e057857c04 ;lib: CBCSubreportSpec note 2020-07-17 10:02:14 -07:00
Simon Michael
e4f8b80d3b ;journal: account types: fix detection of Cash as an Asset, add tests 2020-07-17 10:02:14 -07:00
Simon Michael
fd9171df07 journal: account types: add Cash, tweak fallback regexp, rewrite docs 2020-07-17 08:02:12 -07:00
Stephen Morgan
30f02b0882 lib: account name clipping takes Maybe Int as depth. 2020-07-17 07:41:27 -07:00
Stephen Morgan
51ea6d9f25 lib: Make queryDepth return Maybe Int. 2020-07-16 10:05:53 -07:00
Stephen Morgan
dc076b0d5b lib: Use text library functions for stripping. 2020-07-16 10:03:25 -07:00
Stephen Morgan
ed99aea7d5 lib: Introduce takeEnd to get rid of some reverse . take n . reverse. 2020-07-16 10:03:25 -07:00
Simon Michael
3452270241 cli: --color/--colour option; smart emacs, windows autodetection (#1296) 2020-07-14 12:08:36 -07:00
Simon Michael
9198449ee3 areg: an account transaction register like the ones in ui/web (#1294)
;areg: debug output

;areg: show a title indicating which account was picked

This might be a bit of a pain for scripting, but otherwise it can be
quite confusing if your argument matches an account you didn't expect.

;areg: improve CSV headings

;areg: show at most two commodities per amount
2020-07-14 10:24:57 -07:00
Simon Michael
3f86bd545f lib, ui, web: stricter accountTransactionsReport filtering
accountTransactionsReport now filters transactions more thoroughly, so
eg transactions dated outside the report period will not be shown.
Previously the transaction would be shown if it had any posting dated
inside the report period. Possibly some other filter criteria now get
applied that didn't before. I think on balance this will give slightly
preferable results.
2020-07-14 10:22:14 -07:00
Simon Michael
bf2fe3d88e ;lib: valuation debug output note 2020-07-14 10:21:45 -07:00
Simon Michael
febd8bb457 lib: postingsReport: follow debug levels policy 2020-07-13 11:53:05 -07:00
Stephen Morgan
fd729beabf lib: Work around hiding deprecation warnings, don't traverse zeros twice in normaliseHelper. 2020-07-10 12:18:51 -07:00
Stephen Morgan
ee3ed6acdf lib: Simplify and speed up amountLooksZero. 2020-07-10 12:18:51 -07:00
Stephen Morgan
99b74dc389 lib: Refactor sortAccountTreeByAmount 2020-07-10 09:08:03 -07:00
Stephen Morgan
463eee7bf4 lib: Replace {pr,prr}Negate with fmap negate. 2020-07-10 09:08:03 -07:00
Simon Michael
f518da747c balcmds: avoid short month names in multi-year monthly reports 2020-07-09 12:56:46 -07:00
Simon Michael
f4991d05b4 lib: list exports of Hledger.Reports.BudgetReport 2020-07-09 12:55:04 -07:00
Simon Michael
23bef9a01b ;refactor: extracted reportPeriodName for making report headings 2020-07-09 12:54:20 -07:00
Simon Michael
4b9a76068f lib: spanStartYear, spanEndYear, spanYears DateSpan helpers 2020-07-09 12:52:40 -07:00
Simon Michael
a89a4e1b42 bal --budget: show end-date column headings when appropriate
bal --budget was always showing the period as column heading,
as if for a change report. With --cumulative or --historical
it should show the end date, like other balance reports. Cf
https://hledger.org/hledger.html#multicolumn-balance-report.
2020-07-09 11:49:19 -07:00
Stephen Morgan
f5e1fb2625 lib: Refactor BudgetReport to re-use MultiBalanceReport code. 2020-07-07 18:46:34 -07:00
Stephen Morgan
bfda10ff20 lib: Refactor MultiBalanceReport row sorting, make sure totals are calculated after pruning. 2020-07-07 18:46:34 -07:00
Stephen Morgan
bde4d7e2e4 lib: Use last column of historical balance as total. Use totals for balanceReport. 2020-07-07 17:56:38 -07:00
Stephen Morgan
1425301a8c lib, cli: Use --flat as the default mode for all reports. 2020-07-07 15:49:08 -07:00
Stephen Morgan
df84a417d7 doc: Remove references to old limitations of boring parent ellision. 2020-07-07 15:49:08 -07:00
Michael Sanders
5ec0a518da csv: Add support for & operators in conditional blocks 2020-07-07 12:51:01 -07:00
Simon Michael
25c15d4bab bal --budget: elide multicommodity amounts 2020-07-05 06:59:16 -07:00
Simon Michael
44c3eb1904 add a color argument to most amount show helpers, drop cshow variants
This is an API change, but it seems better than having additional
colour-supporting variants and trying to avoid duplicated code.
I stopped short of changing showAmount, so cshowAmount still exists.
2020-07-05 06:59:16 -07:00
Simon Michael
2739a70a38 balcmds: elide amounts with 3 or more commodities, unless --no-elide
Multicolumn balance reports showing many commodities tend to become
unreadably wide, especially in tree mode. Now by default we show at
most two commodities, and a count of the rest if there are more than
two. This should help keep reports somewhat readable by default.
2020-07-05 06:59:16 -07:00
Stephen Morgan
c811ea4c7b lib, cli, ui, web: intopt and friends now make sure their arguments fit
inside bounds.
2020-07-03 12:35:51 -07:00
Stephen Morgan
c96947284e lib: Minor refactor. 2020-07-03 12:35:51 -07:00
Simon Michael
765fb732c9 debug: move command parsing debug output down to level 8 2020-07-03 11:37:01 -07:00
Simon Michael
6cc896a8fe debug: show aliasing and auto postings with other reading (level 7) 2020-07-03 11:30:52 -07:00
Stephen Morgan
4fc72328d2 lib, cli: Introduce convienience function compoundBalanceReport. 2020-06-28 07:29:49 -07:00
Stephen Morgan
604868cea5 lib, cli: Move CompoundBalanceReport into ReportTypes, compoundReportWith into MultiBalanceReport, share postings amongst subreports. 2020-06-28 07:29:49 -07:00