[Pkg-haskell-maintainers] Bug#753609: hledger: in CSV rules files, include statement is relative to working dir (not rules file)

Jonas Smedegaard dr at jones.dk
Thu Jul 3 15:12:52 UTC 2014


Package: hledger
Version: 0.23.2-1+b1
Severity: normal

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

the include statement for CSV rules files would be a good feature to
express e.g. common CSV formats as reusable rules file "snippets".

In practice it is less useful, however, because include paths are
resolved relative to current workingdir, not relative to the file
containing the include statement.

Concrete example: Most banks in Denmark use same data format for CSV
export (BEC).  I want that defined in a shared folder available also for
my girlfriend, and I want some filters reused across several of my own
annual journals.

This works fine when all is in same dir:

mybank-2012.csv:
  "Dato";"Tekst";"Beløb";"Saldo";"Valørdato";"Type";"Adviseringer";
  02-01-2012;"Årsgebyr Visa/Dankort";-150.00; 2759.05;"30-12-2011";
  09-01-2012;"BS DK HOSTMASTER A/S";-45.00; 2714.05;"09-01-2012";"";
  10-01-2012;"SLICEHOST";-284.99; 2429.06;"10-01-2012";

mybank-2012.csv.rules:
  include merkur.rules
  # rules specific to 2012 dump ...

merkur.rules:
  include bec.rules
  # rules specific to my bank (Merkur Andelskasse)...

bec.rules:
  fields date, description1, amount1,, date2, code, description2
  amount %amount1 kr
  description %description1 - %description2
  skip 1
  date-format %d-%m-%Y

Then I reorganize (and adapt include statements to match) like this:

mycompany/2012/bank.csv
mycompany/2012/bank.csv.rules
mycompany/merkur.rules
shared/bec.rules

If I run "hledger -f bank.csv" from "mycompany/2012", it works only if
all filter rules are stored directly in bank.csv.rules.

If I run "hledger -f 2012/bank.csv" from "mycompany", it works if
content of bec.rules is stuffed into merkur.rules.


In my actual setup, I cat and pipe, and use hledger -f-, and then
failures to include is silent - the errors emitted are those of the
core "fields" statement missing.


 - Jonas

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQF8BAEBCgBmBQJTtXLxXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ3NjQ4ODQwMTIyRTJDNTBFQzUxRDQwRTI0
RUMxQjcyMjM3NEY5QkQ2AAoJEE7BtyI3T5vWaDIH/jIu00yU/ukC0ZHIW8Tw7a3w
iNxqw9Tw554OZIlxKjMbQoMT2V+oJCeiU3zh3tDt5xtO/61vVeTbRmzl8mxqO6+A
kPSOYcjTN1BMTZktnCydhiSORPhbeRD6qmiP7+Xn/yUkUt2F7rCBaLrFXB2Ds9ha
JyoZG2aX5qXDGq9bXiOAF5o0d4Bv6ywqmlHPGkMf9ilB/L1EsbAMKh1/9ecaT6sX
lZ/Cxdi24RHE/MbDEorjLFtUUBg1nGtf2mlGXAJDEvyhOOKu9Y4Zt/uw58WBJqAo
mW3xNtrl6UpNuvzBbzbRsTCFCue4kjov/dn9RtFaAR+1uC8ImZbg2YloSVXF9q0=
=Ywcy
-----END PGP SIGNATURE-----



More information about the Pkg-haskell-maintainers mailing list