format package:hledger-lib
Clip and pad a string to a minimum & maximum width, andor
leftright justify it. Works on multi-line strings too (but will
rewrite non-unix line endings).
Clip and pad a string to a minimum & maximum width, andor
leftright justify it. Works on multi-line strings too (but will
rewrite non-unix line endings).
A data field to be formatted and interpolated. Parameters:
- Left justify ? Right justified if false
- Minimum width ? Will be space-padded if narrower than this
- Maximum width ? Will be clipped if wider than this
- Which of the standard hledger report item fields to
interpolate
Literal text to be rendered as-is
One of the standard *-separated value file types known by hledger,
The id of a data format understood by hledger, eg journal or
csv. The --output-format option selects one of these for
output.
Formatting options available when displaying Amounts and MixedAmounts.
Similar to
AmountStyle but lower level, not attached to amounts
or commodities, and can override it in some ways. See also hledger
manual > "Amount formatting, parseability", which speaks of human,
hledger, and machine output.
Parse format strings provided by --format, with awareness of hledger's
report item fields. The formats are used by report-specific renderers
like renderBalanceReportItem.
A format specification/template to use when rendering a report line
item as text.
A format is a sequence of components; each is either a literal string,
or a hledger report item field with specified width and justification
whose value will be interpolated at render time.
A component's value may be a multi-line string (or a multi-commodity
amount), in which case the final string will be either single-line or
a top or bottom-aligned multi-line string depending on the
StringFormat variant used.
Currently this is only used in the balance command's single-column
mode, which provides a limited StringFormat renderer.
Default line format for balance report: "%20(total)
%2(depth_spacer)%-(account)"
Parse a string format specification, or return a parse error.
a file/storage format to try, unless overridden by a filename prefix.
Nothing means try all.
Apply standard ANSI SGR formatting (red, bold) suitable for console
error text.
Apply standard ANSI SGR formatting (yellow, bold) suitable for console
warning text.