summaryrefslogtreecommitdiff
path: root/src/precmd.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2010-06-22 03:20:24 -0400
committerJohn Wiegley <johnw@newartisans.com>2010-06-22 03:20:24 -0400
commit3f899c93e655945a775eecfe81d49fff8befba11 (patch)
treee10129a17ea729379a04f95423599809b1113934 /src/precmd.cc
parent7da270129547aebd84ac0fde63b796f8add8e89a (diff)
downloadfork-ledger-3f899c93e655945a775eecfe81d49fff8befba11.tar.gz
fork-ledger-3f899c93e655945a775eecfe81d49fff8befba11.tar.bz2
fork-ledger-3f899c93e655945a775eecfe81d49fff8befba11.zip
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'
Diffstat (limited to 'src/precmd.cc')
-rw-r--r--src/precmd.cc18
1 files changed, 8 insertions, 10 deletions
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<scope_t&>(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<scope_t&>(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<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;