Commit Graph

455 Commits

Author SHA1 Message Date
Thomas Miedema
5129a94bd7
;cln: unittest.hs: remove bothersome PackageImports (#2337)
When running `cd hledger-lib && ghci test/unittest.hs`, ghci complains
with:

```
  test/unittest.hs:7:1: error:
      Could not find module ‘Hledger’
      It is not a module in the current program, or in any known package.
    |
  7 | import "hledger-lib" Hledger (tests_Hledger)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  Failed, no modules loaded.
```

This commit removes the "hledger-lib" package-qualified import, such
that above ghci command works as expected.

However, there is a comment in hledger-lib/test/unittest.hs that says:

> package-qualified import to avoid cabal missing-home-modules warning
> (and double-building ?)

The missing-home-modules warning and the double building can indeed be
reproduced by running (after removing the "hledger-lib"
package-qualified import): `cd hledger-lib && cabal build unittest`. It
will first build `hledger-lib`, then show a warning about
missing-home-modules, and then build `hledger-lib` again.

After comparing the unittest sections of hledger.cabal and
hledger-lib.cabal, the solution turned out to be to remove `./` from
hs-source-dirs for unittest. Don't ask me why though!

Overall it's a nice cleanup.
2025-02-26 11:54:59 -10:00
Joschua Kesper
5114962b2a feat:csv: add an encoding rule, allowing non-UTF8 CSV to be read [#2319]
Previously, hledger could read CSV files containing non-ascii
characters only if they are UTF8-encoded.  Now there is a new CSV
rule, encoding ENCODING, which allows reading CSV files with other
encodings.

This adds a dependency on the encoding library, which supports fewer
encodings than text-icu but does not require a third-party C library.
To avoid build issues on various platforms, we require version 0.10+.

This adds some use of the ImplicitParams language extension, required
by encoding's API, but only in a small code region.

This also changes the type of Reader's rReadFn; it now takes
a `Handle` rather than a `Text`, allowing more flexibility.
2025-02-15 14:48:30 -10:00
Simon Michael
29885d15fa dev: refactor Hledger.Write.Html etc, reducing Lucid references
Clarify the HTML lib situation a bit, and clean up some imports.

Related: #2244
2025-01-25 11:53:51 -10:00
Simon Michael
f2cb3cd023 ;cabal: update cabal files 2024-12-09 17:58:25 -10:00
Simon Michael
fd9c64a4ad pkg: allow megaparsec 9.7 [stackage#7585] 2024-12-03 08:46:29 -10:00
Simon Michael
75ff6c8218 ;cabal: update cabal files 2024-11-02 08:42:10 -10:00
Simon Michael
30086ae249 imp: run pager more robustly; drop pager lib [#2272]
This fixes the error displayed when quitting the pager with long output.
It also replaces the pager lib with more robust homegrown pager utilities,
which should prevent a number of failure modes.
2024-10-31 18:55:09 -10:00
Simon Michael
50bf401ea6 dev: split debug/ghcdebug flags, comment out the latter for now
Compilation with ghc-debug is failing, and it has not yet been used
for anything. Separate the flag and leave it in place but commented for now.
2024-10-24 10:44:28 -10:00
Simon Michael
5bf48d721a cabal: update cabal files 2024-10-19 18:50:40 -10:00
Simon Michael
db748465a8 fix📟 when the $PAGER is not in PATH, print instead of failing 2024-10-19 16:28:36 -10:00
Simon Michael
4eff3ed8a0 ;cabal: update cabal files 2024-10-11 14:56:03 -10:00
Simon Michael
5f92fbd99a ;cabal: update cabal files 2024-10-10 23:25:07 -10:00
Simon Michael
1c45496f1c dev: web: fix build with ghc <9.2 2024-09-30 17:20:13 -10:00
Simon Michael
1b60ebb61f ;cabal: update cabal files 2024-09-30 17:20:13 -10:00
Simon Michael
2cbea889f5 dev: lib: fix package.yaml, regen .cabal [#2244] 2024-09-29 13:27:51 -10:00
Henning Thielemann
2f9a8031b0 lib: Write.Html -> Write.Html.Lucid
Write.Html: keep common definitions for both HTML backends
2024-09-29 13:27:51 -10:00
Henning Thielemann
cc7e034d64 lib: Write.Html.Blaze: alternative to Lucid based export
for compatibility with hledger-web/yesod
2024-09-29 13:27:51 -10:00
Henning Thielemann
6ce6c72fd4 lib: Write.Html.Attributes: extracted HTML output helpers from Cli.Commands.Balance 2024-09-24 22:51:30 -10:00
Simon Michael
27e6eb0024 ;cabal: update cabal files 2024-09-09 14:06:06 -07:00
Simon Michael
dda3855ba2 ;cabal: update cabal files 2024-09-09 14:04:43 -07:00
Michael Rees
b4a9f87fe4 Move SortSpec to Hledger.Reports.ReportOptions
As part of this migration, I also switched from using Data.List.splitOn
to Hledger.Utils.splitAtElement.
2024-09-05 11:56:07 +01:00
Michael Rees
00eb0aa16b feat: register: add --sort as in ledger 2024-09-05 11:56:07 +01:00
Simon Michael
6fc117fa15 ;cabal: update cabal files [#2213] 2024-08-29 23:20:39 +01:00
Henning Thielemann
f306df6d61 imp: lib: Write.Html: use Lucid to generate HTML 2024-08-16 16:57:38 +02:00
Henning Thielemann
8c42a735c2 cli: lib: Write.Spreadsheet: common data types for Write.Ods and Write.Html
Write.Html: write spreadsheet data to a HTML table

enables HTML export for the balance command
2024-08-16 16:57:38 +02:00
Henning Thielemann
0e158d0c3e cli: lib: Hledger.Write.Ods: basic support for FODS export
used in Commands.Balance
2024-08-16 16:57:38 +02:00
Henning Thielemann
14b5a1f82a imp: Hledger.Read.CsvUtils -> Write.Csv 2024-08-16 16:57:38 +02:00
Simon Michael
4175dc50ac ;cabal: update cabal files 2024-06-25 18:37:54 +01:00
Simon Michael
d18c00e1ec ;cabal: update cabal files 2024-06-01 13:30:21 -10:00
Simon Michael
7525014c7d ;cabal: update cabal files 2024-05-01 23:04:18 -10:00
Simon Michael
929f050c43 ;cabal: update cabal files 2024-05-01 16:21:13 -10:00
Simon Michael
f59cb5ff3c ;cabal: update cabal files 2024-04-18 13:33:43 -10:00
Simon Michael
dc8eedc16b ;cabal: update cabal files 2024-04-11 11:15:41 -10:00
Simon Michael
697e5a5671 ;cabal: update cabal files 2024-02-28 15:34:11 -10:00
Simon Michael
a0922a3866 ;cabal: update cabal files 2024-01-04 08:25:13 -10:00
Simon Michael
fbd2fdef40 ;cabal: update cabal files 2023-12-14 08:58:02 -10:00
Simon Michael
ab313c49c7 ;cabal: update cabal files 2023-12-02 09:09:07 -10:00
Simon Michael
a8062381dd ;cabal: update cabal files 2023-11-22 22:57:36 -10:00
Simon Michael
bdf292b377 ;cabal: update cabal files 2023-10-04 10:03:35 +01:00
Simon Michael
ce41252998 ;cabal: update cabal files 2023-09-11 09:56:35 +01:00
Simon Michael
8d429b5ac4 pkg:cabal: update cabal files 2023-07-01 08:14:23 -10:00
Simon Michael
f4508e73d3 ;cabal: update cabal files 2023-06-16 12:11:53 -10:00
Simon Michael
286ee105da ;cabal: update cabal files 2023-06-01 16:34:52 -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
4d7d982f83 ;cabal: update cabal files 2023-03-18 20:06:55 -10:00
Simon Michael
3932bafc78 ;cabal: update cabal files 2023-03-14 10:42:52 -10:00
Simon Michael
f75110f49c ;cabal: update cabal files 2023-03-11 13:27:25 -10:00
Simon Michael
b83eb136cc ;cabal: update cabal files 2023-03-10 19:14:30 -10:00
Simon Michael
3ae9a5e0bc ;cabal: update cabal files 2023-01-26 22:11:20 -10:00
Simon Michael
0de3acabcb cabal: update cabal files 2023-01-25 19:16:08 -10:00