summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-02-26 02:16:09 -0600
committerJohn Wiegley <johnw@newartisans.com>2012-02-26 02:16:09 -0600
commit4a18317e7c35fea0aafdd99fec93adfea694743d (patch)
tree742ceb33017938573756f21c31c60cf9239473a9 /src
parent5a201971a9a1042a74ce2548a2de3c3e2afcf751 (diff)
downloadfork-ledger-4a18317e7c35fea0aafdd99fec93adfea694743d.tar.gz
fork-ledger-4a18317e7c35fea0aafdd99fec93adfea694743d.tar.bz2
fork-ledger-4a18317e7c35fea0aafdd99fec93adfea694743d.zip
Added --auto-match option, for use with 'convert'
Diffstat (limited to 'src')
-rw-r--r--src/convert.cc6
-rw-r--r--src/report.cc1
-rw-r--r--src/report.h2
3 files changed, 7 insertions, 2 deletions
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_)