summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-10-28 01:17:10 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-10-28 01:17:10 -0400
commit559566751ddd29caf2cd74c3d44982c907bd1020 (patch)
tree251cfd38ee17dac245256d8a87d45735fca82a77 /src
parentb7233edd8a7101c16d41837a8ebe2710ede76cc7 (diff)
downloadfork-ledger-559566751ddd29caf2cd74c3d44982c907bd1020.tar.gz
fork-ledger-559566751ddd29caf2cd74c3d44982c907bd1020.tar.bz2
fork-ledger-559566751ddd29caf2cd74c3d44982c907bd1020.zip
Sort by default unless --unsorted is selected
Diffstat (limited to 'src')
-rw-r--r--src/chain.cc8
-rw-r--r--src/report.cc1
-rw-r--r--src/report.h3
3 files changed, 12 insertions, 0 deletions
diff --git a/src/chain.cc b/src/chain.cc
index 25f4833c..018b3812 100644
--- a/src/chain.cc
+++ b/src/chain.cc
@@ -114,6 +114,10 @@ post_handler_ptr chain_post_handlers(report_t& report,
else
handler.reset(new sort_posts(handler, report.HANDLER(sort_).str()));
}
+ else if (! report.HANDLED(period_) &&
+ ! report.HANDLED(unsorted)) {
+ handler.reset(new sort_posts(handler, "date"));
+ }
// collapse_posts causes xacts with multiple posts to appear as xacts
// with a subtotaled post for each commodity used.
@@ -135,6 +139,10 @@ post_handler_ptr chain_post_handlers(report_t& report,
else if (report.HANDLED(subtotal))
handler.reset(new subtotal_posts(handler, expr));
}
+ else if (! report.HANDLED(period_) &&
+ ! report.HANDLED(unsorted)) {
+ handler.reset(new sort_posts(handler, "date"));
+ }
if (report.HANDLED(dow))
handler.reset(new dow_posts(handler, expr));
diff --git a/src/report.cc b/src/report.cc
index e6194541..6b34d2d8 100644
--- a/src/report.cc
+++ b/src/report.cc
@@ -650,6 +650,7 @@ option_t<report_t> * report_t::lookup_option(const char * p)
OPT(unbudgeted);
else OPT(uncleared);
else OPT(unround);
+ else OPT(unsorted);
break;
case 'w':
OPT(weekly);
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");
});