diff options
author | John Wiegley <johnw@newartisans.com> | 2009-06-21 18:07:27 +0100 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-06-21 18:07:27 +0100 |
commit | 521b935aa8ef68ac3a8a1fe1a37eed39b41eec95 (patch) | |
tree | b7e482b7ea2d7725387046fdd6523e0f15f1dfa3 /src/report.cc | |
parent | 7287aad336161eb9a143f188c92d462e62051374 (diff) | |
download | fork-ledger-521b935aa8ef68ac3a8a1fe1a37eed39b41eec95.tar.gz fork-ledger-521b935aa8ef68ac3a8a1fe1a37eed39b41eec95.tar.bz2 fork-ledger-521b935aa8ef68ac3a8a1fe1a37eed39b41eec95.zip |
Restored --percent option, added baseline test
Diffstat (limited to 'src/report.cc')
-rw-r--r-- | src/report.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/report.cc b/src/report.cc index 8ccdfad1..1aa614ec 100644 --- a/src/report.cc +++ b/src/report.cc @@ -291,6 +291,13 @@ value_t report_t::fn_ansify_if(call_scope_t& scope) } } +value_t report_t::fn_percent(call_scope_t& scope) +{ + interactive_t args(scope, "aa"); + return (amount_t("100.00%") * + (args.get<amount_t>(0) / args.get<amount_t>(1)).number()); +} + namespace { value_t fn_black(call_scope_t&) { return string_value("black"); @@ -402,7 +409,7 @@ option_t<report_t> * report_t::lookup_option(const char * p) { switch (*p) { case '%': - OPT_CH(percentage); + OPT_CH(percent); break; case 'A': OPT_CH(average); @@ -568,7 +575,7 @@ option_t<report_t> * report_t::lookup_option(const char * p) OPT(pager_); else OPT(payee_as_account); else OPT(pending); - else OPT(percentage); + else OPT(percent); else OPT_(period_); else OPT(period_sort_); else OPT(plot_amount_format_); @@ -842,6 +849,8 @@ expr_t::ptr_op_t report_t::lookup(const string& name) } else if (is_eq(p, "post")) return WRAP_FUNCTOR(fn_false); + else if (is_eq(p, "percent")) + return MAKE_FUNCTOR(report_t::fn_percent); break; case 'q': |