Commit Graph

1947 Commits

Author SHA1 Message Date
Simon Michael
3797fe13d3 imp: move --debug to help flags, making it more universal 2024-06-25 18:37:54 +01:00
Simon Michael
e1991be46f feat: config file: add a real parser, support command-specific options 2024-06-25 18:37:54 +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
570a5472e2 dev: cli: refactor/clarify main procedure and command line processing 2024-06-25 18:37:54 +01:00
Simon Michael
204df22739 feat: cli: basic config file support for hledger
And some refactoring of command line parsing code.

General options only, in ./hledger.conf, for now.
2024-06-25 18:37:54 +01:00
Simon Michael
de617ec91b imp: balcmds: improve html output; refactor
The Total: row headings are now configurable in one place,
and currently disabled for text output and enabled for csv & html.

The balance commands' HTML output no longer repeats the "total" and
"Net" headings when the totals row has multiple lines.
And the layout has been improved and made more consistent with the
text output.
2024-06-12 18:04:56 +01:00
Simon Michael
85dde3bac9 dev: refactor: balance report rendering 2024-06-12 15:28:51 +01:00
Simon Michael
1b4b079f4d imp: balcmds: with --pretty, show table and inter-column borders 2024-06-12 05:02:08 +01:00
Simon Michael
574115e001 imp: balcmds: csv, html output: change "total" row header to "Total:" 2024-06-12 05:02:08 +01:00
Simon Michael
9788a06223 fix: balcmds: don't repeat "total" and "Net:" headers in HTML output 2024-06-12 05:02:04 +01:00
Simon Michael
1a242c1264 dev: refactor table rendering code
- Consolidate some table rendering helpers in Balance.hs
- Rename, document for clarity
- Extract parameters for controlling table borders
- hlint suggestions
2024-06-12 05:01:48 +01:00
Simon Michael
1260a68596 dev: CompoundBalanceCommand: refactor table rendering 2024-06-12 05:01:48 +01:00
Simon Michael
4900072ff8 imp: mention the tldr --render flag in the failure warning [#2201] 2024-06-08 13:29:32 -07:00
Simon Michael
971396a34e imp: discourage auto-update of tldr db when using tldr-node-client 2024-06-08 10:23:05 -07:00
Simon Michael
4772001fe5 fix: make --tldr compatible with the tealdeer client also 2024-06-08 10:22:44 -07:00
Simon Michael
91d5308783 ;tools: Shake cmdhelp -> cmddocs, now runs hledger to update flag docs
Now, updating a command's docs (for hledger manual and for --help) requires
running the command (with stack exec -- hledger). The sequence is now
a bit recursive:

1. Run hledger CMD -h to update CMD.md with the latest cmdargs help output for CMD's flags.
   CMD.md is included in the hledger manual, when rendering that.
2. Convert CMD.md to CMD.txt, with pandoc.
3. Build hledger, embedding CMD.txt for cmdargs to use as -h output.

This need only be done after changing command docs or flags, and
hopefully won't be a hassle. Shake cmddocs now shows progress output
to make things clearer.
2024-06-07 14:35:31 -07:00
Simon Michael
c3e9255488 ;imp: bal: drop blank line in flags help 2024-06-07 14:11:44 -07:00
Simon Michael
c4e138dfb1 ;doc: update help 2024-06-07 07:05:52 -07:00
Simon Michael
3e13f39f94 imp: diff, prices: improve help layout 2024-06-07 07:05:35 -07:00
Simon Michael
c787286844 imp: doc: show flags help in manuals
Each CMD.md file now contains a snapshot of the flags help as rendered
by --help. For now these must be updated manually.
2024-06-07 06:55:33 -07:00
Simon Michael
0ccfc78844 ;dev: cleanup 2024-06-07 06:32:52 -07:00
Simon Michael
311be367b0 ;doc: cli: simplify, use generic help flags again 2024-05-31 19:54:18 -10:00
Simon Michael
7f583a8414 ;doc: correction, NO_COLOR does not override --color=yes 2024-05-31 18:16:33 -10:00
Simon Michael
77ee3fd846 ;doc: update command help 2024-05-29 17:02:03 -10:00
Simon Michael
d47513c669 ;doc: sync command summaries between manuals and tldr, updating both 2024-05-29 17:00:11 -10:00
Simon Michael
9d53698eab ;imp: cli: also mention 'y' and 'n' in help 2024-05-29 16:12:44 -10:00
Simon Michael
7d0e605bc3 ;imp: cli: improve --debug's help 2024-05-29 16:09:53 -10:00
Simon Michael
29567a3b29 imp: --tldr: show the source if 'tldr' is not installed 2024-05-29 15:37:48 -10:00
Simon Michael
f3eba65726 ;doc: update command help 2024-05-29 15:32:19 -10:00
Simon Michael
3a387fab47 imp: cli: commands list: cleanup 2024-05-29 15:32:19 -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
c35eed5506 imp: cli: fix help headings highlighting 2024-05-29 14:45:04 -10:00
Simon Michael
d4dcbbd4c8 fix: help, --man: fix jumping to TOPIC when viewing a man page
And clarify exact/prefix matching behaviour.
2024-05-29 09:37:20 -10:00
Simon Michael
085910708b imp: help: add standard help and (hidden) --debug flags 2024-05-29 09:37:20 -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
ffb52e3032 imp: cli: refactor, reorg, update general flags 2024-05-28 23:44:29 -10:00
Simon Michael
8ad803cae7 ;doc: add: drop lengthy transcript, add simpler example commands (from tldr) 2024-05-23 16:22:58 -10:00
Simon Michael
46b79079bf ;doc: The flattening: adapt to the site's depth-1 page TOCs
and tweak command/screen headings.

This goes further in the direction of showing simple lists of topics
instead of outlines. mdbook-toc doesn't support configuring the TOC
depth this per page, so it has to be site wide.

Overall I feel this is better, see eg the hledger manual.  It hides a
lot of interesting topic names but a shorter, linear list is less
scary and clearer than a huge scrolling outline. Once you click in to
a section and find a subsection of interest, it's still easy to
bookmark/share those by clicking their heading.
2024-05-22 13:06:08 -10:00
Simon Michael
235cb3d8e2 fix:pkg: fix a build error with ghc 8.10 [#2198] 2024-05-17 14:48:32 -10:00
Simon Michael
e3a67b197e ;doc: bal: mention --summary-only 2024-05-09 14:47:53 -10:00
Simon Michael
1d2f85432d ;doc: include ui, web in commands in TOC 2024-05-09 14:20:32 -10:00
Simon Michael
b7219f8935 ;doc: reorganise the commands list in manual to match cli, improve links 2024-05-09 13:56:09 -10:00
Simon Michael
802bdd3433 imp: cli: commands list: updates 2024-05-07 16:49:34 -10:00
Simon Michael
b7e5c05da2 imp: -I can now be overridden by -s or the check command
This enables a "relaxed" workflow where you delay balance assertions
checking until strict mode is turned on: always run hledger -I, and
add -s when you're ready.
2024-05-07 15:44:06 -10:00
Simon Michael
ad90de62d3 ;doc: check: edits 2024-05-02 21:58:52 -10:00
Simon Michael
8975988015 ;doc: check: ordereddates: edit 2024-05-02 21:46:48 -10:00
Simon Michael
ea58a7ccd7 imp: check: check ordereddates before balance assertions, when both are enabled 2024-05-02 21:11:04 -10:00
Simon Michael
4abb8ffc2e ;doc: check: expand check descriptions 2024-05-02 19:59:00 -10:00
Simon Michael
fe1fc313ba imp: cli: commands list: more cleanup 2024-05-02 18:44:18 -10:00
Simon Michael
16e00062d3 fix: cli: don't re-list known installed addons in final section 2024-05-02 17:19:46 -10:00
Simon Michael
8666b5edc0 imp: cli: a commands list refresh 2024-05-02 12:24:33 -10:00
Simon Michael
b13949c7b8 imp: cli: commands list: drop dedicated entry for hledger-stockquotes 2024-05-02 11:38:42 -10:00
Simon Michael
96caa8f352 fix: detect ghc-debug support more accurately, checking hledger-lib also 2024-05-01 15:27:42 -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
Simon Michael
55401282a0 imp: run checks in a well-defined order; and tweak that order
Now commodities are checked before accounts, and tags before recentassertions.
Also some check doc cleanups.
2024-04-26 18:59:45 -10:00
Simon Michael
4cbf72ab1f imp!: check ordereddates: drop --date2 support; check primary dates only
date2 is a deprecated feature and was getting in the way, so has been dropped
from the ordereddates check, simplifying it.
2024-04-26 18:59:45 -10:00
Simon Michael
9ffa990e9e fix: balcmds: show digit groups marks in html output again [#2196]
This broke in 1.25.
2024-04-25 08:09:10 -10:00
Simon Michael
2a67aa327b ;doc: import: edits 2024-04-24 15:54:09 -10:00
Simon Michael
210f28a7b5 ;doc: import: edits 2024-04-24 15:49:51 -10:00
Simon Michael
13cf8de1a1 ;doc: import: edits 2024-04-24 15:04:54 -10:00
Simon Michael
061580f0bc ;doc: import: Skipping -> Date skipping 2024-04-24 14:47:42 -10:00
Simon Michael
7911a4b29a ;doc: import: edits 2024-04-24 14:39:34 -10:00
Simon Michael
3863623ed9 ;doc: import: rename/expand/link commodity styles section 2024-04-24 14:32:20 -10:00
Simon Michael
3bc1bd2c75 imp:cli:commands list: move HELP, UIS to top; cleanups 2024-04-19 01:19:58 -10:00
Simon Michael
13c5827ad7 fix: add: don't show ANSI escape codes when they're not supported 2024-04-18 23:19:21 -10:00
Simon Michael
0edf99350a ;doc: update command help 2024-04-18 13:35:09 -10:00
Simon Michael
28abe5e9ff ;doc:bse: links 2024-04-11 11:55:37 -10:00
Simon Michael
d9b5ed7bb2 ;doc:bse: note requirements for checking the AE 2024-04-11 11:51:44 -10:00
Simon Michael
ff3af71c4e ;doc: update command help 2024-04-11 11:15:44 -10:00
Simon Michael
e2cc2a70ac ;doc:bs,bse,cf,is: update sample output 2024-04-11 11:13:18 -10:00
Dmitry Astapov
08a5f1ee78 ;fix: roi correctly interacts with --value (fixes #2190) 2024-04-01 08:37:31 -10:00
Simon Michael
3f184a848a ;doc: import: deduplication: edits 2024-03-27 09:23:28 -10:00
Simon Michael
080184d2e5 ;doc: import: deduplication: edits 2024-03-27 09:14:30 -10:00
Simon Michael
57ad739227 ;doc: import: deduplication: updates 2024-03-27 09:12:03 -10:00
Simon Michael
5519f4ac2e ;doc: import: edits 2024-03-24 15:13:56 -10:00
Simon Michael
2889bb6efb ;doc: update command help 2024-03-24 14:51:25 -10:00
Simon Michael
eb6b94ad5a ;doc:import: deduplication -> skipping 2024-03-24 14:51:16 -10:00
Simon Michael
70b75e4921 ;doc: update command help 2024-03-24 14:22:37 -10:00
Simon Michael
be24d6505f ;doc:import: rewrite deduplication section 2024-03-24 14:21:44 -10:00
Simon Michael
b605b5bfd5 ;doc:manuals: fix some code block language types 2024-03-02 11:50:10 -10:00
Simon Michael
afd009db9e ;doc: update command help 2024-03-01 18:09:34 -10:00
Simon Michael
7db8e01200 imp:stats: with multiple reports, add a blank line before runtime stats 2024-03-01 18:09:34 -10:00
Simon Michael
c24054455f imp:stats: be more private by default; update doc
The old details (file paths, commodity names) can be shown
with -v/--verbose.
2024-03-01 09:03:57 -10:00
Simon Michael
0c44eddd4c imp:stats: more compact sub-80-width output 2024-03-01 08:09:51 -10:00
Simon Michael
7e28e38bbc ;doc:balance: cleanups 2024-02-29 23:13:23 -10:00
Simon Michael
d8f86a9b7d ;doc:balance: updates, cleanups 2024-02-29 22:56:23 -10:00
Simon Michael
3e93b69c25 ;doc:balance: consolidated --related/-r doc 2024-02-29 18:14:52 -10:00
Simon Michael
3ec432bd53 dev: rename/improve amountSetFullPrecisionUpTo, add mixedAmountSetFullPrecisionUpTo 2024-02-29 12:31:07 -10:00
Simon Michael
d755699c9b imp:stats: also show RTS memory usage stats 2024-02-29 01:07:04 -10:00
Simon Michael
8f1ae401f4 dev: fix some partial head/tails, silence ghc 9.8's new warnings
Note the headErr/tailErr calls will print stack traces if they fail
(small ones: five lines, one of which is the useful location info),
which may or may not be best UX.
2024-02-28 15:58:21 -10:00
Simon Michael
a4c2776a18 feat:close: support --round, like print 2024-02-25 17:37:59 -10:00
Simon Michael
f70eac2591 imp:close: add --assertion-type option 2024-02-20 20:55:47 -10:00
Simon Michael
9f53e36904 ;imp: close: --assert: make default description "assert balances" 2024-02-20 20:55:27 -10:00
Simon Michael
e9dd01a7db imp:close:--assert/--retain: no tag value; rename --assert's tag to assert: 2024-02-08 06:47:46 -10:00
Michael Rees
d4ecdb3fea imp: Support tsv and ssv prefixes (#2164) 2024-02-08 06:44:44 -10:00
Simon Michael
13baabb880 ;doc: update command help 2024-01-26 22:49:21 -10:00
Simon Michael
df79aa5e35 dev: distinguish oneLineFmt and oneLineNoCostFmt; add fullZeroFmt 2024-01-23 21:35:06 -10:00
Simon Michael
0cb382cf0e dev: rename AmountDisplayOpts -> AmountFormat, and related constants
noColour          -> defaultFmt
noCost            -> noCostFmt
oneLine           -> oneLineFmt
csvDisplay        -> machineFmt
2024-01-23 21:35:06 -10:00
Simon Michael
ca55c2f0f8 dev: rename other Price helpers to Cost
showAmountWithoutPrice             -> showAmountWithoutCost
mixedAmountStripPrices             -> mixedAmountStripCosts
showMixedAmountWithoutPrice        -> showMixedAmountWithoutCost
showMixedAmountOneLineWithoutPrice -> showMixedAmountOneLineWithoutCost
2024-01-23 21:35:06 -10:00
Simon Michael
323f87b3e9 dev: Amount: aprice -> acost
Acked-by: Simon Michael <simon@joyful.com>
2024-01-23 21:35:06 -10:00
Simon Michael
8102bd9c2b dev: AmountPrice,UnitPrice,TotalPrice -> AmountCost,UnitCost,TotalCost; related renames 2024-01-23 21:35:06 -10:00
Simon Michael
e201775e93 dev: amountStripPrices -> amountStripCost 2024-01-23 21:35:06 -10:00
Simon Michael
6091f583dc fix: import: --catchup works again [#2156] 2024-01-21 12:33:15 -10:00
Simon Michael
41711d8ab5 fix:--anon: now hidden, gives an error, still usable as --obfuscate [#2133] 2024-01-21 11:59:11 -10:00
Simon Michael
0cdc012fd9 dev:journalTransform: cleanup 2024-01-21 10:25:55 -10:00
Simon Michael
f3073990cc imp:close: infer a default tag value by incrementing current file name [#2151] 2024-01-21 02:30:33 -10:00
Simon Michael
c2ce1c2037 imp:close: add tags, with optional custom value, for easier matching/exclusion [#2151]
They are `balances:` for assertion transactions,
`retain:` for retained earnings transactions,
and `start` for opening/closing transactions.

And some --help cleanups.
2024-01-21 01:44:14 -10:00
Simon Michael
f53f3a0194 dev:close: refactor 2024-01-20 21:53:46 -10:00
Simon Michael
15b4f9e8d2 ;doc:close: layout 2024-01-20 16:18:25 -10:00
Simon Michael
4b1410c4b5 ;doc:close: fix link 2024-01-20 16:14:35 -10:00
Simon Michael
5d073e16e3 ;doc:close: edits 2024-01-20 16:07:00 -10:00
Simon Michael
6b5b467cce doc:close: edits 2024-01-20 15:43:46 -10:00
Simon Michael
e61c9bad10 ;examples:multi-year: how to show year-end balances in closed files [#2151] 2024-01-20 15:42:38 -10:00
Simon Michael
785206ee94 ;doc:close: rewrite again; and give a better excluding technique [#2151] 2024-01-20 15:42:38 -10:00
Simon Michael
cd72c62858 imp:close: exclude E by default; and always exclude the balancing account [#2151]
The first of some changes discussed on the issue. A more useful default ?
2024-01-20 15:42:38 -10:00
hamzashezad
6afff58fb8 ;doc: add version annotations for features in 1.32
- match groups and match negations
- beancount output format
- tsv output format
- consistently add annotation
- `--round` for print
2024-01-17 00:12:57 -10:00
Simon Michael
d064b12898 ;doc: update command help 2024-01-12 13:55:49 -10:00
Simon Michael
584ab748d5 ;doc:manuals: remove all "experimental" annotations for now, 2 2024-01-12 13:55:39 -10:00
Simon Michael
ebda894b23 ;doc: update command help 2024-01-12 13:52:00 -10:00
Simon Michael
ea99aa9dfb ;doc:manuals: remove all "experimental" annotations for now 2024-01-12 13:47:30 -10:00
Simon Michael
80e4428e77 ;doc:close: improvements 2024-01-06 18:42:46 -10:00
Simon Michael
50441dae04 ;doc:close: improvements 2024-01-06 18:26:53 -10:00
Simon Michael
59999e4ada enh:close: add --assert and --assign modes, generating assertions or assignments 2024-01-06 10:26:33 -10:00
Simon Michael
9ccc1d3fa5 fix:add,import,web: really avoid filenames ending with . on Windows [#1056]
On MS Windows, trying to add or import or web add to a file whose name
ends with a dot could cause data loss, so in 2019 I made this raise an
error instead (in Hledger.Read.ensureJournalFileExists).

But, the logic was backward, so it did not do the check on Windows.
Now it does.

Also I have removed mention of this from add's doc; currently it's
not documented anywhere. It's obscure, but maybe this is not ideal.
2024-01-04 17:35:22 -10:00
Simon Michael
d462611d6a fix:add: rethink adding default commodity symbol; fix doc instead [#815] 2024-01-04 17:33:05 -10:00
Simon Michael
034d37c3be fix👿stack: build with ghc 9.8, latest stackage nightly (part 2)
Fix the build with GHC < 9.8.

This reapplies commit 87600e5dd, this time with the correct description.
2024-01-04 17:33:02 -10:00
Simon Michael
d4a5361081 dev: Revert "fix:add: apply the D default commodity to bare numbers, per docs, 2 [#815]"
This reverts commit 87600e5dd, which had a wrong description.
2024-01-04 16:57:38 -10:00
Simon Michael
87600e5dd3 fix:add: apply the D default commodity to bare numbers, per docs, 2 [#815]
Avoid breaking GHC < 9.8.
2024-01-04 13:50:37 -10:00
Simon Michael
1fcc8f1c89 fix:add: apply the D default commodity to bare numbers, per docs [#815] 2024-01-04 13:24:57 -10:00
Simon Michael
2a99b3d456 imp: stack: build with ghc 9.8, latest stackage nightly 2024-01-04 08:24:50 -10:00
Simon Michael
fccaf0d35a ;doc: update command help 2023-12-15 13:59:12 -10:00
Simon Michael
51224f6e27 fix: bal --budget --layout=tall was hiding commodity symbols
When reports want to render amounts without commmodity symbols,
they must now use AmountDisplayOpts' new displayCommodity flag.
(Previously it was a side effect of setting displayCommodityOrder.)
2023-12-08 05:52:29 -10:00
Simon Michael
0bc86c95e4 lib: Hledger.Data.Amount: noPrice -> noCost 2023-12-07 23:35:50 -10:00
Simon Michael
862b7e5712 dev: clarify AmountDisplayOpts, add a new flag for symbol display 2023-12-07 23:35:50 -10:00
Simon Michael
aa8c0e8279 ;doc:balance:budget report: tighten up 2023-12-07 23:35:50 -10:00
Simon Michael
c9764e82c9 ;doc:balance:budget report: trim some content
Moved "Budgets and subaccounts" to the cookbook's Budgeting page,
I think it's not needed in the reference manual.
2023-12-07 19:03:52 -10:00
Simon Michael
0526c834dd ;doc:balance:budget report: update/clean up 2023-12-07 18:48:26 -10:00
Simon Michael
22ac8d056d fix:print: pad/round amounts with inferred costs like the others (#2123) 2023-12-07 03:41:31 -10:00
Simon Michael
c6a580ff3b fix:import: save each file's latest dates, separately (#2125) 2023-12-07 03:41:31 -10:00
Simon Michael
d1635a55f8 lib: move readFileStrictly to Hledger.Utils.IO 2023-12-07 03:41:31 -10:00
Simon Michael
6cfeb65d7b ;doc: update command help 2023-12-01 17:24:23 -10:00
Simon Michael
0c85b48d2c ;doc: use ``cli not ``shell for command-line examples 2023-11-26 08:30:04 -10:00
Simon Michael
4b13af0634 imp:print:beancount: conversion improvements
- omit balance assertions
- replace more currency symbols, and match within symbols like C$
- do more account validation, and error if conversion is too hard
- backslash-escape double quotes and backslashes in payee and note
2023-11-23 01:47:15 -10:00
Simon Michael
0b8e920810 imp:print:beancount: also convert cost amounts 2023-11-22 23:54:10 -10:00
Simon Michael
fcfa7ed78a ;doc: update command help 2023-11-22 22:57:36 -10:00
Simon Michael
e2cc2d7e24 feat:print: add a basic beancount output format
This prints journal output more likely (but not guaranteed) to
be readable by Beancount.

All packages now require text 1.2.4.1 or greater.
2023-11-22 22:57:36 -10:00
Simon Michael
606d99834a fix: -o/--outputfile with a .json or .sql extension now selects those formats 2023-11-22 19:25:37 -10:00
Simon Michael
fba297f705 imp:import: support -s/--strict properly (fix #2113)
hledger import -s now runs strict checks on an in-memory copy of the
updated journal, before updating the journal file; if strict checks
fail, nothing is written to disk.

And hledger import now does not update any .latest files until it has
run without error (no failing strict checks, no failure while writing
the journal file). This makes it more idempotent, so you can run it
again after fixing problems.
2023-11-16 22:21:05 -10:00
Simon Michael
e035730afb imp: roi: limit large decimals to 8 digits by default (precisiongeddon)
With valuation now preserving more decimal digits, roi could show
excessively precise decimals if there was no known display precision
for the valuation commodity. Now in that situation it limits the
precision to a maximum of 8 digits.
2023-11-08 13:59:18 -08:00
Simon Michael
f8ffd9cdda imp: more precision handling fixes, debug output, test updates (precisiongeddon)
This and the preceding commits were "work in progress" that got out of control.
There's more to do, but this one brings these precision-related improvements
(at least):

When "infinite decimals" arise, they are now generally shown with
8 decimal digits rather than 255.

print and prices no longer add trailing decimal zeros unnecessarily.

Some code has been refactored or given more debug output.

All tests have been updated to match the recent changes.
2023-11-08 13:59:18 -08:00
Simon Michael
c51d883162 imp: prices: clarify, fixes, improve semantics (precisiongeddon)
- The prices comand now more accurately lists the prices that hledger
  uses when calculating value reports (similar to what you'd see with
  eg `hledger bal -V --debug=2`).

- The prices command's --infer-reverse-prices flag was confusing since
  we always infer and use reverse prices; it has been renamed to --show-reverse.

- --infer-market-prices and --show-reverse combine properly.

- --show-reverse now ignores all zero prices rather than giving an error.

- Reverse prices (which can be infinite decimals) are now displayed
  with at most 8 decimal digits (rather than the internal precision of
  255 digits).

- Filtering prices by cur: or amt: now works properly.

- Price amounts are styled, but all decimal digits are shown.
2023-11-08 13:59:18 -08:00
Peter Sagerson
efcea0600a feat: cli: Add tsv output (#869)
All commands that suport csv output now also support tsv output. The
data is identical, but the fields are separated by tab characters and
there is no quoting or escaping. Tab, carriage return, and newline
characters in data are converted to spaces (this should rarely if ever
happen in practice).
2023-11-06 16:46:04 -08:00
Simon Michael
33cef6f494 ;imp:Hledger.Cli.Script: don't export main, do export CompoundBalanceCommand 2023-10-23 19:09:19 +01:00
Simon Michael
31ecc9f4f2 imp:demo: improve error message when asciinema fails 2023-10-23 14:21:20 +01:00
Simon Michael
d8021ef754 fix:demo: avoid breaking asciinema 2.3.0 (fix #2094)
We were adding a trailing newline, which causes asciinema 2.3.0 to
show a JSON decode error.
2023-10-23 14:08:01 +01:00
Simon Michael
605b3d6b94 imp:cli:Hledger.Cli.Version: export packagemajorversion 2023-10-21 03:36:04 +01:00
Simon Michael
7970ce7434 ;doc:areg,ui: note how separately-dated postings get combined 2023-10-19 10:24:47 +01:00
Simon Michael
661260f756 ;doc:print: cleanups (#2085) 2023-10-18 14:02:59 +01:00
Simon Michael
5a72b9e9ea feat:print: add --round option for more control of precisions (#2085) 2023-10-18 13:56:24 +01:00
Simon Michael
c13c13ab1f lib!: use styleAmounts in more places; add rounding strategies 2023-10-18 13:56:24 +01:00
Simon Michael
f8027abb44 dev:print: refactor, add AmountStyle "rounding strategy"
Changes to enable more control of "rounding" behaviour
(ie, choosing display precisions for amounts).

This reverts 1.31's change of asprecision, making it a non-Maybe
again, and adds a new asrounding field providing more control over how
a target display precision is applied to existing amounts (two options
for now, more later). Functionality is in an interim state (reports do
no rounding).
2023-10-18 13:56:24 +01:00
Stephen Morgan
20132e892b feat: balance: Add summary-only flag (#1012)
Add a flag --summary-only for multi-column balance reports, which does
not display the main date columns for a report, but only displays the
summary columns (--row-total, --average). This is useful when there are
many columns (a weekly summary over many years) where you're only
interested in the average (or some other summary).
2023-10-06 05:25:26 +01:00
Simon Michael
fffae7f578 ;doc: main module haddock cleanups 2023-10-04 10:03:35 +01:00
Simon Michael
0e98f73e30 dev:cli: merge Hledger.Cli.Main with Hledger.Cli 2023-10-04 10:03:35 +01:00
Simon Michael
8666cc5391 ;doc: update command help 2023-09-11 09:57:02 +01:00
Simon Michael
4bd0dd7ab0 fix: print: don't round in implicit conversions (fix #2079) 2023-09-02 06:46:14 +01:00
Simon Michael
fd97c40266 lib: amount styling: add a final styling pass to all reports 2023-09-02 06:46:14 +01:00
Simon Michael
85845e51b2 dev: AmountStyle: rename, reorder fields more mnemonically
Since this type is about to change anyway.
2023-09-02 06:46:14 +01:00
Dmitry Astapov
c20ebae26d ;doc:roi: mention annualization differences, clean up TWR section 2023-08-24 18:42:52 +01:00
Simon Michael
50f26c280e ;doc:check: cleanup 2023-08-22 09:56:25 +01:00
Simon Michael
df9917be57 ;doc:bal: note an issue with the no-symbol commodity and hledger-bar 2023-08-22 08:45:13 +01:00
Simon Michael
95b67ef86b ;doc: update command help 2023-08-22 08:40:46 +01:00
Simon Michael
5f1bf0404a imp:check: more intuitive "balanced..." check names
balancedwithautoconversion -> autobalanced
balancednoautoconversion   -> balanced
2023-08-22 08:38:52 +01:00
Simon Michael
9579b7a4a6 ;imp:cli:help: move test to HELP 2023-08-22 07:35:57 +01:00
Simon Michael
e849a73aa8 ;imp:cli:help: move files to BASIC REPORTS 2023-08-22 07:29:32 +01:00
Simon Michael
dd559226d8 imp:demo: ignore a broken journal, like other HELP commands 2023-08-22 07:11:53 +01:00
Dmitry Astapov
588d0dfd26 fix:cli:roi: report TWR per period and overall TWR for multi-period reports (fix #2068) 2023-08-01 14:35:33 -04:00
Simon Michael
f7dbfcf657 fix:cli:commands list: don't show bar when not in path (fix #2065) 2023-07-20 12:04:27 -07:00
Simon Michael
b4a80f693d ;doc:import: link to the deduplicating/importing section in CSV docs #1862 2023-07-13 21:05:27 -10:00
Simon Michael
002773f650 imp:check:recentassertions: give a more useful error location
hledger check recentassertions now reports the error at the first
posting that's more than 7 days later than the latest balance
assertion (rather than at the balance assertion).  This is the thing
actually triggering the error, and it is more likely to be visible or
at least closer when you are working at the end of a journal file.
2023-07-12 19:54:18 -10:00
Simon Michael
a99a692736 ;doc:cli: Valuation -> Value reporting 2023-07-11 16:56:41 -10:00
Simon Michael
245178cac8 ;doc:cli: fix links to balance --layout doc 2023-07-07 10:28:07 -10:00
Simon Michael
42efbbe4aa imp:import: also show the file path being imported to 2023-06-16 09:14:38 -10:00
Simon Michael
f225bf2f7f cln:print: clarify code a bit, rename originalTransaction 2023-06-14 18:11:28 -10:00
Simon Michael
98d53b42e4 ;dev:cli: avoid breakage with old haddock versions in Demo.hs 2023-06-02 10:22:49 -10:00
Simon Michael
2a3941682b ;doc: update command help 2023-06-01 16:34:57 -10:00
Simon Michael
1b0be2b65f imp:demo: add an easy -s/--speed option, play at 2x by default 2023-06-01 16:32:40 -10:00
Simon Michael
c9f39db363 imp:demo: rename/reorder install demo 2023-06-01 16:32:36 -10:00
Simon Michael
f485b30ae0 ;cln:close: fix end date doc 2023-06-01 16:32:25 -10:00
Simon Michael
f7b59c8950 dev: demo: drop two confusing demos for now 2023-05-31 18:57:30 -10:00
Simon Michael
9cdc0f21b6 imp:cli: add-ons can also have .js, .lua, or .php extensions 2023-05-30 20:23:12 -10:00
Simon Michael
96cdc0cb96 fix: likelyExecutablesInPath, hledgerExecutablesInPath on windows (#2040)
Pointed out by mauke in #haskell chat: this was incorrectly splitting
PATH on windows (splitting on the : in C:\...), which meant that
people using multiple drive letters on Windows might see hledger
failing to recognise installed add-on commands.
2023-05-27 12:28:38 -10:00
Simon Michael
a12880de05 fix: typo in Hledger.Cli.CliOptions.likelyExecutablesInPath
This had a bug noticed by mauke in #haskell: it was splitting PATH
on [ and ] as well as : and ;. Hard to trigger, but now fixed.
2023-05-27 09:21:49 -10:00
Simon Michael
6854b0b5e6 ;doc: update command help 2023-05-26 06:38:27 -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
71ef6ef478 fix: cli: commands list now shows help for hledger-lots if installed 2023-05-18 07:19:36 -10:00
Simon Michael
4c3046dea8 fix: cli: the commands list no longer lists non-installed addons (fix #2034)
And internally has been rewritten for clarity.
2023-05-18 07:19:36 -10:00
Simon Michael
ae4f58beb7 lib: Hledger.Cli.Commands: findCommand -> findBuiltinCommand 2023-05-18 07:13:58 -10:00
Simon Michael
2d03148d7f dev: lib: drop unused pragma 2023-05-09 10:03:15 -10:00
Simon Michael
147d49c66c dev: cln: drop Hledger.Data.RawOptions.inRawOpts 2023-05-09 10:02:24 -10:00
Simon Michael
a771c8fc19 imp: revert 2b5194238 imp: generate auto postings on forecast transactions by default (#2027)
I found at least one user for whom this would be a breaking change
(they generate forecast txns, and have auto posting rules, but don't
want the latter applied to the former). I guess it's better to keep
things as they were for now: if you need auto postings on your
forecast txns you must use two flags, --forecast --auto.
2023-04-30 08:08:26 -10:00
Simon Michael
7f713f6a44 imp: Generated/modified txns/postings are now tagged only with --verbose-tags 2023-04-29 18:25:11 -10:00
Simon Michael
ca42b0aaca imp: cli: clean up some flags' help and sync docs 2023-04-29 18:11:53 -10:00
Simon Michael
2b5194238b imp: generate auto postings on forecast transactions by default 2023-04-29 16:00:14 -10:00
Simon Michael
fe6df964b4 ;doc: bal: try to improve description of budget report differences 2023-04-25 12:39:28 -10:00
Simon Michael
1be06c87c4 feat: bal: A new --count report type counts postings instead of amounts. 2023-04-20 14:36:41 -10:00
Simon Michael
40d10bc8c5 imp: cli: commands list: help for hledger-bar script 2023-04-20 12:58:30 -10:00
Simon Michael
c2288f8143 ;doc: update command help 2023-04-07 09:52:31 -10:00
Simon Michael
9c4b5a26fa imp: ui, web: use a pager to show command line help, like cli 2023-04-06 15:36:08 -10:00
Simon Michael
3e3c3c8355 imp: help: doc: warn about old info on mac (fix #1770) 2023-04-06 15:36:00 -10:00
Simon Michael
f0157625cb ;doc: close: fix typo 2023-04-06 12:18:00 -10:00
Simon Michael
1de8600067 imp: cli: try to ensure less (and its more mode) show ANSI (fix #2015)
If you use some other $PAGER, you will have to configure it to show
ANSI yourself (or disable ANSI, eg by setting NO_COLOR=1).
2023-04-06 11:13:00 -10:00
Simon Michael
94e5aa3dfa ;doc: update command help 2023-04-06 11:12:35 -10:00
Simon Michael
ba0bb5eb4a imp: close: restore legacy flags --closing/--opening/--close-to/--open-from (#2020)
They're cruft, but hidden and low cost and remove one more user hassle.
2023-04-06 11:12:35 -10:00
Simon Michael
c151d57069 imp: close: restore equity command alias; improve help/doc (#2020) 2023-04-06 11:12:35 -10:00
Simon Michael
1d83e14392 imp: close: more cleanup; add --close; always default to ALE (#2020) 2023-04-06 11:12:35 -10:00
Simon Michael
7695e409bf imp: close: tweak doc more (#2020) 2023-04-06 11:12:35 -10:00
Simon Michael
3660118575 imp: close: reorder/clean options more (#2020) 2023-04-06 11:12:35 -10:00
Simon Michael
19ea31dd61 fix: close: restore --open-acct option (#2020) 2023-04-06 11:12:35 -10:00
Simon Michael
3acd0a33df imp: close: reorder flags, rewrite help/doc (#2020) 2023-04-06 11:12:35 -10:00
Simon Michael
e8cf09f477 imp: acc: reorder/clean up flags 2023-03-30 10:58:46 -10:00
Simon Michael
c03d6b1123 imp: print: --match makes better choices
Previously, similarity completely outweighed recency, so a
slightly-more-similar transaction would always be selected no matter
how old it was. Now similarity and recency are more balanced,
and it should produce the desired transaction more often.
There is also new debug output (at debug level 1) for
troubleshooting.
2023-03-27 15:21:42 -10:00
Chris Lemaire
cddbae6467 queries: Prefix boolean queries with expr:
Boolean queries are now prefixed with an 'expr:' prefix, making them
completely separable from old queries and making the addition of them a
little more migration proof.

The tests are updated accordingly, changes made to the tests previously
are removed and extra cautious documentation is also removed.
2023-03-27 10:29:26 -10:00
Chris Lemaire
35db1cae4f queries: Add generalised boolean queries
This commit changes some of the functions in the Query module and
changes the overall way to parse queries. Instead of using the words''
split function, this commit starts to fully parse the query, as it's
seen as a type of expression.

AND, OR, NOT, and space operators can be used. The space operator
simulates the behaviour from before, leaving a minimal amount of tests
that need to be adjusted to comply to the new behaviour.
2023-03-27 10:29:26 -10:00
Simon Michael
69a8834803 dev: demo: notes 2023-03-18 20:49:12 -10:00
Simon Michael
062559cbd5 imp: demo: nicer output, show clearer start/stop indicators, don't show "exit" 2023-03-18 20:06:24 -10:00
Simon Michael
33876905f1 dev: lib: Hledger.Cli.Script: cleanup 2023-03-18 20:02:22 -10:00
Simon Michael
be8e64e498 imp: lib: export more terminal size, ANSI style/color helpers
Hledger.Utils.IO (and therefore Hledger and Hledger.Cli.Script) added:

    getTerminalHeightWidth
    getTerminalHeight
    getTerminalWidth
    Color(..)
    ColorIntensity(..)
    bold'
    faint'
    black'
    red'
    green'
    yellow'
    blue'
    magenta'
    cyan'
    white'
    brightBlack'
    brightRed'
    brightGreen'
    brightYellow'
    brightBlue'
    brightMagenta'
    brightCyan'
    brightWhite'
    rgb'
2023-03-18 19:59:00 -10:00
Simon Michael
8ec59eafac imp: demo: Getting help 2023-03-18 01:33:34 -10:00
Simon Michael
0520ef03f6 ;imp: demo: titles cleanup 2023-03-18 01:32:40 -10:00
Simon Michael
7632321b3c ;imp: cli: commands list cleanups 2023-03-18 01:14:31 -10:00
Simon Michael
6588020e64 ;doc: update CLI help text files 2023-03-17 00:53:57 -10:00
Simon Michael
8b2efe3c33 ;imp: demo: help updates 2023-03-17 00:53:30 -10:00
Simon Michael
bbb58c3804 imp: demo: Watching the built-in demos (demo) 2023-03-17 00:09:24 -10:00
Simon Michael
b9273a4585 imp: cli: move OTHER last in commands list 2023-03-16 23:20:14 -10:00
Simon Michael
98865d6025 imp: demo: split print / balance demos 2023-03-16 23:20:14 -10:00
Simon Michael
6777182c70 imp: demo: output cleanups 2023-03-16 23:20:14 -10:00
Simon Michael
2d496609bc imp: demo: hide the file names 2023-03-16 23:20:14 -10:00
Simon Michael
7e422cb12a ;doc: update CLI help text files 2023-03-16 21:58:39 -10:00
Simon Michael
38fd51b97c feat: embed some asciinema demos, and a demo command to play them 2023-03-16 21:58:38 -10:00
Simon Michael
70ef3e816c fix: stats: fix a regression in date display since 1.28 (#2012) 2023-03-16 14:52:37 -10:00
Simon Michael
62bb93af9c imp: lib: Hledger.Cli.Script: more re-exports
added:
Control.Applicative
Control.Concurrent
Data.Char
Data.Functor
System.IO
System.IO.Error
2023-03-16 14:36:29 -10:00
Simon Michael
d012384d57 ;dev: cli: also build with GHC 9.6.1 2023-03-14 10:49:58 -10:00
Yehoshua Pesach Wallach
7ddcf3b9e1 fix: doc: remove duplicate in hledger close docs 2023-03-13 09:23:18 -10:00
Simon Michael
af38121442 imp: areg: when restricted by extra query args, show a hint in title
I was confused when using 'areg ACCT QUERY'. Now, the title will show
" (matching query)" as a hint when a QUERY is specified,
except when it is a date restriction (which is common and not confusing)
or a depth restriction (which is ignored).
2023-02-21 08:29:59 -10:00
Simon Michael
25b8d51ff2 activity: fix output after #1982; add tests 2023-02-21 07:17:21 -10:00
Simon Michael
70539a70bd ;cli: consolidate commands overvinew; sync commands list 2023-02-21 00:35:14 -10:00
Simon Michael
4d66f48a47 ;doc: update CLI help text files 2023-02-21 00:16:46 -10:00