diff options
-rw-r--r-- | doc/ledger.1 | 3 | ||||
-rw-r--r-- | src/report.cc | 1 | ||||
-rw-r--r-- | src/report.h | 20 | ||||
-rw-r--r-- | test/baseline/opt-time-report.test | 0 |
4 files changed, 23 insertions, 1 deletions
diff --git a/doc/ledger.1 b/doc/ledger.1 index 8076c7c4..63017452 100644 --- a/doc/ledger.1 +++ b/doc/ledger.1 @@ -1,4 +1,4 @@ -.Dd March 10, 2012 +.Dd March 13, 2012 .Dt ledger 1 .Sh NAME .Nm ledger @@ -415,6 +415,7 @@ appeared in the original journal file. .It Fl \-strict .It Fl \-subtotal Pq Fl s .It Fl \-tail Ar INT +.It Fl \-time-report .It Fl \-total Ar EXPR .It Fl \-total-data Pq Fl J .It Fl \-total-width Ar INT diff --git a/src/report.cc b/src/report.cc index cf227fe6..e93bd6fd 100644 --- a/src/report.cc +++ b/src/report.cc @@ -1224,6 +1224,7 @@ option_t<report_t> * report_t::lookup_option(const char * p) else OPT(total_data); else OPT(truncate_); else OPT(total_width_); + else OPT(time_report); break; case 'u': OPT(unbudgeted); diff --git a/src/report.h b/src/report.h index 6322aeb8..c0398d4c 100644 --- a/src/report.h +++ b/src/report.h @@ -324,6 +324,7 @@ public: HANDLER(start_of_week_).report(out); HANDLER(subtotal).report(out); HANDLER(tail_).report(out); + HANDLER(time_report).report(out); HANDLER(total_).report(out); HANDLER(total_data).report(out); HANDLER(truncate_).report(out); @@ -947,6 +948,25 @@ public: OPTION(report_t, subtotal); // -s OPTION(report_t, tail_); + OPTION_(report_t, time_report, DO() { + OTHER(balance_format_) + .on(none, + "%(justify(earliest_checkin ? " + " format_datetime(earliest_checkin) : \"\", 19, -1, true)) " + "%(justify(latest_checkout ? " + " format_datetime(latest_checkout) : \"\", 19, -1, true)) " + "%(ansify_if(" + " justify(scrub(display_total), 8," + " 8 + 4 + 19 * 2, true, color), bold if should_bold))" + " %(!options.flat ? depth_spacer : \"\")" + "%-(ansify_if(" + " ansify_if(partial_account(options.flat), blue if color)," + " bold if should_bold))\n%/" + "%$1 %$2 %$3\n%/" + "%(prepend_width ? \" \" * int(prepend_width) : \"\")" + "--------------------------------------------------\n"); + }); + OPTION__ (report_t, total_, // -T DECL1(report_t, total_, merged_expr_t, expr, ("total_expr", "total")) {} diff --git a/test/baseline/opt-time-report.test b/test/baseline/opt-time-report.test new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/baseline/opt-time-report.test |