From 3f899c93e655945a775eecfe81d49fff8befba11 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Tue, 22 Jun 2010 03:20:24 -0400 Subject: Added new "bold" modifier to query expressions For example: ledger bal assets bold checking Or you can use expressions: ledger bal assets bold '=total > 1000' This last is identical to saying: ledger bal -l 'account =~ /assets/' --bold-if='total > 1000' --- src/precmd.cc | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'src/precmd.cc') diff --git a/src/precmd.cc b/src/precmd.cc index 38860766..d9977ab6 100644 --- a/src/precmd.cc +++ b/src/precmd.cc @@ -202,25 +202,23 @@ value_t query_command(call_scope_t& args) query_t query(args.value(), report.what_to_keep(), ! report.HANDLED(collapse)); - if (query) { + if (query.has_predicate(query_t::QUERY_LIMIT)) { call_scope_t sub_args(static_cast(args)); - sub_args.push_back(string_value(query.text())); + sub_args.push_back + (string_value(query.get_predicate(query_t::QUERY_LIMIT).print_to_str())); parse_command(sub_args); } - if (query.tokens_remaining()) { + if (query.has_predicate(query_t::QUERY_SHOW)) { out << std::endl << _("====== Display predicate ======") << std::endl << std::endl; - query.parse_again(); + call_scope_t disp_sub_args(static_cast(args)); + disp_sub_args.push_back + (string_value(query.get_predicate(query_t::QUERY_SHOW).print_to_str())); - if (query) { - call_scope_t disp_sub_args(static_cast(args)); - disp_sub_args.push_back(string_value(query.text())); - - parse_command(disp_sub_args); - } + parse_command(disp_sub_args); } return NULL_VALUE; -- cgit v1.2.3