summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-11-02 02:39:31 -0500
committerJohn Wiegley <johnw@newartisans.com>2009-11-02 02:39:31 -0500
commit094794c640dafaab37a0b227908d8602d29f7daa (patch)
tree8e439162a8bc0cc60eea27ba1ca647d5683ba8db /src
parent0a9cc833adebadc876e3e09f1c344b08b23e59f8 (diff)
downloadfork-ledger-094794c640dafaab37a0b227908d8602d29f7daa.tar.gz
fork-ledger-094794c640dafaab37a0b227908d8602d29f7daa.tar.bz2
fork-ledger-094794c640dafaab37a0b227908d8602d29f7daa.zip
Added a --european flag, to use commas for decimals
Ledger can often figure this out for itself, but this flag just makes it the default behavior. It is meant to be added to one's ~/.ledgerrc file.
Diffstat (limited to 'src')
-rw-r--r--src/commodity.cc2
-rw-r--r--src/commodity.h6
-rw-r--r--src/session.cc3
-rw-r--r--src/session.h2
4 files changed, 12 insertions, 1 deletions
diff --git a/src/commodity.cc b/src/commodity.cc
index de529ac4..689cf466 100644
--- a/src/commodity.cc
+++ b/src/commodity.cc
@@ -38,6 +38,8 @@
namespace ledger {
+bool commodity_t::base_t::european_by_default = false;
+
void commodity_t::base_t::history_t::add_price(commodity_t& source,
const datetime_t& date,
const amount_t& price,
diff --git a/src/commodity.h b/src/commodity.h
index 1df1ab18..af92271e 100644
--- a/src/commodity.h
+++ b/src/commodity.h
@@ -188,9 +188,13 @@ public:
mutable bool searched;
+ static bool european_by_default;
+
public:
explicit base_t(const string& _symbol)
- : supports_flags<uint_least16_t>(COMMODITY_STYLE_DEFAULTS),
+ : supports_flags<uint_least16_t>(european_by_default ?
+ COMMODITY_STYLE_EUROPEAN :
+ COMMODITY_STYLE_DEFAULTS),
symbol(_symbol), precision(0), searched(false) {
TRACE_CTOR(base_t, "const string&");
}
diff --git a/src/session.cc b/src/session.cc
index 3f29716d..33c27165 100644
--- a/src/session.cc
+++ b/src/session.cc
@@ -264,6 +264,9 @@ option_t<session_t> * session_t::lookup_option(const char * p)
case 'd':
OPT(download); // -Q
break;
+ case 'e':
+ OPT(european);
+ break;
case 'f':
OPT_(file_); // -f
break;
diff --git a/src/session.h b/src/session.h
index c1e0243b..4b8d2380 100644
--- a/src/session.h
+++ b/src/session.h
@@ -105,6 +105,7 @@ public:
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(price_db_).report(out);
@@ -123,6 +124,7 @@ public:
OPTION(session_t, account_); // -a
OPTION(session_t, cache_);
OPTION(session_t, download); // -Q
+ OPTION(session_t, european);
OPTION__
(session_t, price_exp_, // -Z