hledger icon indicating copy to clipboard operation
hledger copied to clipboard

getting started with scripting documentation needed

Open legrostdg opened this issue 5 years ago • 5 comments

It would be great to have some documentation of how to make scripts with hledger-lib.

In my case I'd like to write two scripts:

  • I'd like to output transactions using a custom XML format: https://www.impots.gouv.fr/portail/files/media/1_metier/2_professionnel/a47a-i-viii-7.xsd
  • I would need to ensure that each transaction contains tags like "custom transaction number", "reference document"

I've started to look at the hackage page of hledger-lib, but it's not really easy to get started...

legrostdg avatar Jul 22 '18 18:07 legrostdg

You're right. Would you be willing to make some notes as you learn ? Eg in the user cookbook. Such as:

  • questions / things you needed to know / stumbling blocks
  • examples / resources you found
  • parts of a hledger script
  • requirements for developing / running / sharing hledger scripts
  • important/problematic parts of the hledger* APIs
  • any other tips

We used to have lots of examples in https://github.com/simonmichael/hledger/tree/master/bin. For now we still have https://github.com/simonmichael/hledger/blob/master/bin/hledger-check.hs and https://github.com/simonmichael/hledger/blob/master/bin/hledger-smooth.hs to look at. The latter is the most recent and is the template I follow for a robust script without too much boilerplate.

The rest have been turned into builtin commands, which are still useful examples for the active code part.

I'm not sure how best to provide scripting examples going forward. Scripts in bin/ which are useful tend to become builtin commands for maximum accessibility. We could show some in the user cookbook, but it's kind of important to be able to test them.

simonmichael avatar Jul 22 '18 21:07 simonmichael

And of course we'll answer specific questions here or on IRC or mail list.

simonmichael avatar Jul 22 '18 21:07 simonmichael

@simonmichael, what is the best place to ask about hledger usage?

dstrelnikov avatar Jul 24 '18 14:07 dstrelnikov

@simonmichael That's kind of a hard one you're assigning to me :). Thanks for the examples, though.

legrostdg avatar Aug 06 '18 08:08 legrostdg

@dstrelnikov the IRC channel or mail list.

@legrostdg well just some ideas for you or the next person who finds this. :)

simonmichael avatar Aug 16 '18 06:08 simonmichael