summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert "Use amount_width for balance report"John Wiegley2022-02-031-3/+3
| | | | This reverts commit 7baa0efd71896711e563feb957926433f529d892.
* Use amount_width for balance reportVladimir Parfinenko2022-02-031-3/+3
|
* check that commodity format uses correct symbolChristopher Zimmermann2022-02-031-1/+4
| | | | closes 1948
* Revert "Revert "Revert "Change --invert to invert displayed amounts and ↵John Wiegley2022-02-031-2/+1
| | | | | | totals, not amounts""" This reverts commit c99a4b03320242d3d5a6d64f73f8581fe5ea2306.
* Revert "Revert "Revert "Compare price annotations using their textual ↵John Wiegley2022-02-031-3/+1
| | | | | | rendering""" This reverts commit bc45e0205d23f5a8f2e3e389195daa85f4b07ec0.
* Revert "Revert "Compare price annotations using their textual rendering""John Wiegley2022-02-031-1/+3
| | | | This reverts commit 7f78cadea4a2359f1f53ce9c0c66b6d3fafd81c4.
* Revert "Revert "Change --invert to invert displayed amounts and totals, not ↵John Wiegley2022-02-031-1/+2
| | | | | | amounts"" This reverts commit 1600ee1f64f659b151c1c873d478baa1bdab89f2.
* Use correct int return type for stream input operationskanreki2021-12-089-145/+107
| | | | | | | | This makes it safe to compare results to -1 to indicate EOF, regardless of whether char is considered signed or unsigned; and so eliminates compiler warnings on platforms such as ARM. Fixes bug #2058.
* Fix --time-colon for negative time amountsRafael Ascensão2021-09-271-7/+3
| | | | | | | | | | | | | | | While the current formula works for positive numbers, negative numbers are incorrectly represented. One of the issues comes from the fact that floor(x) < x for every x. `amount_t precision` will always be a non negative number and the code that attempts to fix the issue for negative number will never run. If we truncate the number instead, the current formula works for both positive and negative numbers without making negative numbers a corner case. So let's do that. Signed-off-by: Rafael Ascensão <rafa.almas@gmail.com>
* Fix silent errors when reading lines from input files.Austin Wise2021-08-241-2/+12
| | | | | | | | Handle files that don't end with a new line. Throw an error when the buffer size is exceeded. Fixes #516 Contributes to #1149
* Fix compilation with Boost 1.76Sam James2021-06-142-0/+4
| | | | | | | | We were previously relying on an indirect include within Boost headers. We're using scoped_ptr which is defined in <boost/smart_ptr/scoped_ptr.hpp>. Bug: https://bugs.gentoo.org/790176 Closes: https://github.com/ledger/ledger/issues/2030
* Escape all string values output by the lisp report.Richard M Kreuter2021-05-311-6/+6
| | | | | | | Notes were already being escaped. The filename, the transaction code, the payee,, postings' account names, and postings' cost expressions were not. Everything else the lisp report prints appears to be a number or a constant-valued non-string token for Lisp.
* Fix amount tokenizer re: embedded minus sign.Donald Lam2021-05-021-2/+9
| | | | | An amount may have a (single) leading minus sign, but none after that. Bug #2001 (and #1809).
* Fix using day-of-week names for `xact` commandAlan Bram2021-04-101-13/+13
| | | | Also fix end-of-command boundary checks for keywords "at", "to", etc.
* Use Boost library to read argv as UTF-8 in WindowsDaniel Coonce2021-02-022-0/+9
| | | | | | | Windows uses UTF-16 for command line arguments, so use boost::nowide to convert to UTF-8. Fixes #1986
* Create consistent buffer size.Daniel Coonce2021-02-022-2/+2
|
* Fix build for x86_64-w64-mingw32Daniel Coonce2021-02-023-4/+4
| | | | Fixes #1905
* Fix issues related to payees declared on posting's metadataDiogo Trentini2021-02-025-20/+66
| | | | | Payees declared on posting's metadata are now validated with `--check-payees` option. Also, their aliases are now considered on reports as well.
* Replace if/else ladder in convert with loopKai Wohlfahrt2021-01-312-41/+19
|
* Add debit field to convert commandKai Wohlfahrt2021-01-312-8/+21
| | | | | This changes the error reported when a transaction with no amount is imported.
* compare_by_commodity: Always return the result of the recursive callChristoph Dittmann2021-01-301-6/+11
| | | | | | | | | | | | | | | | | | | | | | | Commit 501fbc08ae5493db77bb34f4c4fbe1f3a3bc14e3 changed the behavior of this function to not return the "equal" result (==0) from the recursive call. Previously, the function returned the result of the recursive call unconditionally. The current behavior causes an assertion error for certain postings. The regression test added in this commit shows such a posting. I found through Travis CI that the old behavior was incomplete and caused unstable orderings, so reverting to the old behavior doesn't work. Instead, this change adds a fallback: If the recursive call that compares the prices numerically returns "equal", then compare the prices with their original commodity as a tie breaker. This commit does not change any existing ordering, it only adds deterministic ordering in a case that currently triggers an assertion error. This fixes issue #1998.
* format_t::truncate support wide charactersKuang-che Wu2021-01-172-10/+58
| | | | also add unit tests
* Do not treat balance assignments with 0 diff as a null postingDaraul Harris2020-12-051-1/+5
| | | | | | | | | | | Ledger is treating balance assignments that have a 0 diff as having a null posting, leading to the posting being auto-balanced and therefore causing incorrect values to be returned for the transaction. I fixed this by just making the posting equal to amt - amt (0 in the right commodity). Fixes #1942
* Fix regression in sorted_amountsMartin Michlmayr2020-10-301-1/+2
| | | | | | | | | | Commit 557ab32 ("Expose a new utility function for balances: sorted_amounts") split out some code into a separate function. Unfortunately, in the process an "if" statement was dropped, leading to amounts being shown that shouldn't be shown because they are smaller than the display precision. Fixes #1969
* Implement cryptographic access to files using GPGMEMichael Raitza2020-10-306-4/+378
|
* Add support for `$XDG_CONFIG_HOME`Cédric Barreteau2020-08-281-5/+16
| | | | | `$XDG_CONFIG_HOME/ledger/ledgerrc` and `$HOME/.config/ledger/ledgerrc` are tried first when looking for an init file.
* Fix whitespace/tabsEmin Martinian2020-08-131-6/+6
|
* Make it so that the include directive sorts when using wildcards.Emin Martinian2020-08-131-4/+12
| | | | | | | | Before this commit, doing something like 'include data/*.dat' would produce undesired behaviour because the matches for 'data/*.dat' would not be sorted correctly. See https://github.com/ledger/ledger/issues/1659 for details.
* Treat --depth like --collapse in registerRahix2020-07-211-1/+1
| | | | | | | | | | Currently, collapsing is only done when both --depth and --collapse are present. This is very unintuitive and I have even stumbled over this myself while implenting the feature. Change --depth to behave just like --collapse in all cases (except that --depth has a parameter associated. --collapse defaults to 0 to retain its old behavior).
* collapse_posts: Use the existing accounts instead of tempsRahix2020-07-212-4/+12
| | | | | | The temps will not have correct depth information attached which means a display predicate involving `depth` will most likely lead to wrong results.
* collapse_posts: Fix some postings getting lost when collapsingRahix2020-07-211-1/+1
| | | | | | | | | | Because the only_predicate and display_predicate are applied to the original posts, not the collapsed ones, they sometimes yield wrong results leading to entire transactions getting dropped erroneously. As this code is only relevant to depth == 0 collapsing (that is, the old behavior), only follow the displayed_count == 1 code-path when the depth is 0.
* collapse_posts: Fix segfault when depth is too bigRahix2020-07-211-1/+1
| | | | | | | When an account already has less depth than collapse_depth, a segfault was caused by attempting to move up the account parents until parent is NULL. Fix this by exiting early if the depth is already less than collapse_depth.
* collapse_posts: Use --depth as the collapse_depthRahix2020-07-211-2/+8
| | | | Use the value from --depth as the collapse_depth for --collapse.
* collapse_posts: Add a collapse_depth attributeRahix2020-07-212-6/+7
| | | | | Replace the hardcoded depth of 3 with a class attribute that can later be set from a commandline argument.
* first try for implementing --depth for registerjohannes@debussy2020-07-212-14/+32
|
* Use PAGER when environment variable is setMartin Michlmayr2020-06-181-10/+15
| | | | | | | The code looked for "less" if $PAGER is not set, but it didn't actually use $PAGER when it it defined. Fixes #1674
* Fix typos in commentsMartin Michlmayr2020-05-2110-11/+11
|
* Fix compilation warningMartin Michlmayr2020-05-181-1/+1
|
* Revert "Compare price annotations using their textual rendering"Martin Michlmayr2020-05-181-3/+1
| | | | | | This reverts commit a6a58af28f30ee81f86604b56740d98af8b75c38. Fixes #1907
* Revert "Change --invert to invert displayed amounts and totals, not amounts"Martin Michlmayr2020-05-181-2/+1
| | | | | | This reverts commit 9ad0dcc85a3ec59a1dd23f36964d083cf59bd7a9. Fixes #1895
* Fix some typosMartin Michlmayr2020-05-161-1/+1
|
* Fix: library path issueHenrik Pingel2020-05-131-0/+1
|
* Revert "Correction to the way parens are parsed in query expressions"John Wiegley2020-05-072-47/+9
| | | | This reverts commit 49b07a1c19489547b859d61fbc5c240aff224dda.
* Improve conditional for exclusive optionsMartin Michlmayr2020-05-071-1/+1
|
* Ensure that apply directives have an argumentMartin Michlmayr2020-04-271-0/+2
| | | | | | | | The directive `apply account` and similar directives (fixed, year...) require an argument. Ensure that an argument is given. Fixes #553 Fixes #1854
* Fix buffer overflow when evaluating pricing dateSarah Jamie Lewis2020-04-271-0/+4
|
* Increase the error display text limitJohn Wiegley2020-04-261-1/+1
|
* Add two (for the moment undocumented) functions:John Wiegley2020-04-232-0/+25
| | | | | | | | | | | | | | | | | | | | - commodity_price(NAME, DATE) - set_commodity_price(NAME, DATE) Using these two I am able to compute rate of return over a period of transactions, taking additional deposits and withdrawals into account, using the following automated transactions: P 2019-12-31 12:00:00 ROI $1.00 2020-01-01 Start of record (ROI) 0 ROI = expr date >= [2020/01/01] && account =~ /Broker:Cash$/ and any(account =~ /Assets:Checking/) (ROI) (1 ROI * (amount / commodity_price(1 ROI, date))) = expr date >= [2020/01/01] && account =~ /:Capital:/ (ROI) (set_commodity_price(1 ROI, date, ((commodity_price(1 ROI, date) * account("ROI").amount) - amount) / account("ROI").amount) || 0 ROI)
* fix: Fix #543 by tracking an account's real balanceDaraul2020-04-054-7/+23
| | | | | | | | | | | | | | Without these changes, whether an account's balance is virtual or real is not considered when asserting it's balance. This lead to situations where the user must consider their virtual postings when attemping to assert the real balance of the account. See test/regress/543_a.test for that testcase, taken from the original issue. This commit also includes other, fringe, situations that I noticed while working on the fix. It essentially just adds a separate attribute to the account class(?) that hold's the account's "real" balance, which is only updated when the user attempts an assertion on a real account. The virtual account's balance is updated the way it always was.
* Make explicit option a no-opCandyAngel2020-04-033-20/+3
| | | | Fixes #1877