From 88fcdab515872f83937a081d0f6ffa9e1ee53ecb Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 8 Jul 2012 15:16:23 -0400 Subject: [PATCH] Feature #1026 - Feature #1026, command line overrides are now applied before and after the creation of the default rc file and data directory, which allows for programmatic initialization without keystroke synthesis (thanks to Nicholas Rabenau). --- ChangeLog | 4 ++++ src/Context.cpp | 16 +++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 242a97dac..01aa3aec1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -32,6 +32,10 @@ Features with 'dateformat.info'. + Bash script improvement (column names are now completed). + Feature #1013, output error, header, footnote and debug messages on standard error. + + Feature #1026, command line overrides are now applied before and after the + creation of the default rc file and data directory, which allows for + programmatic initialization without keystroke synthesis (thanks to Nicholas + Rabenau). + Color error messages with a specific configuration variable 'color.error'. Bugs diff --git a/src/Context.cpp b/src/Context.cpp index c30e3191a..eed43cc6d 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -131,6 +131,7 @@ int Context::initialize (int argc, const char** argv) */ // Create missing config file and data directory, if necessary. + a3.apply_overrides (); createDefaultConfig (); // Handle Aliases. @@ -596,7 +597,8 @@ void Context::createDefaultConfig () // Do we need to create a default rc? if (! rc_file.exists ()) { - if (!confirm (format (STRING_CONTEXT_CREATE_RC, home_dir, rc_file._data))) + if (config.getBoolean ("confirmation") && + !confirm (format (STRING_CONTEXT_CREATE_RC, home_dir, rc_file._data))) throw std::string (STRING_CONTEXT_NEED_RC); config.createDefaultRC (rc_file, data_dir); @@ -710,28 +712,32 @@ void Context::updateVerbosity () //////////////////////////////////////////////////////////////////////////////// void Context::header (const std::string& input) { - if (input.length ()) + if (input.length () && + std::find (headers.begin (), headers.end (), input) == headers.end ()) headers.push_back (input); } //////////////////////////////////////////////////////////////////////////////// void Context::footnote (const std::string& input) { - if (input.length ()) + if (input.length () && + std::find (footnotes.begin (), footnotes.end (), input) == footnotes.end ()) footnotes.push_back (input); } //////////////////////////////////////////////////////////////////////////////// void Context::error (const std::string& input) { - if (input.length ()) + if (input.length () && + std::find (errors.begin (), errors.end (), input) == errors.end ()) errors.push_back (input); } //////////////////////////////////////////////////////////////////////////////// void Context::debug (const std::string& input) { - if (input.length ()) + if (input.length () && + std::find (debugMessages.begin (), debugMessages.end (), input) == debugMessages.end ()) debugMessages.push_back (input); }