summaryrefslogtreecommitdiff
path: root/src/precmd.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-11-18 04:11:14 -0500
committerJohn Wiegley <johnw@newartisans.com>2009-11-18 04:11:14 -0500
commit7fe369eb492f737f570d0ccf4aaf5db68f900279 (patch)
treeec499b8dd3c7c9286e9fa71d3e7a8e2a94c21d83 /src/precmd.cc
parentfe9af7ace7a9b25a3eefe481b6b7a38ad2f758ed (diff)
downloadfork-ledger-7fe369eb492f737f570d0ccf4aaf5db68f900279.tar.gz
fork-ledger-7fe369eb492f737f570d0ccf4aaf5db68f900279.tar.bz2
fork-ledger-7fe369eb492f737f570d0ccf4aaf5db68f900279.zip
The new period parser is implemented, but untested
Diffstat (limited to 'src/precmd.cc')
-rw-r--r--src/precmd.cc53
1 files changed, 4 insertions, 49 deletions
diff --git a/src/precmd.cc b/src/precmd.cc
index c4d7cbaa..0e024a39 100644
--- a/src/precmd.cc
+++ b/src/precmd.cc
@@ -165,57 +165,12 @@ value_t period_command(call_scope_t& args)
report_t& report(find_scope<report_t>(args));
std::ostream& out(report.output_stream);
+ show_period_tokens(out, arg);
+ out << std::endl;
+
date_interval_t interval(arg);
+ interval.dump(out);
- out << _("global details => ") << std::endl << std::endl;
-
- if (interval.start)
- out << _(" start: ") << format_date(*interval.start) << std::endl;
- else
- out << _(" start: TODAY: ") << format_date(CURRENT_DATE()) << std::endl;
- if (interval.finish)
- out << _(" finish: ") << format_date(*interval.finish) << std::endl;
-
- if (interval.skip_duration)
- out << _(" skip: ") << *interval.skip_duration << std::endl;
- if (interval.factor)
- out << _(" factor: ") << interval.factor << std::endl;
- if (interval.duration)
- out << _("duration: ") << *interval.duration << std::endl;
-
- if (interval.find_period(interval.start ?
- *interval.start : CURRENT_DATE())) {
- out << std::endl
- << _("after finding first period => ") << std::endl
- << std::endl;
-
- if (interval.start)
- out << _(" start: ") << format_date(*interval.start) << std::endl;
- if (interval.finish)
- out << _(" finish: ") << format_date(*interval.finish) << std::endl;
-
- if (interval.skip_duration)
- out << _(" skip: ") << *interval.skip_duration << std::endl;
- if (interval.factor)
- out << _(" factor: ") << interval.factor << std::endl;
- if (interval.duration)
- out << _("duration: ") << *interval.duration << std::endl;
-
- out << std::endl;
-
- for (int i = 0; i < 20 && interval; i++, ++interval) {
- out << std::right;
- out.width(2);
-
- out << i << "): " << format_date(*interval.start);
- if (interval.end_of_duration)
- out << " -- " << format_date(*interval.inclusive_end());
- out << std::endl;
-
- if (! interval.skip_duration)
- break;
- }
- }
return NULL_VALUE;
}