diff options
Diffstat (limited to 'src/report.cc')
-rw-r--r-- | src/report.cc | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/src/report.cc b/src/report.cc index 9d733674..5c7bf01d 100644 --- a/src/report.cc +++ b/src/report.cc @@ -267,6 +267,11 @@ void report_t::parse_query_args(const value_t& args, const string& whence) DEBUG("report.predicate", "Limit predicate = " << HANDLER(limit_).str()); } + if (query.has_query(query_t::QUERY_ONLY)) { + HANDLER(only_).on(whence, query.get_query(query_t::QUERY_ONLY)); + DEBUG("report.predicate", "Only predicate = " << HANDLER(only_).str()); + } + if (query.has_query(query_t::QUERY_SHOW)) { HANDLER(display_).on(whence, query.get_query(query_t::QUERY_SHOW)); DEBUG("report.predicate", "Display predicate = " << HANDLER(display_).str()); @@ -544,17 +549,19 @@ value_t report_t::fn_trim(call_scope_t& args) } } +value_t report_t::fn_format(call_scope_t& args) +{ + format_t format(args.get<string>(0)); + std::ostringstream out; + out << format(args); + return string_value(out.str()); +} + value_t report_t::fn_print(call_scope_t& args) { - std::ostream& out(output_stream); - bool first = true; - for (std::size_t i = 0; i < args.size(); i++) { - if (first) - first = false; - else - out << ' '; - args[i].print(out); - } + for (std::size_t i = 0; i < args.size(); i++) + args[i].print(output_stream); + static_cast<std::ostream&>(output_stream) << std::endl; return true; } @@ -1173,6 +1180,8 @@ expr_t::ptr_op_t report_t::lookup(const symbol_t::kind_t kind, case 'f': if (is_eq(p, "format_date")) return MAKE_FUNCTOR(report_t::fn_format_date); + else if (is_eq(p, "format")) + return MAKE_FUNCTOR(report_t::fn_format); else if (is_eq(p, "floor")) return MAKE_FUNCTOR(report_t::fn_floor); break; @@ -1444,6 +1453,8 @@ expr_t::ptr_op_t report_t::lookup(const symbol_t::kind_t kind, case 's': if (is_eq(p, "stats") || is_eq(p, "stat")) return WRAP_FUNCTOR(report_statistics); + else if (is_eq(p, "source")) + return WRAP_FUNCTOR(source_command); break; case 'x': |