egh / ledger-autosync

Synchronize your ledger-cli files with your bank.
GNU General Public License v3.0
273 stars 42 forks source link

Pass unknownaccount into csv parse_file and allow csv assertions #44

Closed bdowling closed 6 years ago

bdowling commented 6 years ago

I had a use case for a csv converter plugin that I wanted to write that could use access to the unknownaccount arg. This PR passes that in as well. (arguably, to make my plugin a bit more generic, I may want a liabilitiesAccount, expenseAccount and assetAcount passed in, but I can work with this for now and think about that column to account mapping in the future).

The file also had balances, so I added an asserted value in the Transaction Posting in the CsvConverter and needed to adjust the format functions to honor args.assertions as appropriate.

I think one could argue that a '--assert-final' option might be useful to only include the last assertion in the set of Transactions, but I already changed more than one thing for a single PR.

fwiw, I have not been able to get the nosetests to run in my environment, but we can see what CI says.

egh commented 6 years ago

@bdowling Thanks for this. It feel off my radar, but everything looks good to me.