diff options
author | John Wiegley <johnw@newartisans.com> | 2009-10-29 00:55:01 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-10-29 00:55:01 -0400 |
commit | 0b6460d0629a23b798d91215bffe059229ebe5ce (patch) | |
tree | 57397e284628ad0a219d3c4948482a756ba19a3b /src/global.cc | |
parent | 2b3f3e9867431174f5b5b25e47098a7218213a82 (diff) | |
parent | 55f5868380a4917028365256abcfd6d0b5f0a1e4 (diff) | |
download | fork-ledger-0b6460d0629a23b798d91215bffe059229ebe5ce.tar.gz fork-ledger-0b6460d0629a23b798d91215bffe059229ebe5ce.tar.bz2 fork-ledger-0b6460d0629a23b798d91215bffe059229ebe5ce.zip |
Merge branch 'next'
Diffstat (limited to 'src/global.cc')
-rw-r--r-- | src/global.cc | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/global.cc b/src/global.cc index 19cab1c8..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'") @@ -418,8 +418,18 @@ void global_scope_t::normalize_report_options(const string& verb) report_t& rep(report()); - if (! rep.HANDLED(no_color)) - rep.HANDLER(color).on_only(string("?normalize")); +#ifdef HAVE_ISATTY + 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. item_t::use_effective_date = (rep.HANDLED(effective) && @@ -530,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() : |