diff options
author | John Wiegley <johnw@newartisans.com> | 2009-10-26 17:17:23 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-10-26 17:17:23 -0400 |
commit | 1ed22646f1349e2753ed1194f22dd9f028e8b638 (patch) | |
tree | 3acd66cd3cac124551893cf57b63ea249c9a3784 /src | |
parent | 8999607408c87624f3247a256974e6c341dd3611 (diff) | |
download | ledger-1ed22646f1349e2753ed1194f22dd9f028e8b638.tar.gz ledger-1ed22646f1349e2753ed1194f22dd9f028e8b638.tar.bz2 ledger-1ed22646f1349e2753ed1194f22dd9f028e8b638.zip |
Added an "echo" command, for REPL testing
Diffstat (limited to 'src')
-rw-r--r-- | src/report.cc | 10 | ||||
-rw-r--r-- | src/report.h | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/report.cc b/src/report.cc index 9c8ad8ba..34231b5c 100644 --- a/src/report.cc +++ b/src/report.cc @@ -408,6 +408,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 +718,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': diff --git a/src/report.h b/src/report.h index 5921a154..f0052128 100644 --- a/src/report.h +++ b/src/report.h @@ -178,6 +178,7 @@ public: } value_t reload_command(call_scope_t&); + value_t echo_command(call_scope_t& scope); keep_details_t what_to_keep() { bool lots = HANDLED(lots) || HANDLED(lots_actual); |