beangulp icon indicating copy to clipboard operation
beangulp copied to clipboard

Feature Request: Support Default Options for beangulp.Injest()

Open eliptus opened this issue 1 year ago • 2 comments

For import scripts that call beangulp.Injest(), allow them to provide default values for CLI options like downloads and destination.

Example:

    ingest = beangulp.Ingest(importers, hooks, {'downloads': './Downloads'})

eliptus avatar Dec 24 '24 02:12 eliptus

I originally reported this against beancount. This has become more relevant with beangulp since --downloads has been replaced with a positional parameter, thus it is more difficult to detect its absence in the wrapper without baking in knowledge of all archive options.

eliptus avatar Dec 24 '24 03:12 eliptus

An initial pass at this for the src tuple present on each click command. It could probably be expanded to other command line arguments later. It doesnt seem to work for paths starting with ~ though.

https://github.com/alexrkaufman/beangulp/commit/9d1dc88d391f3e7f3b6a235e546cec7bf7b445a7

In my import.py this is what its use looks like.

if __name__ == "__main__":
    ingest = beangulp.Ingest(importers, hooks, defaults={"src": "import/"})
    ingest()

alexrkaufman avatar Feb 25 '25 08:02 alexrkaufman