Commit Graph

237 Commits

Author SHA1 Message Date
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
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
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
603fae70c0 dev: lib: clean up/simplify debug helpers 2022-10-31 11:26:11 -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
82a503cbf5 imp: lib: Hledger.Utils.Parse: export customErrorBundlePretty
for pretty-printing hledger parse errors.
2022-10-07 06:34:34 -10:00
Simon Michael
5c14ed2ec9 dev: lib: clarify dlogAt's doc 2022-09-10 12:44:21 -10: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
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
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
101e2f7426 imp: add a missing space after colon in some debug output 2022-08-16 09:13:30 +01:00
Simon Michael
442ef9361c feat: api: quoteForCommandLine: some very shady CLI escaping 2022-07-31 08:26:30 +01:00
Simon Michael
1c67d0860e imp: errors: more error prettification 2022-07-13 03:59:44 +01:00
Simon Michael
dd14f9c822 imp: lib: Hledger.Utils.Parse: export HledgerParseErrors 2022-06-29 09:58:56 +01:00
Simon Michael
5ab7b9f643 ref: HledgerParseErrors type alias 2022-04-25 02:56:59 -10:00
Simon Michael
2f28e1b0a7 ref: rename CustomErr -> HledgerParseErrorData
Verbose, but use every chance to clarify the complicated parse error
situation.
2022-04-25 02:56:59 -10:00
Stephen Morgan
1aff74f702 cln: Reduce duplication in test utilities. 2022-03-26 15:35:19 -10:00
Stephen Morgan
19ed6d3f00 cln!: sourcepos: Use megaparsec-supplied sourcePosPretty.
Change showSourcePos to sourcePosPretty, and showSourcePosPair to
sourcePosPairPretty.
2022-03-10 16:56:28 -10:00
Stephen Morgan
e9dd77e82b fix: Ensure head and tail are not called on empty account names. 2021-12-22 14:37:37 -10:00
Simon Michael
35c1c9b6a2 pkg: progress towards supporting GHC 9.2 and newer libs (#1774)
hledger-lib builds, hledger's deps don't (shakespeare).
2021-12-06 12:32:50 -10:00
Simon Michael
3c889cb565 imp: lib: dlog 2021-11-20 07:49:41 -10:00
Stephen Morgan
ff0132df28 dev: Use realLength from doclayout instead of strWidth and textWidth. (#895)
This gives us more accurate string length calculations. In particular,
it handles emoji and other scripts properly.
2021-11-11 18:29:50 -10:00
Stephen Morgan
afdeb404b0 fix: colour: NO_COLOR flag no longer overrides an explicit --color option. (#1710)
http://no-color.org/ specifies that command line arguments should
override a NO_COLOR flag.
2021-09-21 15:32:53 -10:00
Stephen Morgan
4cfd3cb590 lib!: Remove GenericSourcePos, and replace it with either SourcePos or
(SourcePos, SourcePos).

This has been marked for possible removal for a while. We are keeping
strictly more information. Possible edge cases arise with Timeclock and
CsvReader, but I think these are covered.

The particular motivation for getting rid of this is that
GenericSourcePos is creating some awkward import considerations for
little gain. Removing this enables some flattening of the module
dependency tree.
2021-09-20 08:38:33 -10:00
Stephen Morgan
df71d2ddd5 dev: Move journal and text parsing utilities into more appropriate places, to reduce reliance on Hledger.Read.Common. 2021-09-19 17:10:38 -10:00
Stephen Morgan
c1d85ba17c ref: Move JournalParser and ErroringJournalParser to Hledger.Data.Journal.
This is so that Hledger.Utils does not depend on Hledger.Data in any
way, and allows us more flexibility in refactoring Hledger.Data.
2021-09-18 11:41:53 -10:00
Stephen Morgan
8274da81fc cln: tests: Remove test and tests, which are just aliases for testCase
and testGroup.

Replacing these removes a layer of indirection, and reduces the need to
depend on Hledger.Utils.Test.
2021-08-30 16:32:19 -10:00
Stephen Morgan
a0f9d7560f pkg!: Remove Hledger.Utils.Color module.
This module was only used in one place in Hledger.Data.Amount. The code
has been moved directly into Hledger.Utils.
2021-08-30 15:57:33 -10:00
Stephen Morgan
f1994d5aa8 pkg!: Remove Hledger.Utils.Tree module.
This very small module was only used in Hledger.Data.Account, so the
code was moved into that module instead.
2021-08-30 15:57:33 -10:00
Stephen Morgan
1ed06f3bc8 pkg!: Remove Hledger.Utils.UTF8IOCompat module.
This module does nothing beyond define error' and usageError, which have
been moved to Hledger.Utils.
2021-08-30 15:57:33 -10:00
Stephen Morgan
d248aec313 cln: hlint: Remove eta reduce warnings. 2021-08-27 06:13:56 -10:00
Stephen Morgan
8bf7c95697 cln: hlint: Clean up Functor related hlint warnings, and NOINLINE warning. 2021-08-27 06:13:56 -10:00
Stephen Morgan
beecb3c9ac cln: hlint: Clean up list related hlint warnings. 2021-08-27 06:13:56 -10:00
Stephen Morgan
22db5c4a3f cln: hlint: Remove warnings to use library list functions. 2021-08-27 06:13:56 -10:00
Stephen Morgan
e13239386f cln: hlint: Clean up == and elem related hlint warnings. 2021-08-27 06:13:56 -10:00
Stephen Morgan
eb6047e81b cln: hlint: Remove redundant where and lambda warnings. 2021-08-26 21:00:35 -10:00
Stephen Morgan
1c211f8ab8 cln: hlint: Fix redundant return warning. 2021-08-26 21:00:35 -10:00
Stephen Morgan
1e69fd81ea cln: hlint: Remove if warnings. 2021-08-26 07:23:11 -10:00
Stephen Morgan
063aaf35b5 cln: hlint: Rename pattern variables to avoid hlint parsing errors. 2021-08-25 20:44:36 -10:00
Lawrence Wu
f3c07144a8 bal: option to view one commodity per row
This adds the `--commodity-column` option that displays each commodity
on a separate line and the commodities themselves as a separate column.
The initial design considerations are at
simonmichael.hledger.issues.1559

The single-period balance report with `--commodity-column` does not
interoperate with custom formats.
2021-08-08 09:19:25 -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
46d3eaf920 ;lib: clarify/extend/refactor some line parsing helpers (#1580) 2021-06-23 14:12:17 -10:00
Stephen Morgan
68e975adf1 lib,cli,ui,web: Remove unused LANGUAGE pragmas. 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
e80bb37b1c lib: Remove unused String utility functions. 2021-06-03 23:23:54 -10:00