diff options
author | John Wiegley <johnw@newartisans.com> | 2009-11-19 03:37:16 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-11-19 03:37:16 -0500 |
commit | cc9110a43a1e2d006de8d24a84bbfb2c6918cf33 (patch) | |
tree | 4230ae03ebea8e2cbc0b6e1de821730e4819af47 /src/precmd.cc | |
parent | 6b557f810e1c6eb2dcd8a24eeeacfcf9cc8210e3 (diff) | |
parent | 63fee4c83775f79364199ea547dbc7e068b0abc8 (diff) | |
download | fork-ledger-cc9110a43a1e2d006de8d24a84bbfb2c6918cf33.tar.gz fork-ledger-cc9110a43a1e2d006de8d24a84bbfb2c6918cf33.tar.bz2 fork-ledger-cc9110a43a1e2d006de8d24a84bbfb2c6918cf33.zip |
Merge branch 'next'
Diffstat (limited to 'src/precmd.cc')
-rw-r--r-- | src/precmd.cc | 77 |
1 files changed, 14 insertions, 63 deletions
diff --git a/src/precmd.cc b/src/precmd.cc index 92483dc8..31249016 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, report.session.current_year); - 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.end) - out << _(" end: ") << format_date(*interval.end) << 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.end) - out << _(" end: ") << format_date(*interval.end) << 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; } @@ -229,14 +184,12 @@ value_t args_command(call_scope_t& args) out << std::endl << std::endl; query_t query(args.value(), report.what_to_keep()); - if (! query) - throw_(std::runtime_error, - _("Invalid query predicate: %1") << join_args(args)); + if (query) { + call_scope_t sub_args(static_cast<scope_t&>(args)); + sub_args.push_back(string_value(query.text())); - call_scope_t sub_args(static_cast<scope_t&>(args)); - sub_args.push_back(string_value(query.text())); - - parse_command(sub_args); + parse_command(sub_args); + } if (query.tokens_remaining()) { out << std::endl << _("====== Display predicate ======") @@ -244,14 +197,12 @@ value_t args_command(call_scope_t& args) query.parse_again(); - if (! query) - throw_(std::runtime_error, - _("Invalid display predicate: %1") << join_args(args)); + if (query) { + call_scope_t disp_sub_args(static_cast<scope_t&>(args)); + disp_sub_args.push_back(string_value(query.text())); - call_scope_t disp_sub_args(static_cast<scope_t&>(args)); - disp_sub_args.push_back(string_value(query.text())); - - parse_command(disp_sub_args); + parse_command(disp_sub_args); + } } return NULL_VALUE; |