summaryrefslogtreecommitdiff
path: root/src/global.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-06-18 16:08:43 +0100
committerJohn Wiegley <johnw@newartisans.com>2009-06-18 16:08:43 +0100
commit8d97adec7bcba851dcf3e1d659767e7bf8de20ca (patch)
tree1e2a72827158498687ab6636383a321d8c9574ea /src/global.cc
parent8dbf458e144dce2b1c6d864fd6a479026ccffaeb (diff)
downloadfork-ledger-8d97adec7bcba851dcf3e1d659767e7bf8de20ca.tar.gz
fork-ledger-8d97adec7bcba851dcf3e1d659767e7bf8de20ca.tar.bz2
fork-ledger-8d97adec7bcba851dcf3e1d659767e7bf8de20ca.zip
Restored --plot-amount-format, --plot-total-format
Diffstat (limited to 'src/global.cc')
-rw-r--r--src/global.cc22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/global.cc b/src/global.cc
index 60865284..b0b08930 100644
--- a/src/global.cc
+++ b/src/global.cc
@@ -179,8 +179,6 @@ void global_scope_t::execute_command(strings_list args, bool at_repl)
if (bool(command = look_for_precommand(bound_scope, verb)))
is_precommand = true;
- else if (! bool(command = look_for_command(bound_scope, verb)))
- throw_(std::logic_error, _("Unrecognized command '%1'") << verb);
// If it is not a pre-command, then parse the user's ledger data at this
// time if not done alreday (i.e., if not at a REPL). Then patch up the
@@ -189,7 +187,11 @@ void global_scope_t::execute_command(strings_list args, bool at_repl)
if (! is_precommand) {
if (! at_repl)
session().read_journal_files();
+
normalize_report_options(verb);
+
+ if (! bool(command = look_for_command(bound_scope, verb)))
+ throw_(std::logic_error, _("Unrecognized command '%1'") << verb);
}
// Create the output stream (it might be a file, the console or a PAGER
@@ -207,9 +209,8 @@ void global_scope_t::execute_command(strings_list args, bool at_repl)
// Now that the output stream is initialized, report the options that will
// participate in this report, if the user specified --options
- if (HANDLED(options)) {
+ if (HANDLED(options))
report_options(report(), report().output_stream);
- }
// Create an argument scope containing the report command's arguments, and
// then invoke the command. The bound scope causes lookups to happen
@@ -465,18 +466,27 @@ void global_scope_t::normalize_report_options(const string& verb)
if (! rep.HANDLED(begin_) && interval.start) {
string predicate =
"date>=[" + to_iso_extended_string(*interval.start) + "]";
- rep.HANDLER(limit_).on(string("--begin"), predicate);
+ rep.HANDLER(limit_).on(string("?normalize"), predicate);
}
if (! rep.HANDLED(end_) && interval.end) {
string predicate =
"date<[" + to_iso_extended_string(*interval.end) + "]";
- rep.HANDLER(limit_).on(string("--end"), predicate);
+ rep.HANDLER(limit_).on(string("?normalize"), predicate);
}
if (! interval.duration)
rep.HANDLER(period_).off();
}
+ if (rep.HANDLED(amount_data)) {
+ rep.HANDLER(format_)
+ .on_with(string("?normalize"), rep.HANDLER(plot_amount_format_).value);
+ }
+ else if (rep.HANDLED(total_data)) {
+ rep.HANDLER(format_)
+ .on_with(string("?normalize"), rep.HANDLER(plot_total_format_).value);
+ }
+
long cols = 0;
if (rep.HANDLED(columns_))
cols = rep.HANDLER(columns_).value.to_long();