Commit Graph

2488 Commits

Author SHA1 Message Date
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
5f9635c784 ;update changelogs 2020-11-17 10:51:57 -08:00
Simon Michael
3662977c84 ;update manuals 2020-11-17 07:29:57 -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
86fac4236d ;update manuals 2020-11-09 17:14:38 -08:00
Simon Michael
66af4962a1 ;lib: drop a todo, seems ok 2020-11-09 17:14:38 -08:00
Simon Michael
687494834b ;doc: journal: amount display style -> commodity display style 2020-11-09 17:14:37 -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
Simon Michael
895783ebe0 ;update manuals 2020-11-09 11:09:55 -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
Simon Michael
d1ded6fd84 ;update changelogs 2020-11-04 06:52:15 -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
e50a8c0f34 lib: Refactor Text.Tabular.AsciiWide to allow custom width specification in rendering. 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
Simon Michael
cca8802e2c ;update changelogs 2020-11-03 08:18:14 -10:00
Simon Michael
b10e96d26d ;update manuals 2020-10-25 18:56:34 -10:00
Simon Michael
6e956fb62b ;csv: doc: tweak (#1089) 2020-10-25 18:56:22 -10:00
Simon Michael
8b97d31db4 ;update manuals 2020-10-25 18:50:37 -10:00
Simon Michael
d42070ee87 ;csv: doc: rewrite currency tip (#1089) 2020-10-25 18:50:37 -10:00
Stephen Morgan
db97fae348 lib: Add documentation for CBCSubreportSpec. 2020-10-23 16:15:41 -07:00