diff options
-rw-r--r-- | NEWS | 31 | ||||
-rw-r--r-- | amount.cc | 3 | ||||
-rw-r--r-- | amount.h | 1 | ||||
-rw-r--r-- | config.cc | 5 | ||||
-rw-r--r-- | config.h | 2 |
5 files changed, 32 insertions, 10 deletions
@@ -6,14 +6,29 @@ - Error reporting has been greatly improving, now showing full contextual information for most error messages. -- Added new --ansi reporting option, which shows negative values as - red using ANSI terminal codes; --ansi-invert makes non-negative - values red (which makes more sense for income and budget reports, - for example). - -- Added a new --only predicate, which occurs during transaction - processing between --limit and --display. Here is a summary of how - the three supported predicates are used: +- Added --base reporting option, for reporting convertible commodities + in their most basic form. For example, if you read a timeclock file + with Ledger, the time values are reported as hour and minutes -- + whichever is the most compact form. But with --base, Ledger reports + only in seconds. + + NOTE: Setting up convertible commodities is easy; here's how to use + Ledger for tracking quantities of data, where the most compact form + is reported (unless --base is specified): + + C 1.00 Kb = 1024 b + C 1.00 Mb = 1024 Kb + C 1.00 Gb = 1024 Mb + C 1.00 Tb = 1024 Gb + +- Added --ansi reporting option, which shows negative values as red + using ANSI terminal codes; --ansi-invert makes non-negative values + red (which makes more sense for income and budget reports, for + example). + +- Added --only predicate, which occurs during transaction processing + between --limit and --display. Here is a summary of how the three + supported predicates are used: --limit "a>100" @@ -15,6 +15,7 @@ bool do_cleanup = true; bool amount_t::keep_price = false; bool amount_t::keep_date = false; bool amount_t::keep_tag = false; +bool amount_t::keep_base = false; #define BIGINT_BULK_ALLOC 0x0001 #define BIGINT_KEEP_PREC 0x0002 @@ -723,7 +724,7 @@ std::ostream& operator<<(std::ostream& _out, const amount_t& amt) } amount_t base(amt); - if (amt.commodity().larger()) { + if (! amount_t::keep_base && amt.commodity().larger()) { amount_t last(amt); while (last.commodity().larger()) { last /= *last.commodity().larger(); @@ -28,6 +28,7 @@ class amount_t static bool keep_price; static bool keep_date; static bool keep_tag; + static bool keep_base; protected: void _init(); @@ -1129,6 +1129,10 @@ OPT_BEGIN(ansi_invert, "") { // // Commodity reporting +OPT_BEGIN(base, ":") { + amount_t::keep_base = true; +} OPT_END(base); + OPT_BEGIN(price_db, ":") { config->price_db = optarg; } OPT_END(price_db); @@ -1206,6 +1210,7 @@ option_t config_options[CONFIG_OPTIONS_SIZE] = { { "ansi-invert", '\0', false, opt_ansi_invert, false }, { "average", 'A', false, opt_average, false }, { "balance-format", '\0', true, opt_balance_format, false }, + { "base", '\0', false, opt_base, false }, { "basis", 'B', false, opt_basis, false }, { "begin", 'b', true, opt_begin, false }, { "budget", '\0', false, opt_budget, false }, @@ -107,7 +107,7 @@ class config_t std::list<item_handler<transaction_t> *>& ptrs); }; -#define CONFIG_OPTIONS_SIZE 88 +#define CONFIG_OPTIONS_SIZE 89 extern option_t config_options[CONFIG_OPTIONS_SIZE]; void option_help(std::ostream& out); |