summaryrefslogtreecommitdiff
path: root/src/print.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2010-05-30 02:28:58 -0600
committerJohn Wiegley <johnw@newartisans.com>2010-05-30 02:47:40 -0600
commit647d4aac2fa474085d01f7ea1cebdc34fafd64a6 (patch)
treec17157d73c3a9d5dd182a4b7b0896e4f31e318be /src/print.cc
parenta41d33fba37460587f59ea0349ac4947a4de9f3c (diff)
downloadfork-ledger-647d4aac2fa474085d01f7ea1cebdc34fafd64a6.tar.gz
fork-ledger-647d4aac2fa474085d01f7ea1cebdc34fafd64a6.tar.bz2
fork-ledger-647d4aac2fa474085d01f7ea1cebdc34fafd64a6.zip
New: --group-by=EXPR and --group-title-format=FMT
The --group-by option allows for most reports to be split up into sections based on the varying value of EXPR. For example, to see register subtotals by payee, use: ledger reg --group-by=payee -s This works for separated balances too: ledger bal --group-by=payee Another interesting possibility is seeing a register of all the accounts affected by a related account: ledger reg -r --group-by=payee The option --group-title-format can be used to add a separator bar to the group titles. The option --no-titles can be used to drop titles altogether.
Diffstat (limited to 'src/print.cc')
-rw-r--r--src/print.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/print.cc b/src/print.cc
index 5c46f4e7..a8aa5872 100644
--- a/src/print.cc
+++ b/src/print.cc
@@ -42,7 +42,7 @@ namespace ledger {
print_xacts::print_xacts(report_t& _report,
bool _print_raw)
- : report(_report), print_raw(_print_raw)
+ : report(_report), print_raw(_print_raw), first_title(true)
{
TRACE_CTOR(print_xacts, "report&, bool");
}
@@ -221,6 +221,16 @@ namespace {
}
}
+void print_xacts::title(const string&)
+{
+ if (first_title) {
+ first_title = false;
+ } else {
+ std::ostream& out(report.output_stream);
+ out << '\n';
+ }
+}
+
void print_xacts::flush()
{
std::ostream& out(report.output_stream);