Commit Graph

371 Commits

Author SHA1 Message Date
d387b7c2ab Add links to URI-valued tags 2026-01-22 10:34:48 +02:00
961fd71e57 Display transaction code in hledger-web 2026-01-16 12:02:15 +02:00
10c71cb447 Display posting tags in hledger-web 2026-01-16 11:48:59 +02:00
e5ac735110 Display transaction tags in hledger-web 2026-01-16 09:53:21 +02:00
0098ac874f Translate to Finnish 2026-01-14 12:30:12 +02:00
Simon Michael
b2a0de75e2 dev: balanceTransaction -> balanceSingleTransaction 2025-11-18 09:39:16 -10:00
Simon Michael
2f007c93d2 dev: switch all qualifed imports to ImportQualifiedPost style 2025-09-29 19:28:59 -10:00
Simon Michael
a2af816611 dev:Hledger.Utils.IO: inputToHandle -> textToHandle; set utf8 not utf8_bom 2025-09-26 01:08:48 -10:00
Simon Michael
e64c26e603 lib!: rename withJournal -> withJournalDo, with alias and deprecation warning 2025-09-11 10:03:10 +01:00
Simon Michael
de66e266f1 fix:web: dragging in chart now selects date ranges more accurately
Eg, previously you couldn't select a range including transactions
at the rightmost edge of the chart.
2025-06-29 11:05:38 -07:00
Simon Michael
57031b0e78 dev: rename exitOnError -> handleExit, improve doc 2025-06-12 18:48:10 -10:00
Stephen Morgan
80cf1d1995 !dev: lib: Allow Account to store date-indexed balances.
This upgrades Account to enable it to store a multiperiod balance, with
a separate balance for each date period. This enables it do the hard
work in MultiBalanceReport.

Some new types are created to enable convenient operation of accounts.
- `BalanceData` is a type which stores an exclusive balance, inclusive
  balance, and number of postings. This was previously directly stored
  in Account, but is now factored into a separate data type.
- `PeriodData` is a container which stores date-indexed data, as well as
  pre-period data. In post cases, this represents the report spans,
  along with the historical data.
- Account becomes polymorphic, allowing customisation of the type of
  data it stores. This will usually be `BalanceData`, but in
  `BudgetReport` it can use `These BalanceData BalanceData` to store
  both actuals and budgets in the same structure. The data structure
  changes to contain a `PeriodData`, allowing multiperiod accounts.

Some minor changes are made to behaviour for consistency:
- --declared treats parent accounts consistently.
- --flat --empty ensures that implied accounts with no postings are not displayed, but
  accounts with zero balance and actual postings are.
