diff options
author | John Wiegley <johnw@newartisans.com> | 2009-10-26 19:09:24 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-10-26 19:09:24 -0400 |
commit | 7fae606d622d8cd463ce5f81f5d7872a4fdebc60 (patch) | |
tree | be5550e492b20c135143c821fbc18cbd63c27060 /src/report.cc | |
parent | 92d1bbbe75df71731d458f5b48bcb0f145428920 (diff) | |
parent | 3fdd75fb5b2614f7dab29fd5ad5c9efed6e80b79 (diff) | |
download | fork-ledger-7fae606d622d8cd463ce5f81f5d7872a4fdebc60.tar.gz fork-ledger-7fae606d622d8cd463ce5f81f5d7872a4fdebc60.tar.bz2 fork-ledger-7fae606d622d8cd463ce5f81f5d7872a4fdebc60.zip |
Merge branch 'next'
Diffstat (limited to 'src/report.cc')
-rw-r--r-- | src/report.cc | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/report.cc b/src/report.cc index 9c8ad8ba..53426f39 100644 --- a/src/report.cc +++ b/src/report.cc @@ -81,11 +81,14 @@ void report_t::accounts_report(acct_handler_ptr handler) true), walker); scoped_ptr<accounts_iterator> iter; - if (! HANDLED(sort_)) + if (! HANDLED(sort_)) { iter.reset(new basic_accounts_iterator(*session.master)); - else - iter.reset(new sorted_accounts_iterator(HANDLER(sort_).str(), - HANDLED(flat), *session.master.get())); + } else { + expr_t sort_expr(HANDLER(sort_).str()); + sort_expr.set_context(this); + iter.reset(new sorted_accounts_iterator(*session.master.get(), + sort_expr, HANDLED(flat))); + } if (HANDLED(display_)) pass_down_accounts(handler, *iter.get(), @@ -408,6 +411,14 @@ value_t report_t::reload_command(call_scope_t&) return true; } +value_t report_t::echo_command(call_scope_t& scope) +{ + interactive_t args(scope, "s"); + std::ostream& out(output_stream); + out << args.get<string>(0) << std::endl; + return true; +} + bool report_t::maybe_import(const string& module) { if (lookup(string(OPT_PREFIX) + "import_")) { @@ -710,6 +721,8 @@ expr_t::ptr_op_t report_t::lookup(const string& name) else if (is_eq(q, "emacs")) return WRAP_FUNCTOR (reporter<>(new format_emacs_posts(output_stream), *this, "#emacs")); + else if (is_eq(q, "echo")) + return MAKE_FUNCTOR(report_t::echo_command); break; case 'p': @@ -890,6 +903,13 @@ expr_t::ptr_op_t report_t::lookup(const string& name) return MAKE_FUNCTOR(report_t::fn_total_expr); else if (is_eq(p, "today")) return MAKE_FUNCTOR(report_t::fn_today); + else if (is_eq(p, "t")) + return MAKE_FUNCTOR(report_t::fn_display_amount); + break; + + case 'T': + if (is_eq(p, "T")) + return MAKE_FUNCTOR(report_t::fn_display_total); break; case 'u': |