Added --auto-match option, for use with 'convert'
This commit is contained in:
parent
5a201971a9
commit
4a18317e7c
5 changed files with 9 additions and 3 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
.Dd June 22, 2010
|
.Dd February 26, 2012
|
||||||
.Dt ledger 1
|
.Dt ledger 1
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm ledger
|
.Nm ledger
|
||||||
|
|
@ -270,6 +270,7 @@ transactions they are contained in. See the manual for more information.
|
||||||
.It Fl \-amount-width Ar INT
|
.It Fl \-amount-width Ar INT
|
||||||
.It Fl \-anon
|
.It Fl \-anon
|
||||||
.It Fl \-args-only
|
.It Fl \-args-only
|
||||||
|
.It Fl \-auto-match
|
||||||
.It Fl \-average Pq Fl A
|
.It Fl \-average Pq Fl A
|
||||||
.It Fl \-balance-format Ar FMT
|
.It Fl \-balance-format Ar FMT
|
||||||
.It Fl \-base
|
.It Fl \-base
|
||||||
|
|
|
||||||
|
|
@ -123,8 +123,10 @@ value_t convert_command(call_scope_t& args)
|
||||||
if (xact->posts.front()->account == NULL) {
|
if (xact->posts.front()->account == NULL) {
|
||||||
// jww (2010-03-07): Bind this logic to an option: --auto-match
|
// jww (2010-03-07): Bind this logic to an option: --auto-match
|
||||||
if (account_t * acct =
|
if (account_t * acct =
|
||||||
|
(report.HANDLED(auto_match) ?
|
||||||
lookup_probable_account(xact->payee, current_xacts.rbegin(),
|
lookup_probable_account(xact->payee, current_xacts.rbegin(),
|
||||||
current_xacts.rend(), bucket).second)
|
current_xacts.rend(), bucket).second :
|
||||||
|
NULL))
|
||||||
xact->posts.front()->account = acct;
|
xact->posts.front()->account = acct;
|
||||||
else
|
else
|
||||||
xact->posts.front()->account = unknown;
|
xact->posts.front()->account = unknown;
|
||||||
|
|
|
||||||
|
|
@ -966,6 +966,7 @@ option_t<report_t> * report_t::lookup_option(const char * p)
|
||||||
else OPT(amount_data);
|
else OPT(amount_data);
|
||||||
else OPT(anon);
|
else OPT(anon);
|
||||||
else OPT_ALT(color, ansi);
|
else OPT_ALT(color, ansi);
|
||||||
|
else OPT(auto_match);
|
||||||
else OPT(average);
|
else OPT(average);
|
||||||
else OPT(account_width_);
|
else OPT(account_width_);
|
||||||
else OPT(amount_width_);
|
else OPT(amount_width_);
|
||||||
|
|
|
||||||
|
|
@ -229,6 +229,7 @@ public:
|
||||||
HANDLER(amount_).report(out);
|
HANDLER(amount_).report(out);
|
||||||
HANDLER(amount_data).report(out);
|
HANDLER(amount_data).report(out);
|
||||||
HANDLER(anon).report(out);
|
HANDLER(anon).report(out);
|
||||||
|
HANDLER(auto_match).report(out);
|
||||||
HANDLER(average).report(out);
|
HANDLER(average).report(out);
|
||||||
HANDLER(balance_format_).report(out);
|
HANDLER(balance_format_).report(out);
|
||||||
HANDLER(base).report(out);
|
HANDLER(base).report(out);
|
||||||
|
|
@ -381,6 +382,7 @@ public:
|
||||||
|
|
||||||
OPTION(report_t, amount_data); // -j
|
OPTION(report_t, amount_data); // -j
|
||||||
OPTION(report_t, anon);
|
OPTION(report_t, anon);
|
||||||
|
OPTION(report_t, auto_match);
|
||||||
|
|
||||||
OPTION_(report_t, average, DO() { // -A
|
OPTION_(report_t, average, DO() { // -A
|
||||||
parent->HANDLER(display_total_)
|
parent->HANDLER(display_total_)
|
||||||
|
|
|
||||||
0
test/baseline/opt-auto-match.test
Normal file
0
test/baseline/opt-auto-match.test
Normal file
Loading…
Add table
Reference in a new issue