beancount / beangulp

Importers framework for Beancount
GNU General Public License v2.0
61 stars 24 forks source link

Add Option to Set Date Separator During Archive #109

Closed patbakdev closed 1 year ago

patbakdev commented 1 year ago

I prefer to use a space between the date and original filename.

dnicolodi commented 1 year ago

The reason for having the filename structured in the current way is because beancounts automatically picks up files with names in that format to add document directives to the ledger. Changing the separator between the date and the rest of the name would prevent this mechanism from working.

I'm not opposed to make it configurable (and a space looks better than a dot to me too) but I don't think it should be a command line parameter for two reasons: the users are going to get inconsistent file names if they forgot the option, and as explained above, because it does not mix well with the support for automatic document directives.

What I suggest to do, is to use a module global variable for the filename template. I'll prepare a PR.

dnicolodi commented 1 year ago

I've just pushed the implementation. The solution is to add

import beangulp
beangulp.archive.FILENAME = '{date:%Y-%m-%d} {name}'

or any other format you like, to your import script.