summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-21 02:20:08 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-21 02:20:08 -0400
commitf4e13f34580d1b71736f3ea6451d24237ef6fe2c (patch)
tree86f9fbec53b53de19f73d07320217cda9b617c8d /src
parent13812346b6ca97ae2f505f08d898e98db907ede6 (diff)
downloadfork-ledger-f4e13f34580d1b71736f3ea6451d24237ef6fe2c.tar.gz
fork-ledger-f4e13f34580d1b71736f3ea6451d24237ef6fe2c.tar.bz2
fork-ledger-f4e13f34580d1b71736f3ea6451d24237ef6fe2c.zip
Added --start-of-week option, used with --weekly
For example, --start-of-week=monday can be used to report weeks that begin on Mondays.
Diffstat (limited to 'src')
-rw-r--r--src/global.cc2
-rw-r--r--src/report.cc1
-rw-r--r--src/report.h1
3 files changed, 4 insertions, 0 deletions
diff --git a/src/global.cc b/src/global.cc
index e3cfc853..26fa494f 100644
--- a/src/global.cc
+++ b/src/global.cc
@@ -368,6 +368,8 @@ void global_scope_t::normalize_report_options(const string& verb)
output_datetime_format = rep.HANDLER(date_format_).str() + " %H:%M:%S";
output_date_format = rep.HANDLER(date_format_).str();
}
+ if (rep.HANDLED(start_of_week_))
+ start_of_week = string_to_day_of_week(rep.HANDLER(start_of_week_).str());
// jww (2008-08-14): This code really needs to be rationalized away for 3.0.
// I might be able to do it with command objects, like register_t, which
diff --git a/src/report.cc b/src/report.cc
index db70817c..4c6a9c44 100644
--- a/src/report.cc
+++ b/src/report.cc
@@ -447,6 +447,7 @@ option_t<report_t> * report_t::lookup_option(const char * p)
else OPT(sort_all_);
else OPT(sort_entries_);
else OPT_(subtotal);
+ else OPT(start_of_week_);
break;
case 't':
OPT_CH(amount_);
diff --git a/src/report.h b/src/report.h
index 00e0d588..a4020af8 100644
--- a/src/report.h
+++ b/src/report.h
@@ -535,6 +535,7 @@ public:
parent->HANDLER(sort_all_).off();
});
+ OPTION(report_t, start_of_week_);
OPTION(report_t, subtotal); // -s
OPTION(report_t, tail_);