diff options
author | John Wiegley <johnw@newartisans.com> | 2009-10-29 00:52:51 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-10-29 00:52:51 -0400 |
commit | 55f5868380a4917028365256abcfd6d0b5f0a1e4 (patch) | |
tree | 57397e284628ad0a219d3c4948482a756ba19a3b /src/global.cc | |
parent | 2b2ffb7787df634aee1681dac7be48e986d34337 (diff) | |
download | fork-ledger-55f5868380a4917028365256abcfd6d0b5f0a1e4.tar.gz fork-ledger-55f5868380a4917028365256abcfd6d0b5f0a1e4.tar.bz2 fork-ledger-55f5868380a4917028365256abcfd6d0b5f0a1e4.zip |
Setting --date-format in ~/.ledgerrc works again
Diffstat (limited to 'src/global.cc')
-rw-r--r-- | src/global.cc | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/global.cc b/src/global.cc index 6c8cc547..8204bf69 100644 --- a/src/global.cc +++ b/src/global.cc @@ -111,7 +111,7 @@ void global_scope_t::read_init() ifstream init(init_file); - if (session().read_journal(init_file) > 0 || + if (session().read_journal(init_file, NULL, &report()) > 0 || session().journal->auto_xacts.size() > 0 || session().journal->period_xacts.size() > 0) { throw_(parse_error, _("Transactions found in initialization file '%1'") @@ -419,12 +419,16 @@ void global_scope_t::normalize_report_options(const string& verb) report_t& rep(report()); #ifdef HAVE_ISATTY - if (! rep.HANDLED(no_color) && isatty(STDOUT_FILENO)) - rep.HANDLER(color).on_only(string("?normalize")); - if (rep.HANDLED(color) && ! isatty(STDOUT_FILENO)) - rep.HANDLER(color).off(); - if (rep.HANDLED(pager_) && ! isatty(STDOUT_FILENO)) - rep.HANDLER(pager_).off(); + if (! rep.HANDLED(force_color)) { + if (! rep.HANDLED(no_color) && isatty(STDOUT_FILENO)) + rep.HANDLER(color).on_only(string("?normalize")); + if (rep.HANDLED(color) && ! isatty(STDOUT_FILENO)) + rep.HANDLER(color).off(); + } + if (! rep.HANDLED(force_pager)) { + if (rep.HANDLED(pager_) && ! isatty(STDOUT_FILENO)) + rep.HANDLER(pager_).off(); + } #endif // jww (2009-02-09): These globals are a hack, but hard to avoid. @@ -536,6 +540,10 @@ void global_scope_t::normalize_report_options(const string& verb) if (cols > 0) { DEBUG("auto.columns", "cols = " << cols); + if (! rep.HANDLER(date_width_).specified) + rep.HANDLER(date_width_) + .on_with(none, format_date(CURRENT_DATE(), FMT_PRINTED).length()); + long date_width = rep.HANDLER(date_width_).value.to_long(); long payee_width = (rep.HANDLER(payee_width_).specified ? rep.HANDLER(payee_width_).value.to_long() : |