Added --time-report option
This is a rather basic option at the moment which only affects the
balance report. I use it as follows, for entering contractor hours into
a project planning application, where $1 is the contractor's timelog
file, and $2 is the date after which new entries appear in the file:
ledger -f $1 balance \
--account=payee \
--time-report \
-d "latest > [$2]" \
--datetime-format='%m/%d/%y %I:%M %p'
This commit is contained in:
parent
2932e05c18
commit
c8dd3d28e3
4 changed files with 23 additions and 1 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
.Dd March 10, 2012
|
.Dd March 13, 2012
|
||||||
.Dt ledger 1
|
.Dt ledger 1
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm ledger
|
.Nm ledger
|
||||||
|
|
@ -415,6 +415,7 @@ appeared in the original journal file.
|
||||||
.It Fl \-strict
|
.It Fl \-strict
|
||||||
.It Fl \-subtotal Pq Fl s
|
.It Fl \-subtotal Pq Fl s
|
||||||
.It Fl \-tail Ar INT
|
.It Fl \-tail Ar INT
|
||||||
|
.It Fl \-time-report
|
||||||
.It Fl \-total Ar EXPR
|
.It Fl \-total Ar EXPR
|
||||||
.It Fl \-total-data Pq Fl J
|
.It Fl \-total-data Pq Fl J
|
||||||
.It Fl \-total-width Ar INT
|
.It Fl \-total-width Ar INT
|
||||||
|
|
|
||||||
|
|
@ -1224,6 +1224,7 @@ option_t<report_t> * report_t::lookup_option(const char * p)
|
||||||
else OPT(total_data);
|
else OPT(total_data);
|
||||||
else OPT(truncate_);
|
else OPT(truncate_);
|
||||||
else OPT(total_width_);
|
else OPT(total_width_);
|
||||||
|
else OPT(time_report);
|
||||||
break;
|
break;
|
||||||
case 'u':
|
case 'u':
|
||||||
OPT(unbudgeted);
|
OPT(unbudgeted);
|
||||||
|
|
|
||||||
20
src/report.h
20
src/report.h
|
|
@ -324,6 +324,7 @@ public:
|
||||||
HANDLER(start_of_week_).report(out);
|
HANDLER(start_of_week_).report(out);
|
||||||
HANDLER(subtotal).report(out);
|
HANDLER(subtotal).report(out);
|
||||||
HANDLER(tail_).report(out);
|
HANDLER(tail_).report(out);
|
||||||
|
HANDLER(time_report).report(out);
|
||||||
HANDLER(total_).report(out);
|
HANDLER(total_).report(out);
|
||||||
HANDLER(total_data).report(out);
|
HANDLER(total_data).report(out);
|
||||||
HANDLER(truncate_).report(out);
|
HANDLER(truncate_).report(out);
|
||||||
|
|
@ -947,6 +948,25 @@ public:
|
||||||
OPTION(report_t, subtotal); // -s
|
OPTION(report_t, subtotal); // -s
|
||||||
OPTION(report_t, tail_);
|
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__
|
OPTION__
|
||||||
(report_t, total_, // -T
|
(report_t, total_, // -T
|
||||||
DECL1(report_t, total_, merged_expr_t, expr, ("total_expr", "total")) {}
|
DECL1(report_t, total_, merged_expr_t, expr, ("total_expr", "total")) {}
|
||||||
|
|
|
||||||
0
test/baseline/opt-time-report.test
Normal file
0
test/baseline/opt-time-report.test
Normal file
Loading…
Add table
Reference in a new issue