2025-06-04 23:10:00 -10:00
Simon Michael
a591d26ecb ;dev:web: fix compilation warning in MiscR.hs 2025-06-03 18:43:31 -10:00
Simon Michael
53b15ebd4a ;dev:web: use embedFileRelative, like others 2025-06-03 11:22:05 -10:00
Simon Michael
2a4718d40a fix: make a few more error messages consistent, hiding call stack [#2367] 2025-06-03 10:10:04 -10:00
Ben Sima
4e9aa5825d feat: web: serve openapi.json
Serving the OpenAPI JSON schema means that clients can auto-discover how
to use the API. I am particularly interested in this because open-webui
can use OpenAPI to add context to LLM responses.
2025-05-23 15:21:22 -10:00
Simon Michael
78baaee6c5 lib: more version helpers, rename to HledgerBinaryInfo, silence warnings 2025-04-25 09:36:38 -10:00
Simon Michael
06cd0f9472 lib: exitOnExceptions -> exitOnError 2025-04-25 08:32:47 -10:00
Simon Michael
d1e4d00b8d lib: Cli,UI,WebOptions: export binaryinfo 2025-04-25 08:26:14 -10:00
Simon Michael
5334e7924b lib: Hledger.Cli.Version: rename PackageVersionString, more helpers 2025-04-21 15:14:12 -10:00
Simon Michael
9340b73aae imp: improve/format errors for various failures [#2367]
These now call error' and show errors in the standard style:

- reading a nonexistent data file
- reading an unsafe dotted file name on windows
- web: using --socket on windows
- demo: demo not found
- demo: error while running asciinema
- diff: bad arguments
- print --match: no match found
- register --match: no match found
- roi: no investment transactions found
2025-04-11 08:06:47 -10:00
Simon Michael
454c669fe4 fix:cli,ui,web: consistent console error output independent of GHC version [#2367]
Hledger.Utils.IO helpers have been updated and new ones have been
added (exitOnExceptions, exitWithError) to allow consistent display of
program errors whether compiled with GHC <9.10, GHC 9.10, or GHC >9.10.
The trailing newlines added by GHC 9.10 are gone,
and so is the "uncaught exception" output added by GHC 9.12.
2025-04-11 08:06:47 -10:00
Simon Michael
20226283b8 ;pkg: tweak LICENSE files, try to get github to recognise 2025-03-31 18:18:10 -10:00
Simon Michael
47bb40f838 ;pkg: clean up LICENSE files, main module licensing headers 2025-03-31 18:10:19 -10:00
Thomas Miedema
c565dbc4f6 ;dev: web: drop base-compat dependency 2025-03-31 16:21:38 -10:00
Simon Michael
02ef6e45e7 imp:cli: make mutually exclusive flags clearer in --help 2025-03-08 12:42:16 -10:00
Simon Michael
7aae0d9595 imp:web: add an explicit --serve-browse flag, for consistency 2025-03-08 12:41:03 -10:00
Simon Michael
2f0cb50997 imp!:web: deprecate and hide the --server flag, recommend --serve 2025-03-08 11:57:01 -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
f648903b37 imp:print:beancount: don't add account tags to postings
When print is generating beancount output, turn off the usual
inheritance of account tags by postings; it would generate excessive
metadata in the journal. Beancount can do or not do that kind of
inheritance itself.
2024-12-06 05:55:42 -10:00
Simon Michael
80fa7e2db6 dev:clarify: rename jinferredcommodities to jinferredcommoditystyles 2024-11-02 15:52:07 -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
7325b75d5b imp: rename ghcdebug build flag to debug, and enable stack traces with it
Builds made with ghc 9.10+ and the 'debug' build flag, will show
(some kind of, partial) stack traces when the program ends with an
error. (And also will have ghc-debug support enabled.)

The stack traces will probably improve in due course.
2024-10-19 18:47:03 -10:00
Simon Michael
b6a5687a38 imp: cli, web: disable ghc 9.10+'s stack traces here too
Starting to see them also from hledger now.
2024-10-19 18:33:58 -10:00
Simon Michael
6893f342af imp: cli,ui,web: begin controlling GHC 9.10+'s stack traces 2024-10-19 16:56:14 -10:00
Simon Michael
b940254025 imp:cli: detect --color more safely in most cases
--color now also works in a config file, like --pager, except for two
cases: it does not affect colouring of debug output, or the colouring
helpers used in the check recentassertions error message.
2024-10-19 16:28:36 -10:00
Simon Michael
711d921774 imp:cli: --no-pager -> --pager, make this and --color safe options 2024-10-19 16:28:36 -10:00
Simon Michael
1c45496f1c dev: web: fix build with ghc <9.2 2024-09-30 17:20:13 -10:00
Henning Thielemann
b74815287d web: RegisterR.getRegisterR.addCommas: do not drop last account
Bug was introduced in commit 2a99b3d456
in an effort to get rid of partial List.tail,
because GHC-9.8 started to warn about it.

Problem is that the rewritten code with tailDef always removes the last account,
whereas the original intention was to replace all accounts by a comma except the last one.
addCommas should prepare a comma separated list like List.intercalate.
2024-09-24 20:42:32 -10:00
Simon Michael
fa8d223858 imp: web: guess a more robust base url when --base-url is not used
A followup to #2099, #2100 and #2127. Now relative links to js/css
resources will use the same hostname etc. the main page was requested
from, making them work better when accessed via multiple IP
addresses/hostnames without an explicit --base-url setting.
2024-07-18 10:12:40 +01:00
Simon Michael
13a5299237 imp: web: require a http[s] scheme in --base-url
Previously it accepted just a hostname, and generated bad links.
2024-07-18 10:10:26 +01:00
Simon Michael
c0a4983e87 ;dev: web: refactor 2024-07-18 09:14:56 +01:00
Simon Michael
6c294e91d6 fix: ui, web: accept valueless --debug flag again 2024-06-25 18:37:55 +01:00
Simon Michael
46cda5e7de imp: cli: allow command options to be written before the command also
It's clearer to write command-specific flags after the command name
argument, but that's no longer required.
(Writing non-builtin, addon-specific flags after -- is still required).

Also, give up on "obey help/doc/version flags even if there's a bad
command/flag", it's too hard to do well.
2024-06-25 18:37:54 +01:00
Simon Michael
311be367b0 ;doc: cli: simplify, use generic help flags again 2024-05-31 19:54:18 -10:00
Simon Michael
c5f8444627 feat: hledger's tldr pages are now built in, accessible via --tldr
And a few cleanups/fixes related to flag processing.
The help flags are now listed in order of precedence.
2024-05-29 15:32:19 -10:00
Simon Michael
82230e5a1f imp: cli: end help output with a blank line 2024-05-29 14:45:04 -10:00
Simon Michael
f88aa8f871 imp: cli: --info before --man 2024-05-29 09:37:20 -10:00
Simon Michael
a366f3aeaa imp: ui, web, cli, all cli commands now show the general flags grouped
And cli/ui/web each have their own more specific help flags.
2024-05-29 09:37:19 -10:00
Simon Michael
d17b32c7eb imp: cli,ui,web: support ghc-debug for analysing memory/profile info
When built with the ghcdebug flag and started with --debug=-1 (or -2
to pause at startup, or -3 to pause before exit), hledger can be
controlled by ghc-debug clients like ghc-debug-brick or a custom
ghc-debug query script.

Also, refactor version string code.
2024-05-01 13:43:04 -10:00