Is there CLI tooling to manage attached files in document: or statement: metadata?

87 views
Skip to first unread message

berkes

unread,
Jul 23, 2019, 4:12:55 AM7/23/19
to Beancount

Hello,

First of all: I'm new here, so please forgive me if I breach some rule. I'll try to do better next time.

I'm trying to associate all my PDFs and other scanned bills, statements and notes with my ledger, and so far, fava helps me a lot, but I cannot find a way to easily do this from the CLI.

Fava has a "drag and drop upload and rename" feature. In which it finds out how to name the full path to a document and then moves it there.

For example:


2019-01-01 txn "DIGITALOCEAN.COM 6463978051"
  statement
: "2019-01-01_DigitalOcean_Invoice_2018_Dec_340201-390969932.pdf"
 
Liabilities:Creditcard                              -XXXX EUR
 
Expenses:Itinfra

2019-01-01 txn "LINODE.COM 855-4546633"
  statement
: "2019-01-01_invoice-2019-01-01.pdf"
 
Liabilities:Creditcard                              -XXXX EUR
 
Expenses:Itinfra

2019-01-01 txn "AWS EMEA"
  statement
: "2019-01-01_Billing_Management_Console__non-Linux-generated_files-job_549.pdf"
 
Liabilities:Creditcard                              -XXXX EUR
 
Expenses:Itinfra

And the associated tree:

└── Liabilities
   
├── Creditcard
   
  ├── 2019-01-01_Billing_Management_Console__non-Linux-generated_files-job_549.pdf
   
  ├── 2019-01-01_DigitalOcean_Invoice_2018_Dec_340201-390969932.pdf
   
  ├── 2019-01-01_invoice-2019-01-01.pdf


I'm looking for something similar for the commandline. So that I can script it. It would seem `bean-file` is meant for this, but I cannot find documentation on how to use it for managing attached statments or documents; only for managing imports from other sources. Maybe I missed some crucial piece here? Does this part in fava have an API or CLI interface maybe?
Or are there third party tools? I've searched, but could not find it.

Preferably, I'd have a tool that does not change the ledger file itself; as is the rule of thumb for most CLI-tools. Instead, given a transaction statement (line in file, the statement itself?) it should move or copy the file into the correct location and then present a formatted string that can be copied into that statement in an editor. This could easily be part of a vim macro for example.

Kind regards,
Bèr

Martin Blais

unread,
Jul 23, 2019, 6:46:40 AM7/23/19
to Beancount
bean-file --help is your friend.
It will identify all the files in the given directory and rename them according to matched account name provided by importer and insert an extracted date in front.
Runs from the CLI.
That's what I use.
Does not modify your ledger file.

 

Preferably, I'd have a tool that does not change the ledger file itself; as is the rule of thumb for most CLI-tools. Instead, given a transaction statement (line in file, the statement itself?) it should move or copy the file into the correct location and then present a formatted string that can be copied into that statement in an editor. This could easily be part of a vim macro for example.

I most often don't explictily associate a document via metadata, I find it sufficient to just have the file renamed with the date and directory matching the account name.

One plugin that would be useful is one that would attempt to automatically associate all found documents (appropriately renamed under directory hierarchy) to their closest matching transaction from the ledger.  This could run fast, and would avoid wasting your time inserting metadata. Some people need precision though and explicitly adding it (e.g. if you're running a company), I haven't built any tools to help with that.






 

Kind regards,
Bèr

--
You received this message because you are subscribed to the Google Groups "Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beancount+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/83aee260-a3a5-4d3d-8fd2-baf524286bd8%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages