vim-ledger icon indicating copy to clipboard operation
vim-ledger copied to clipboard

Passing negative values to ledger#entry errors.

Open adamipc opened this issue 1 year ago • 1 comments

When passing a negative value to ledger#entry such as 2024-12-04 employer income -500 checking you get an error Illegal option -5 because vim-ledger doesn't escape the parameters to ledger entry.

Example:

2024-12-03 Employer
	Income:Salary	-$500
	Assets:Checking

2024-12-04 employer -500

(Note: Yes, I know that in most cases if you organize your transactions such that you reverse the accounts you don't have to specify a negative value. But for some of my work it is clearer to provide negative values to some entries.)

This can be fixed by adding -- to the command line run before entry so that the rest of the arguments are not treated as possible options.

adamipc avatar Dec 04 '24 14:12 adamipc

PRs welcome. I use hledger not ledger so I don't use this particular command and it's hard to test, but if you get it working for yourself please do send a PR and I'll facilitate getting it put in.

alerque avatar Dec 04 '24 14:12 alerque