diff options
author | John Wiegley <johnw@newartisans.com> | 2009-11-06 02:38:46 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-11-06 02:39:30 -0500 |
commit | a05d39b7226a7a383dc30132a2fac2bbd30a54ec (patch) | |
tree | b8a91ddd64b1c7c43612f341bff62530aa986003 /src | |
parent | 05d0f1a17f9f4a9d659274d91dfb164055453637 (diff) | |
download | fork-ledger-a05d39b7226a7a383dc30132a2fac2bbd30a54ec.tar.gz fork-ledger-a05d39b7226a7a383dc30132a2fac2bbd30a54ec.tar.bz2 fork-ledger-a05d39b7226a7a383dc30132a2fac2bbd30a54ec.zip |
Renamed --set-reported-account to just --account
This fits better with the --amount and --total options, which both
change the amount and total used for calculation. Same with --account:
it happens after filtering, but before calculation so that balance
reports look as you'd expect.
Diffstat (limited to 'src')
-rw-r--r-- | src/chain.cc | 39 | ||||
-rw-r--r-- | src/filters.cc | 2 | ||||
-rw-r--r-- | src/report.cc | 14 | ||||
-rw-r--r-- | src/report.h | 20 | ||||
-rw-r--r-- | src/session.cc | 10 | ||||
-rw-r--r-- | src/session.h | 4 |
6 files changed, 18 insertions, 71 deletions
diff --git a/src/chain.cc b/src/chain.cc index defa2e97..4a3a2343 100644 --- a/src/chain.cc +++ b/src/chain.cc @@ -159,15 +159,15 @@ post_handler_ptr chain_post_handlers(report_t& report, handler.reset(new sort_posts(handler, "date")); } - if (report.HANDLED(set_reported_account_)) + if (report.HANDLED(account_)) handler.reset(new transfer_details(handler, transfer_details::SET_ACCOUNT, report.session.journal->master, - report.HANDLER(set_reported_account_).str(), + report.HANDLER(account_).str(), report)); - else if (report.HANDLED(set_reported_payee_)) + if (report.HANDLED(payee_)) handler.reset(new transfer_details(handler, transfer_details::SET_PAYEE, report.session.journal->master, - report.HANDLER(set_reported_payee_).str(), + report.HANDLER(payee_).str(), report)); // related_posts will pass along all posts related to the post received. If @@ -236,37 +236,6 @@ post_handler_ptr chain_post_handlers(report_t& report, report)); } - if (report.HANDLED(set_account_)) - handler.reset(new transfer_details(handler, transfer_details::SET_ACCOUNT, - report.session.journal->master, - report.HANDLER(set_account_).str(), - report)); - else if (report.HANDLED(set_payee_)) - handler.reset(new transfer_details(handler, transfer_details::SET_PAYEE, - report.session.journal->master, - report.HANDLER(set_payee_).str(), - report)); - else if (report.HANDLED(comm_as_payee)) - handler.reset(new transfer_details(handler, transfer_details::SET_PAYEE, - report.session.journal->master, - expr_t("commodity"), report)); - else if (report.HANDLED(code_as_payee)) - handler.reset(new transfer_details(handler, transfer_details::SET_PAYEE, - report.session.journal->master, - expr_t("code"), report)); - else if (report.HANDLED(payee_as_account)) - handler.reset(new transfer_details(handler, transfer_details::SET_ACCOUNT, - report.session.journal->master, - expr_t("payee"), report)); - else if (report.HANDLED(comm_as_account)) - handler.reset(new transfer_details(handler, transfer_details::SET_ACCOUNT, - report.session.journal->master, - expr_t("commodity"), report)); - else if (report.HANDLED(code_as_account)) - handler.reset(new transfer_details(handler, transfer_details::SET_ACCOUNT, - report.session.journal->master, - expr_t("code"), report)); - return handler; } diff --git a/src/filters.cc b/src/filters.cc index 00e495dd..0469d6ec 100644 --- a/src/filters.cc +++ b/src/filters.cc @@ -711,6 +711,7 @@ void transfer_details::operator()(post_t& post) case SET_PAYEE: xact.payee = expr.calc(bound_scope).to_string(); break; + case SET_ACCOUNT: { std::list<string> account_names; temp.account->remove_post(&temp); @@ -720,6 +721,7 @@ void transfer_details::operator()(post_t& post) temp.account->add_post(&temp); break; } + default: assert(false); break; diff --git a/src/report.cc b/src/report.cc index 3b570682..77548cce 100644 --- a/src/report.cc +++ b/src/report.cc @@ -566,7 +566,7 @@ option_t<report_t> * report_t::lookup_option(const char * p) break; case 'a': OPT(abbrev_len_); - else OPT(account_); + else OPT_(account_); else OPT(actual); else OPT(actual_dates); else OPT(add_budget); @@ -589,10 +589,6 @@ option_t<report_t> * report_t::lookup_option(const char * p) case 'c': OPT(csv_format_); else OPT(cleared); - else OPT(code_as_payee); - else OPT_ALT(comm_as_payee, commodity_as_payee); - else OPT(code_as_account); - else OPT_ALT(comm_as_account, commodity_as_account); else OPT(collapse); else OPT(collapse_if_zero); else OPT(color); @@ -666,7 +662,7 @@ option_t<report_t> * report_t::lookup_option(const char * p) break; case 'p': OPT(pager_); - else OPT(payee_as_account); + else OPT(payee_); else OPT(pending); else OPT(percent); else OPT_(period_); @@ -694,11 +690,7 @@ option_t<report_t> * report_t::lookup_option(const char * p) else OPT(revalued_total_); break; case 's': - OPT(set_account_); - else OPT(set_payee_); - else OPT(set_reported_account_); - else OPT(set_reported_payee_); - else OPT(sort_); + OPT(sort_); else OPT(sort_all_); else OPT(sort_xacts_); else OPT_(subtotal); diff --git a/src/report.h b/src/report.h index 431eac3c..a489ed48 100644 --- a/src/report.h +++ b/src/report.h @@ -215,10 +215,6 @@ public: HANDLER(by_payee).report(out); HANDLER(cleared).report(out); HANDLER(cleared_format_).report(out); - HANDLER(code_as_payee).report(out); - HANDLER(comm_as_payee).report(out); - HANDLER(code_as_account).report(out); - HANDLER(comm_as_account).report(out); HANDLER(color).report(out); HANDLER(collapse).report(out); HANDLER(collapse_if_zero).report(out); @@ -262,7 +258,7 @@ public: HANDLER(only_).report(out); HANDLER(output_).report(out); HANDLER(pager_).report(out); - HANDLER(payee_as_account).report(out); + HANDLER(payee_).report(out); HANDLER(pending).report(out); HANDLER(percent).report(out); HANDLER(period_).report(out); @@ -283,10 +279,6 @@ public: HANDLER(revalued_only).report(out); HANDLER(revalued_total_).report(out); HANDLER(seed_).report(out); - HANDLER(set_account_).report(out); - HANDLER(set_payee_).report(out); - HANDLER(set_reported_account_).report(out); - HANDLER(set_reported_payee_).report(out); HANDLER(sort_).report(out); HANDLER(sort_all_).report(out); HANDLER(sort_xacts_).report(out); @@ -429,10 +421,6 @@ public: "---------------- ---------------- ---------\n"); }); - OPTION(report_t, code_as_payee); - OPTION(report_t, comm_as_payee); - OPTION(report_t, code_as_account); - OPTION(report_t, comm_as_account); OPTION(report_t, color); OPTION_(report_t, collapse, DO() { // -n @@ -684,7 +672,7 @@ public: }); #endif // HAVE_ISATTY - OPTION(report_t, payee_as_account); + OPTION(report_t, payee_); OPTION_(report_t, pending, DO() { // -C parent->HANDLER(limit_).on(string("--pending"), "pending"); @@ -808,10 +796,6 @@ public: }); OPTION(report_t, seed_); - OPTION(report_t, set_account_); - OPTION(report_t, set_payee_); - OPTION(report_t, set_reported_account_); - OPTION(report_t, set_reported_payee_); OPTION_(report_t, sort_, DO_(args) { // -S on_with(args[0].as_string(), args[1]); diff --git a/src/session.cc b/src/session.cc index 0e03bbb3..378d12c7 100644 --- a/src/session.cc +++ b/src/session.cc @@ -156,8 +156,8 @@ void session_t::read_journal_files() INFO_START(journal, "Read journal file"); string master_account; - if (HANDLED(account_)) - master_account = HANDLER(account_).str(); + if (HANDLED(master_account_)) + master_account = HANDLER(master_account_).str(); std::size_t count = read_data(master_account); if (count == 0) @@ -187,9 +187,6 @@ option_t<session_t> * session_t::lookup_option(const char * p) case 'Z': OPT_CH(price_exp_); break; - case 'a': - OPT_(account_); // -a - break; case 'c': OPT(cache_); break; @@ -208,6 +205,9 @@ option_t<session_t> * session_t::lookup_option(const char * p) case 'l': OPT_ALT(price_exp_, leeway_); break; + case 'm': + OPT(master_account_); + break; case 'p': OPT(price_db_); else OPT(price_exp_); diff --git a/src/session.h b/src/session.h index 7c5d47dd..579f87a8 100644 --- a/src/session.h +++ b/src/session.h @@ -87,12 +87,12 @@ public: void report_options(std::ostream& out) { - HANDLER(account_).report(out); HANDLER(cache_).report(out); HANDLER(download).report(out); HANDLER(european).report(out); HANDLER(file_).report(out); HANDLER(input_date_format_).report(out); + HANDLER(master_account_).report(out); HANDLER(price_db_).report(out); HANDLER(price_exp_).report(out); HANDLER(strict).report(out); @@ -107,7 +107,6 @@ public: * Option handlers */ - OPTION(session_t, account_); // -a OPTION(session_t, cache_); OPTION(session_t, download); // -Q @@ -141,6 +140,7 @@ public: set_input_date_format(args[1].as_string().c_str()); }); + OPTION(session_t, master_account_); OPTION(session_t, price_db_); OPTION(session_t, strict); }; |