summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/ledger.13
-rw-r--r--src/convert.cc6
-rw-r--r--src/report.cc1
-rw-r--r--src/report.h2
-rw-r--r--test/baseline/opt-auto-match.test0
5 files changed, 9 insertions, 3 deletions
diff --git a/doc/ledger.1 b/doc/ledger.1
index 5a3bd6db..9fe5c84c 100644
--- a/doc/ledger.1
+++ b/doc/ledger.1
@@ -1,4 +1,4 @@
-.Dd June 22, 2010
+.Dd February 26, 2012
.Dt ledger 1
.Sh NAME
.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 \-anon
.It Fl \-args-only
+.It Fl \-auto-match
.It Fl \-average Pq Fl A
.It Fl \-balance-format Ar FMT
.It Fl \-base
diff --git a/src/convert.cc b/src/convert.cc
index 493fbb7a..1ef3a413 100644
--- a/src/convert.cc
+++ b/src/convert.cc
@@ -123,8 +123,10 @@ value_t convert_command(call_scope_t& args)
if (xact->posts.front()->account == NULL) {
// jww (2010-03-07): Bind this logic to an option: --auto-match
if (account_t * acct =
- lookup_probable_account(xact->payee, current_xacts.rbegin(),
- current_xacts.rend(), bucket).second)
+ (report.HANDLED(auto_match) ?
+ lookup_probable_account(xact->payee, current_xacts.rbegin(),
+ current_xacts.rend(), bucket).second :
+ NULL))
xact->posts.front()->account = acct;
else
xact->posts.front()->account = unknown;
diff --git a/src/report.cc b/src/report.cc
index 38ae596a..b3b7233f 100644
--- a/src/report.cc
+++ b/src/report.cc
@@ -966,6 +966,7 @@ option_t<report_t> * report_t::lookup_option(const char * p)
else OPT(amount_data);
else OPT(anon);
else OPT_ALT(color, ansi);
+ else OPT(auto_match);
else OPT(average);
else OPT(account_width_);
else OPT(amount_width_);
diff --git a/src/report.h b/src/report.h
index 5b403205..a001ffb1 100644
--- a/src/report.h
+++ b/src/report.h
@@ -229,6 +229,7 @@ public:
HANDLER(amount_).report(out);
HANDLER(amount_data).report(out);
HANDLER(anon).report(out);
+ HANDLER(auto_match).report(out);
HANDLER(average).report(out);
HANDLER(balance_format_).report(out);
HANDLER(base).report(out);
@@ -381,6 +382,7 @@ public:
OPTION(report_t, amount_data); // -j
OPTION(report_t, anon);
+ OPTION(report_t, auto_match);
OPTION_(report_t, average, DO() { // -A
parent->HANDLER(display_total_)
diff --git a/test/baseline/opt-auto-match.test b/test/baseline/opt-auto-match.test
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/baseline/opt-auto-match.test