From 559566751ddd29caf2cd74c3d44982c907bd1020 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Wed, 28 Oct 2009 01:17:10 -0400 Subject: Sort by default unless --unsorted is selected --- src/report.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/report.h') diff --git a/src/report.h b/src/report.h index 31f65c4f..c44937d4 100644 --- a/src/report.h +++ b/src/report.h @@ -290,6 +290,7 @@ public: HANDLER(unbudgeted).report(out); HANDLER(uncleared).report(out); HANDLER(unround).report(out); + HANDLER(unsorted).report(out); HANDLER(weekly).report(out); HANDLER(wide).report(out); HANDLER(yearly).report(out); @@ -821,6 +822,8 @@ public: .set_expr(string("--unround"), "unrounded(total_expr)"); }); + OPTION(report_t, unsorted); + OPTION_(report_t, weekly, DO() { // -W parent->HANDLER(period_).on(string("--weekly"), "weekly"); }); -- cgit v1.2.3 From 0a6f1a63282d4d8d168861ede881b2978c2045c8 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Wed, 28 Oct 2009 01:19:16 -0400 Subject: -D now means --daily, not --deviation Because --daily is more commonly desired, and fits the pattern of the other periodic switches: -D --daily -W --weekly -M --monthly -Y --yearly Only --quarterly doesn't have its own short option. --- src/report.cc | 2 +- src/report.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/report.h') diff --git a/src/report.cc b/src/report.cc index 6b34d2d8..62b54ad1 100644 --- a/src/report.cc +++ b/src/report.cc @@ -446,7 +446,7 @@ option_t * report_t::lookup_option(const char * p) OPT_CH(cleared); break; case 'D': - OPT_CH(deviation); + OPT_CH(daily); break; case 'E': OPT_CH(empty); diff --git a/src/report.h b/src/report.h index c44937d4..7b840dea 100644 --- a/src/report.h +++ b/src/report.h @@ -451,7 +451,7 @@ public: parent->HANDLER(limit_).on(string("--current"), "date<=today"); }); - OPTION_(report_t, daily, DO() { + OPTION_(report_t, daily, DO() { // -D parent->HANDLER(period_).on(string("--daily"), "daily"); }); @@ -464,7 +464,7 @@ public: string("depth<=") + args.get(1)); }); - OPTION_(report_t, deviation, DO() { // -D + OPTION_(report_t, deviation, DO() { parent->HANDLER(display_total_) .set_expr(string("--deviation"), "amount_expr-total_expr/count"); }); -- cgit v1.2.3 From 18a1c8a3fb7bdd1fc3eba8c5ab799ef79cd73b7c Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Wed, 28 Oct 2009 01:43:04 -0400 Subject: No more trailing spaces in the print report --- src/report.h | 6 +++--- test/regress/793F6BF0.test | 2 +- test/regress/B68FFB0D.test | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/report.h') diff --git a/src/report.h b/src/report.h index 7b840dea..b6133512 100644 --- a/src/report.h +++ b/src/report.h @@ -691,12 +691,12 @@ public: " \"\") %(payee)%(xact.comment)\n" " %(xact.uncleared ?" " (cleared ? \"* \" : (pending ? \"! \" : \"\")) : \"\")" - "%-34(account)" - " %12(calculated ? \"\" : justify(scrub(amount), 12, -1, true))" + "%(calculated ? account : justify(account, 34, -1, false))" + "%(calculated ? \"\" : \" \" + justify(scrub(amount), 12, -1, true))" "%(has_cost & !cost_calculated ?" " \" @ \" + justify(scrub(abs(cost / amount)), 0) : \"\")" "%(comment)\n%/" - " %$7%$8 %$9%$A%$B\n%/\n"); + " %$7%$8%$9%$A%$B\n%/\n"); }); OPTION_(report_t, quantity, DO() { // -O diff --git a/test/regress/793F6BF0.test b/test/regress/793F6BF0.test index a4e1234c..754ddca3 100644 --- a/test/regress/793F6BF0.test +++ b/test/regress/793F6BF0.test @@ -47,6 +47,6 @@ N $ >>>1 2009/03/15 Book Store Expenses:Books $10.00 - Liabilities:MasterCard + Liabilities:MasterCard >>>2 === 0 diff --git a/test/regress/B68FFB0D.test b/test/regress/B68FFB0D.test index 3a43df4c..2dd2086c 100644 --- a/test/regress/B68FFB0D.test +++ b/test/regress/B68FFB0D.test @@ -10,6 +10,6 @@ D $1,000.00 2009/01/01 Sample assets 134.123 FOO @ $8.88 assets 100 BAR @ $8.88 - equity + equity >>>2 === 0 -- cgit v1.2.3 From 0872f80d97fd7d4330e8cc4d0b88bbe2170e5eb1 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Wed, 28 Oct 2009 02:29:22 -0400 Subject: Make "less" the default pager, similar to Git --- src/report.h | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'src/report.h') diff --git a/src/report.h b/src/report.h index b6133512..6d63a0e9 100644 --- a/src/report.h +++ b/src/report.h @@ -629,7 +629,34 @@ public: }); OPTION(report_t, output_); // -o - OPTION(report_t, pager_); + + OPTION__ + (report_t, pager_, + CTOR(report_t, pager_) { +#if 1 + if (! std::getenv("PAGER")) { + bool have_less = false; + if (exists(path("/opt/local/bin/less")) || + exists(path("/usr/local/bin/less")) || + exists(path("/usr/bin/less"))) + have_less = true; + + if (have_less) { + on(none, "less"); + setenv("LESS", "--quit-if-one-screen -R", 0); + } + } +#endif + } + virtual void on_with(const optional& whence, const value_t& text) { + string cmd(text.to_string()); + if (cmd == "" || cmd == "false" || cmd == "off" || + cmd == "none" || cmd == "no" || cmd == "disable") + option_t::off(); + else + option_t::on_with(whence, text); + }); + OPTION(report_t, payee_as_account); OPTION_(report_t, pending, DO() { // -C -- cgit v1.2.3 From 773db54d21772e0c4f76f669f89f51a201cc6261 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Wed, 28 Oct 2009 02:30:17 -0400 Subject: Fixed a gcc warning --- src/report.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/report.h') diff --git a/src/report.h b/src/report.h index 6d63a0e9..294af19a 100644 --- a/src/report.h +++ b/src/report.h @@ -633,7 +633,6 @@ public: OPTION__ (report_t, pager_, CTOR(report_t, pager_) { -#if 1 if (! std::getenv("PAGER")) { bool have_less = false; if (exists(path("/opt/local/bin/less")) || @@ -646,7 +645,6 @@ public: setenv("LESS", "--quit-if-one-screen -R", 0); } } -#endif } virtual void on_with(const optional& whence, const value_t& text) { string cmd(text.to_string()); -- cgit v1.2.3