Refactored and enhanced the --width option used by register (and other
commands in future). register now uses the full terminal width by
default except on windows. Specifically, the output width is set from:
1. a --width option
2. or a COLUMNS environment variable (NB: not the same as a bash shell var)
3. or on POSIX (non-windows) systems, the current terminal width
4. or the default, 80 characters.
Also, register now accepts a description column width as part of
--width's argument, comma-separated (--width W,D). This adjusts the
relative widths of register's description and account columns, which are
normally about half of (W-40):
<--------------------------------- width (W) ---------------------------------->
date (10) description (D) account (W-41-D) amount (12) balance (12)
DDDDDDDDDD dddddddddddddddddddd aaaaaaaaaaaaaaaaaaa AAAAAAAAAAAA AAAAAAAAAAAA
Examples:
$ hledger reg # use terminal width on posix
$ hledger reg -w 100 # width 100, equal description/account widths
$ hledger reg -w 100,40 # width 100, wider description
$ hledger reg -w $COLUMNS,100 # terminal width and set description width
When building hledger on a non-windows system, and the new "curses"
cabal flag is true (as it is by default), include the terminfo package.
This will be useful for detecting terminal width and perhaps other
things.
Installation on posix is slightly harder now, since it will need the C
curses dev libraries. The curses flag lets posix users skip that
requirement by adding -f-curses (or cabal might even do that
automatically).
-N doesn't seem to be used by Ledger currently; we'll
use it as shortcut for --no-total.
-T is used by Ledger to set a custom value expression for the final
total. I'm going to take it as a shortcut for --row-total instead.
A status: query term no longer accepts * as a synonym for 1,
which was a bit confusing since 1 matches both * and !.
For now, it takes a value of 1 (true) or anything else (false).