# HG changeset patch # User Sean E. Russell # Date 1590081336 18000 # Thu May 21 12:15:36 2020 -0500 # Node ID 36fcc5e0ca989e86a29608b2bc627451815f335a # Parent 9469bfc10e715b87387d4eccff8524bfa10890c7 Doc clean-up, and restore the wayward inv script. diff --git a/README.md b/README.md --- a/README.md +++ b/README.md @@ -7,27 +7,19 @@ Generates a PDF invoice from TimeWarrior logs. + Dependencies ------------ - [Basser Lout](http://savannah.nongnu.org/projects/lout). - [Go](https://golang.org). -Both dependencies are probably in your package manager. vim comes with a Lout syntax. - -This software does not require any non-core Go libraries to build, so there's -no `go.mod` file. - -### Why not LaTeX? +Both dependencies are probably in your package manager. vim comes with a +Lout syntax. -1. Lout is a more simple syntax. I can hack together Lout without being - proficient in it, and I have no need to be proficient in LaTeX outside of - this project. -2. Lout is a single 727kb executable. LaTeX (tetex-live) is 445MB distributed - as a bunch of packages (on Arch), and that's considered a small - implementation of LaTex. I've seen LaTeX installations consuming gigabytes - of data. -3. [More information about Lout](https://en.wikipedia.org/wiki/Lout_(software)). +This software does not require any non-core Go libraries to build, so +there's no `go.mod` file. + Installation ------------ @@ -41,41 +33,21 @@ chmod u+x inv cp invoice inv ~/.timewarrior/extensions + Usage ----- -In the normal course of things, you'd run this with `timew`, e.g. - - timew report inv 2019-12-01 - 2019-12-31 client:megacorp - -This runs the script, which also executes Lout to generate the PDF, and clean up. You can get the raw Lout source by using the `inventory` report: - - timew report inventory 2019-12-01 - 2019-12-31 client:megacorp - -The invoice command itself reads from STDIN and expects output in the format of `timew report`. - - invoice [args] +Configure it first. It needs to know your information, your client's +information, and other stuff, and it'll be unhappy if you don't +configure it first. -One way to do that is to have an `echo` report in the extensions directory: - - cat > ~/.timewarrior/extensions/echo <, -e.g. +Next, you have to tag all of your records for that client with +client:, e.g. timew tag @1 client:megacorp -Run your reports with the `client:megacorp` tag; the program uses that to -determine which client configuration information to use, which allows you to -have multiple clients. +Run your reports with the `client:megacorp` tag; the program uses that +to determine which client configuration information to use, which allows +you to have multiple clients. + + +### Running + +In the normal course of things, you'd run this with `timew`, e.g. + + timew report inv 2019-12-01 - 2019-12-31 client:megacorp + +The `inv` script does some set-up, calls `invoice` to generate the +Lout source, runs `lout` to create the PDF, and then cleans up. It's +a pretty simple script, and isn't necessary if you want to run some +commands yourself. + Advanced -------- -There is limited ability to override the template. To do so, have a file -`invoice.tmpl` in the current directory. You can use the one in the source -repository as a starting point. These are Go templates; Go replaces the stuff -in double-braces (`{{` ... `}}`), and if you hard-code those you don't need the -addresses in the configuration, or the client tags on your TimeWarrior records. -You **do** still need the `rate` configuration, and the `{{range .}}` ... -`{{end}}` markup. However, you can mess around with the table formats, fonts, -and etcetera. Change the `$` to `€`. Move the columns around. Weighing in at -78 lines long, it's not too complex. One thing to keep in mind: -**double-braces are Go, single-braces are Lout.** Make sure there are spaces -between Lout braces to prevent Go from trying to mess with them. +### Raw Lout Source + +You can get the raw Lout source by using the `invoice` report: + + timew report invoice 2019-12-01 - 2019-12-31 client:megacorp + +The invoice command itself reads from STDIN and expects output in the +format of `timew report`. + + invoice [args] + +One way to do that is to have an `echo` report in the extensions +directory: + + cat > ~/.timewarrior/extensions/echo < /tmp/$$.lout +lout /tmp/$$.lout > /tmp/$$.ps +d=`date +%Y%m` +ps2pdf /tmp/$$.ps invoice_${d}.pdf +rm /tmp/$$.lout /tmp/$$.ps