diff options
-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 | ||||
-rw-r--r-- | test/baseline/opt-account.test | 12 | ||||
-rw-r--r-- | test/baseline/opt-code-as-account.test | 2 | ||||
-rw-r--r-- | test/baseline/opt-code-as-payee.test | 2 | ||||
-rw-r--r-- | test/baseline/opt-comm-as-account.test | 11 | ||||
-rw-r--r-- | test/baseline/opt-comm-as-payee.test | 11 | ||||
-rw-r--r-- | test/baseline/opt-commodity-as-account.test | 2 | ||||
-rw-r--r-- | test/baseline/opt-commodity-as-payee.test | 2 | ||||
-rw-r--r-- | test/baseline/opt-master-account.test | 15 | ||||
-rw-r--r-- | test/baseline/opt-payee-as-account.test | 2 | ||||
-rw-r--r-- | test/baseline/opt-payee.test (renamed from test/baseline/opt-set-payee.test) | 2 | ||||
-rw-r--r-- | test/baseline/opt-set-account.test | 11 | ||||
-rw-r--r-- | test/manual/transaction-codes-2.test | 2 | ||||
-rw-r--r-- | test/manual/transaction-notes-4.test | 2 |
19 files changed, 45 insertions, 120 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); }; diff --git a/test/baseline/opt-account.test b/test/baseline/opt-account.test index d89ea52d..7cda3c4d 100644 --- a/test/baseline/opt-account.test +++ b/test/baseline/opt-account.test @@ -1,15 +1,11 @@ -bal --account=Master +reg --account='payee + ":" + commodity' <<< 2007/02/02 RD VMMXX Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00 Income:Dividends:Vanguard:VMMXX $-0.35 >>>1 - $-0.35 - 0.350 VMMXX Master - 0.350 VMMXX Assets:Investments:Vanguard:VMMXX - $-0.35 Income:Dividends:Vanguard:VMMXX --------------------- - $-0.35 - 0.350 VMMXX +07-Feb-02 RD VMMXX RD VMMXX:VMMXX 0.350 VMMXX 0.350 VMMXX +07-Feb-02 RD VMMXX RD VMMXX:$ $-0.35 $-0.35 + 0.350 VMMXX >>>2 === 0 diff --git a/test/baseline/opt-code-as-account.test b/test/baseline/opt-code-as-account.test index c95ebd22..c669427e 100644 --- a/test/baseline/opt-code-as-account.test +++ b/test/baseline/opt-code-as-account.test @@ -1,4 +1,4 @@ -reg --code-as-account +reg --account=code <<< 2008/01/01 * (100) January Expenses:Books $10.00 diff --git a/test/baseline/opt-code-as-payee.test b/test/baseline/opt-code-as-payee.test index 8feafc6e..c2988626 100644 --- a/test/baseline/opt-code-as-payee.test +++ b/test/baseline/opt-code-as-payee.test @@ -1,4 +1,4 @@ -reg --code-as-payee +reg --payee=code <<< 2008/01/01 * (100) January Expenses:Books $10.00 diff --git a/test/baseline/opt-comm-as-account.test b/test/baseline/opt-comm-as-account.test deleted file mode 100644 index c92a47fd..00000000 --- a/test/baseline/opt-comm-as-account.test +++ /dev/null @@ -1,11 +0,0 @@ -reg --comm-as-account -<<< -2007/02/02 RD VMMXX - Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00 - Income:Dividends:Vanguard:VMMXX $-0.35 ->>>1 -07-Feb-02 RD VMMXX VMMXX 0.350 VMMXX 0.350 VMMXX -07-Feb-02 RD VMMXX $ $-0.35 $-0.35 - 0.350 VMMXX ->>>2 -=== 0 diff --git a/test/baseline/opt-comm-as-payee.test b/test/baseline/opt-comm-as-payee.test deleted file mode 100644 index 94b37b85..00000000 --- a/test/baseline/opt-comm-as-payee.test +++ /dev/null @@ -1,11 +0,0 @@ -reg --comm-as-payee -<<< -2007/02/02 RD VMMXX - Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00 - Income:Dividends:Vanguard:VMMXX $-0.35 ->>>1 -07-Feb-02 VMMXX As:In:Vanguard:VMMXX 0.350 VMMXX 0.350 VMMXX -07-Feb-02 $ In:Di:Vanguard:VMMXX $-0.35 $-0.35 - 0.350 VMMXX ->>>2 -=== 0 diff --git a/test/baseline/opt-commodity-as-account.test b/test/baseline/opt-commodity-as-account.test index 6dcf8ace..44fb0028 100644 --- a/test/baseline/opt-commodity-as-account.test +++ b/test/baseline/opt-commodity-as-account.test @@ -1,4 +1,4 @@ -reg --commodity-as-account +reg --account=commodity <<< 2007/02/02 RD VMMXX Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00 diff --git a/test/baseline/opt-commodity-as-payee.test b/test/baseline/opt-commodity-as-payee.test index 9872a15c..2f829b4a 100644 --- a/test/baseline/opt-commodity-as-payee.test +++ b/test/baseline/opt-commodity-as-payee.test @@ -1,4 +1,4 @@ -reg --commodity-as-payee +reg --payee=commodity <<< 2007/02/02 RD VMMXX Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00 diff --git a/test/baseline/opt-master-account.test b/test/baseline/opt-master-account.test new file mode 100644 index 00000000..1b571e6b --- /dev/null +++ b/test/baseline/opt-master-account.test @@ -0,0 +1,15 @@ +bal --master-account=Master +<<< +2007/02/02 RD VMMXX + Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00 + Income:Dividends:Vanguard:VMMXX $-0.35 +>>>1 + $-0.35 + 0.350 VMMXX Master + 0.350 VMMXX Assets:Investments:Vanguard:VMMXX + $-0.35 Income:Dividends:Vanguard:VMMXX +-------------------- + $-0.35 + 0.350 VMMXX +>>>2 +=== 0 diff --git a/test/baseline/opt-payee-as-account.test b/test/baseline/opt-payee-as-account.test index e85f5f0c..a9c95b2c 100644 --- a/test/baseline/opt-payee-as-account.test +++ b/test/baseline/opt-payee-as-account.test @@ -1,4 +1,4 @@ -reg --payee-as-account +reg --account=payee <<< 2008/01/01 * (100) January Expenses:Books $10.00 diff --git a/test/baseline/opt-set-payee.test b/test/baseline/opt-payee.test index 7f05da53..56ee0cde 100644 --- a/test/baseline/opt-set-payee.test +++ b/test/baseline/opt-payee.test @@ -1,4 +1,4 @@ -reg --set-payee='account_base + ":" + commodity' +reg --payee='account_base + ":" + commodity' <<< 2007/02/02 RD VMMXX Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00 diff --git a/test/baseline/opt-set-account.test b/test/baseline/opt-set-account.test deleted file mode 100644 index 4da48f08..00000000 --- a/test/baseline/opt-set-account.test +++ /dev/null @@ -1,11 +0,0 @@ -reg --set-account='payee + ":" + commodity' -<<< -2007/02/02 RD VMMXX - Assets:Investments:Vanguard:VMMXX 0.350 VMMXX @ $1.00 - Income:Dividends:Vanguard:VMMXX $-0.35 ->>>1 -07-Feb-02 RD VMMXX RD VMMXX:VMMXX 0.350 VMMXX 0.350 VMMXX -07-Feb-02 RD VMMXX RD VMMXX:$ $-0.35 $-0.35 - 0.350 VMMXX ->>>2 -=== 0 diff --git a/test/manual/transaction-codes-2.test b/test/manual/transaction-codes-2.test index 4e4c76cf..140044d3 100644 --- a/test/manual/transaction-codes-2.test +++ b/test/manual/transaction-codes-2.test @@ -1,4 +1,4 @@ -bal checking --set-reported-account=code +bal checking --account=code <<< 2009/10/29 (XFER) Panera Bread Expenses:Food $4.50 diff --git a/test/manual/transaction-notes-4.test b/test/manual/transaction-notes-4.test index 516094c7..3dd82677 100644 --- a/test/manual/transaction-notes-4.test +++ b/test/manual/transaction-notes-4.test @@ -1,4 +1,4 @@ -bal food and tag type --set-reported-account='"Tags:" + tag("Type")' +bal food and tag type --account='"Tags:" + tag("Type")' <<< 2009/11/01 Panera Bread ; Got something to eat Expenses:Food $4.50 |