summaryrefslogtreecommitdiff
path: root/src/global.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-06-18 18:50:49 +0100
committerJohn Wiegley <johnw@newartisans.com>2009-06-18 18:50:49 +0100
commit86dfc1e0be5dbfab195cba8a8be31d3dbf0f68c9 (patch)
tree55965512c0a1abf8f4bbb1519817c7b96fdcab12 /src/global.cc
parent1dc21c2d344aa52833e516fea831ff45d8bf7aa1 (diff)
downloadfork-ledger-86dfc1e0be5dbfab195cba8a8be31d3dbf0f68c9.tar.gz
fork-ledger-86dfc1e0be5dbfab195cba8a8be31d3dbf0f68c9.tar.bz2
fork-ledger-86dfc1e0be5dbfab195cba8a8be31d3dbf0f68c9.zip
The -X option now accepts price settings
For example, if you had 100 AU (onces of gold) and wanted to report it in dollars, but at a price of $997 per ounce, you could now easily say: ledger bal -X '$,AU=$997'
Diffstat (limited to 'src/global.cc')
-rw-r--r--src/global.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/global.cc b/src/global.cc
index b0b08930..461c6985 100644
--- a/src/global.cc
+++ b/src/global.cc
@@ -487,6 +487,14 @@ void global_scope_t::normalize_report_options(const string& verb)
.on_with(string("?normalize"), rep.HANDLER(plot_total_format_).value);
}
+ // If the --exchange (-X) option was used, parse out any final price
+ // settings that may be there.
+ if (rep.HANDLED(exchange_) &&
+ rep.HANDLER(exchange_).str().find('=') != string::npos) {
+ value_t(0L).exchange_commodities(rep.HANDLER(exchange_).str(),
+ true, datetime_t(rep.terminus));
+ }
+
long cols = 0;
if (rep.HANDLED(columns_))
cols = rep.HANDLER(columns_).value.to_long();