// Command pdfamount walks a Documents folder, downloads matching PDFs and // extracts the payable amount, printing "file_id\ttitle\tamount". // // Usage: pdfamount [TITLE_FILTER_REGEX] package main import ( "bytes" "context" "fmt" "os" "os/exec" "regexp" "strconv" "strings" "time" onlyoffice "github.com/eslider/go-onlyoffice" ) // amountLabels are the payable-amount labels in priority order: the first // label present in a document wins. Within one label the last amount is taken, // because totals usually come last. // // "gesamtsumme" is not in the original list but is the real label on Diashop // invoices: "Gesamtsumme (inkl. Steuern)". var amountLabels = []string{ "zu zahlender betrag", "rechnungsbetrag", "rechnungsendbetrag", "endbetrag", "zahlbetrag", "bruttobetrag", "gesamtbetrag", "gesamtsumme", "betrag", "total", "summe", } // amountRes matches "