Commit Graph

3878 Commits

Author SHA1 Message Date
Simon Michael
8bd9d92981 imp:timeclock: improve overlapping sessions error [#2417] 2025-09-01 06:03:26 +01:00
Simon Michael
04e6c140c0 imp:timeclock: more informative error output for clashing sessions [#2417] 2025-08-31 17:35:13 +01:00
Simon Michael
539a876e7a ;dev:Timeclock: indentation 2025-08-31 16:20:58 +01:00
Simon Michael
e6dbe5d231 fix:timeclock: sessions can begin at a same-named session's end time
Now we process entries in a more careful order: time, then parse
order, like journal format. This fixes the original issue and another
one mentioned at #2417.
2025-08-31 12:01:04 +01:00
Simon Michael
5a3e34cc55 imp:timeclock: syntax is more robust and featureful
The default timeclock parser (ie when not using --old-timeclock) has
the following changes, related to issues such as
[#2141], [#2365], [#2400], [#2417]:

- semicolon now always starts a comment; timeclock account names can't include semicolons
  (though journal account names still can)
- clock-in and clock-out entries now have different syntax
- clock-ins now require an account name
- clock-outs now can have a comment and tags
- the doc has been rewritten, and now mentions the --old-timeclock flag

- lib: accountnamep and modifiedaccountnamep now take a flag to allow semicolons or not
2025-08-31 10:58:37 +01:00
Simon Michael
97899f9a9b feat:csv: support data generating scripts
and rewrite the rules reader.
2025-08-28 21:38:38 +01:00
Simon Michael
c7878e88da lib:Hledger.Utils.IO: add warnIO 2025-08-28 21:38:38 +01:00
Simon Michael
b22f94007f dev: source, archive, rules reader: improve docs 2025-08-28 21:38:38 +01:00
Simon Michael
e796a00fc4 dev:import: drop archiving of original data
just archive clean data
2025-08-28 21:38:38 +01:00
Simon Michael
b64ddfe813 dev:rules reader: drop "fall back to reading latest archived" 2025-08-28 21:38:38 +01:00
Simon Michael
c60ec90756 dev:import: improve buggy detection of import command 2025-08-28 21:38:38 +01:00
Simon Michael
c515fedf70 feat:csv: support data cleaning scripts 2025-08-28 21:38:38 +01:00
Simon Michael
c930fd0952 imp:end value reports: future P directives don't influence report end/valuation date [#2445]
In end-value reports with unspecified end date, a market price later
than the latest transaction can extend the default report end date and
valuation date. Now, only market prices on or before "today" can do this;
market price declarations dated in the future will be ignored.

Report span and valuation date calculations have been clarified.
2025-08-28 17:26:42 +01:00
Simon Michael
4e52c7bd76 ;lib:spanExtend: improve doc 2025-08-28 17:26:42 +01:00
Stephen Morgan
ef5c220690 fix: balance: Clip account names in generateMultiBalanceAccount, not before (#2434)
Previously accounts were clipped in getPostings, however compound
balance reports re-use the output of getPostings for the different
subreports. This caused a problem when clipping erased the information
needed to determine the account type, as would be used by e.g.
incomestatement.

Add some extra tests for --count.
2025-08-28 05:26:42 +01:00
Simon Michael
8951e11584 fix:import: don't erase .latest files when there are no new txns [#2444]
Fixes a regression caused by the #2125 fix.
2025-08-25 19:25:52 +01:00
Simon Michael
e2bb24e902 dev: make LatestDatesForFile showable 2025-08-25 19:24:38 +01:00
Simon Michael
03262f3fff fix📟 don't use --mouse in default less options
Avoid an error on systems where less does not have mouse support.
2025-08-22 07:56:13 +01:00
Simon Michael
cb1d6a71a6 dev:import:archive: fix bugs in new code
Too hard to rebase
2025-08-14 19:22:52 +01:00
Simon Michael
7dfe2d84e7 dev:import: fix debug message 2025-08-14 17:52:54 +01:00
Simon Michael
88b451d6eb imp: when source rule finds no files, read the latest archived 2025-08-14 14:23:53 +01:00
Simon Michael
3dec0a8944 dev: indentation 2025-08-14 14:23:53 +01:00
Simon Michael
76dc6d089a feat:import:archive: archive data files, and process oldest first 2025-08-14 12:54:40 +01:00
Simon Michael
db7783b16d dev: cleanups 2025-08-14 12:54:40 +01:00
Simon Michael
bfbef4bcbb dev: refactor PrefixedFilePath 2025-08-14 12:37:11 +01:00
Simon Michael
cc3923d6d4 imp: the all: query now requires at least one posting 2025-08-03 06:34:00 +01:00
Simon Michael
f604b7a416 fix: accounts: a tag: query only matches account tags, not posting tags
Eg, `hledger accounts tag:t` lists only account a from this journal:

    account a  ; t:

    2025-01-01
        a          1
        b         -1  ; t:
2025-08-03 05:38:33 +01:00
Simon Michael
e69c72a6c7 dev: include: revert wrong error position fix; refactor
Errors in the main file are being reported a few lines too high,
due to the setOffset in includedirectivep.

It seems reverting this should have restored the original bug with
wrong line number in certain include error messages, but I can't find
that right now.
2025-07-28 11:57:46 +01:00
Simon Michael
79fbfb9f5f dev: Hledger.Utils.Parse: cleanups 2025-07-18 07:31:05 -07:00
Simon Michael
c48c41bcd2 dev:timeclock: cleanups 2025-07-18 07:17:45 -07:00
Simon Michael
b7e35f84a2 imp: include: add hidden --old-glob flag to restore old dot behaviour
This disables the workaround for Glob#49, allowing glob patterns to
find dot files and traverse dot directories again (sometimes too much).
2025-07-17 08:00:08 -07:00
Simon Michael
01e0c34b85 dev: Hledger.Utils.IO: getFlag helper, like getOpt 2025-07-17 07:51:05 -07:00
Simon Michael
5ec770badd imp: include: more flexible **; show the correct line in read errors 2025-07-16 06:52:19 -07:00
Simon Michael
b35dcfda28 imp: include: give a clearer error for trying to include a csv file
And note that other read errors may be unclear when occurring in included files.
2025-07-16 06:52:19 -07:00
Simon Michael
8215f19baa dev: include: cleanup 2025-07-16 06:52:19 -07:00
Simon Michael
3741f9f030 fix: include: report read failures with correct line number 2025-07-16 06:52:19 -07:00
Simon Michael
2dcfe22c89 imp: include: report ** without / as an error, for clarity 2025-07-16 06:52:19 -07:00
Simon Michael
460ae28826 imp: include: globs exclude current file; more cleanup 2025-07-16 06:52:19 -07:00
Simon Michael
b4a1add267 imp: include: more robust tests and glob pattern handling
This switches from filepattern back to Glob, which is more powerful.
New notes, implementation, workarounds and tests.
2025-07-16 06:52:19 -07:00
Simon Michael
1046f652b1 dev: PrefixedFilePath cleanups
And some helpers that weren't needed after all, but maybe in future
2025-07-16 06:52:19 -07:00
Simon Michael
28f60bcf92 dev: includedirectivep: refactor 2025-07-11 20:34:50 -07:00
Simon Michael
3a03927018 imp: include: show including file path in debug output 2025-07-11 20:12:13 -07:00
Simon Michael
0add2e90db imp: include: glob patterns always exclude the current file
Eg include **/*.journal is less likely no complain
2025-07-11 19:36:17 -07:00
Simon Michael
08017366b5 imp: file reading: demote some debug=6 output to level 7 2025-07-11 13:48:58 -07:00
Simon Michael
536589e2c2 imp: include: improve cycle and read failure error messages 2025-07-11 13:36:47 -07:00
Simon Michael
b71e001c51 imp: include: more robust ** patterns, and ignore dotted directories
** now ignores anything under dotted directories, ie directories whose
name begins with a dot. Eg .git/, foo/.secret/, etc.

Switched from Glob to filepattern lib.
2025-07-11 13:36:47 -07:00
Simon Michael
b1f416dee7 dev: parseIncludedFile: doc cleanup 2025-07-11 13:01:54 -07:00
Simon Michael
b7c4dc3b53 fix:journal: cyclic include error messages now show the correct line 2025-07-11 13:00:51 -07:00
Simon Michael
801a7adaa4 imp:include: better errors, eg for missing argument; more debug output 2025-07-11 12:13:52 -07:00
Simon Michael
c8a5b8eb37 dev: includedirectivep: cleanup 2025-07-11 12:13:12 -07:00
Simon Michael
f5d3b7bd38 fix:journal: include directive error messages now show the correct line
They were showing the line after the include directive, confusingly.
2025-07-11 11:55:29 -07:00
Simon Michael
251af8529f dev: Hledger.Utils.Parse: cleanups 2025-07-11 11:38:50 -07:00
Simon Michael
2815a1865f dev: includedirectivep: cleanups, docs 2025-07-11 11:38:50 -07:00
Simon Michael
b23af9275d imp: simplify bad account type error message 2025-07-09 12:00:13 -07:00
jneubrand
7482f1efc3 fix: use precompiled regexes to handle case insensitivity correctly 2025-07-03 14:25:50 -07:00
Simon Michael
fc93a4c644 fix:add: show green prompts properly instead of ANSI codes [#2410] 2025-07-01 16:41:05 -07:00
savanto
230998136f imp: areg: do not abbrev other accts in machine-readable output (#1995)
- Do not turn "other accounts" into a comma-delimited string when the
  report is constructed, but pass `AccountName`s up the chain. This
  requires modifying the `AccountTransactionsReportItem` type to contain
  `[AccountName]` rather than `Text`.

- Perform the account name summarization
  (`Hledger.Data.AccountName.accountSummarizedName`) closer to the
  actual rendering of the report, so that different report formats can
  choose summarization strategy.

- Continue to summarize as before for terminal/text output (ie.
  human-readable). Do not summarize any more for machine-readable output
  (csv/html/fods).
2025-06-28 13:38:58 -07:00
Stephen Morgan
8ab2fb6b77 feat: lib: Allow special string %account in auto-posting rules (#1975)
This allows using the special string `%account` in auto posting rules.
When run, this will be substituted with the account name of the matched
posting.
2025-06-24 10:12:57 -07:00
Simon Michael
714b346fdd imp: fully support quarter syntax in smart dates and period expressions 2025-06-23 18:37:08 -07:00
Simon Michael
afd18a10bf fix: show historical balances even if report period is empty [#2403]
This adds a safer version of spanDefaultsFrom that won't create spans
that end before they start, and updates all reports to use it.

The only related change noticed so far is that close now gives an
error instead of a malformed entry, when there's no data to close.
[#2409]
2025-06-15 22:42:58 -10:00
Simon Michael
9c7e5b2467 dev:MultiBalanceReport: consistent debug output labels 2025-06-15 22:16:50 -10:00
Simon Michael
427a5de1f3 dev:MultiBalanceReport: use error' consistently for clean output 2025-06-15 22:06:34 -10:00
Simon Michael
4a5775da71 imp: commodities/payees/tags: used/declared flags, like accounts
And general cleanup of options and help across
the accounts, commodities, payees, tags commands.
2025-06-15 07:32:40 -10:00
Simon Michael
38aadddf7b dev: Hledger.Query.matchesCommodity: check all query types, not just cur:
And default to False (unlike the other match functions. Ok ?)
2025-06-15 07:32:40 -10:00
Simon Michael
d3c86bafdf ;doc: finalise changelogs for 1.43.2 on 2025-06-13 2025-06-13 12:05:20 -10:00
Simon Michael
cc95eca1ce ;doc: update changelogs 2025-06-13 12:05:20 -10:00
Simon Michael
bd2d8728d1 fix: txn balancing: fix logic for the 1.50 message [#2402]
and add more tests.
2025-06-13 09:10:46 -10:00
Simon Michael
16fd84166a ;dev: cleanup 2025-06-12 18:48:48 -10:00
Simon Michael
57031b0e78 dev: rename exitOnError -> handleExit, improve doc 2025-06-12 18:48:10 -10:00
Simon Michael
0750a27d00 dev: ignore SIGPIPE errors from truncated output in a more robust way [#2405] 2025-06-12 18:36:41 -10:00
Simon Michael
cda62d9a59 ;dev: change "1.44" to "1.50" in docs and error messages 2025-06-12 17:55:13 -10:00
Simon Michael
0d388a6f93 ;imp: show a more helpful error for transactions unbalanced by upgrade [#2402]
(and drop the last sentence from the single-commodity unbalanced
transaction error)
2025-06-12 17:55:13 -10:00
Simon Michael
de4d637def dev: transaction balancing: cleanup [#2402] 2025-06-12 17:55:13 -10:00
Simon Michael
bf90b20f2c imp: --txn-balancing flag to select transaction balancing precision [#2402] 2025-06-12 17:55:13 -10:00
Simon Michael
442bd24bc5 ;dev: commodityStyleFromRawOpts: cleanup 2025-06-12 17:55:13 -10:00
Simon Michael
a9408b8cd5 imp:journal: balance transactions with local precisions [#2402] 2025-06-12 17:55:13 -10:00
Simon Michael
82ba831822 dev: move commodityStylesFromAmounts to Hledger.Data.Amount
Also drop canonicalStyleFrom, seems unused.
2025-06-12 17:55:13 -10:00
Simon Michael
eb6b48dded fix:cli: don't raise an error if output is truncated in a pipe [#2405]
This broke in 1.43.

Now we ignore any IOException whose message contains "broken pipe".
Hopefully this matches pre-1.43 behaviour and doesn't hide real errors.
2025-06-12 17:55:13 -10:00
Simon Michael
41e62885c4 dev: avoid a strange vscode/Haskell highlighting bug 2025-06-07 15:28:41 -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
2899b46c59 ;doc: update embedded manuals 2025-06-04 07:31:18 -10:00
Simon Michael
af9822a60a ;cabal: update cabal files 2025-06-04 07:31:13 -10:00
Simon Michael
a0a539cb66 ;pkg: set version to 1.43.99 2025-06-04 07:31:12 -10:00
Simon Michael
847567095d ;doc: finalise changelogs for 1.43.1 on 2025-06-03 2025-06-03 18:44:40 -10:00
Simon Michael
c2972b3d5d ;pkg: update tested-with 2025-06-03 18:44:40 -10:00
Simon Michael
b67379c3d8 fix: cur: in posting-based reports filters multicommodity amounts again [#2396] 2025-06-03 18:44:08 -10:00
Simon Michael
6daba4edb8 dev: refactor journalValueAndFilterPostingsWith a bit [#2396] 2025-06-03 18:44:08 -10:00
Simon Michael
bdd2018663 lib:Hledger.Query: queryIsAmtOrSym 2025-06-03 18:44:08 -10:00
Simon Michael
5bbf31096d ;lib: note an issue with filterQuery 2025-06-03 18:44:08 -10:00
Simon Michael
959be5f51d fix:lib:Hledger.Query: parseQueryTerm: don't call error for a bad amt: argument 2025-06-03 10:10:04 -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
Simon Michael
59387cbf6b ;doc: finalise changelogs for 1.43 on 2025-06-01 2025-06-01 12:31:24 -10:00
Simon Michael
d9c512deee ;doc: changelogs 2025-06-01 12:31:24 -10:00
Michael Rees
0c3e7bc395 Always check added transaction, even if no immediate assertion 2025-05-31 23:19:47 -10:00
Michael Rees
b042115692 Ignore assertions during add with -I 2025-05-31 23:19:47 -10:00
Michael Rees
5a4aa87df8 Clarify some code after review 2025-05-31 23:19:47 -10:00
Michael Rees
17f914e571 imp: add: Verify balance assertions on each posting (#2355) 2025-05-31 23:19:47 -10:00
Simon Michael
713773cfc3 imp: simplify the unicode decode error message; refactor 2025-05-30 09:43:30 -10:00
Simon Michael
4587eccdf4 ;fix: recognise another case of text decoding failure 2025-05-29 12:25:06 -10:00
Simon Michael
e360e50497 imp:csv: more --debug=2 output for if rules
Also, in debug output show records more like what matchers are seeing,
ie with quotes removed.
2025-05-22 17:05:45 -10:00