diff --git a/src/CLI.cpp b/src/CLI.cpp index 3581cd31b..052e70615 100644 --- a/src/CLI.cpp +++ b/src/CLI.cpp @@ -213,88 +213,6 @@ const std::string A::dump () const return output; } -//////////////////////////////////////////////////////////////////////////////// -// Static method. -void CLI::getOverride (int argc, const char** argv, std::string& home, File& rc) -{ - for (int i = 0; i < argc; ++i) - { - std::string raw = argv[i]; - if (raw == "--") - return; - - if (raw.length () > 3 && - raw.substr (0, 3) == "rc:") - { - rc = raw.substr (3); - - home = "."; - auto last_slash = rc._data.rfind ("/"); - if (last_slash != std::string::npos) - home = rc.parent (); - - context.header (format (STRING_PARSER_ALTERNATE_RC, rc._data)); - - // Keep looping, because if there are multiple rc:file arguments, the last - // one should dominate. - } - } -} - -//////////////////////////////////////////////////////////////////////////////// -// Look for CONFIG data.location and initialize a Path object. -// Static method. -void CLI::getDataLocation (int argc, const char** argv, Path& data) -{ - std::string location = context.config.get ("data.location"); - if (location != "") - data = location; - - for (int i = 0; i < argc; ++i) - { - std::string raw = argv[i]; - if (raw == "--") - break; - - if (raw.length () > 17 && - raw.substr (0, 16) == "rc.data.location") - { - data = Directory (raw.substr (17)); - context.header (format (STRING_PARSER_ALTERNATE_DATA, (std::string) data)); - - // Keep looping, because if there are multiple rc:file arguments, the last - // one should dominate. - } - } -} - -//////////////////////////////////////////////////////////////////////////////// -// Static method. -void CLI::applyOverrides (int argc, const char** argv) -{ - for (int i = 0; i < argc; ++i) - { - std::string raw = argv[i]; - if (raw == "--") - break; - - if (raw.length () > 3 && - raw.substr (0, 3) == "rc.") - { - auto sep = raw.find ('=', 3); - if (sep == std::string::npos) - sep = raw.find (':', 3); - if (sep != std::string::npos) - { - std::string name = raw.substr (3, sep - 3); - std::string value = raw.substr (sep + 1); - context.config.set (name, value); - context.footnote (format (STRING_PARSER_OVERRIDE_RC, name, value)); - } - } - } -} - //////////////////////////////////////////////////////////////////////////////// CLI::CLI () : _strict (false) diff --git a/src/CLI.h b/src/CLI.h index b388c6fda..0de1228bc 100644 --- a/src/CLI.h +++ b/src/CLI.h @@ -65,9 +65,6 @@ class CLI { public: static int minimumMatchLength; - static void getOverride (int, const char**, std::string&, File&); - static void getDataLocation (int, const char**, Path&); - static void applyOverrides (int, const char**); public: CLI (); diff --git a/src/Context.cpp b/src/Context.cpp index 47a13da0d..cd8bcdee2 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -110,7 +110,6 @@ int Context::initialize (int argc, const char** argv) //////////////////////////////////////////////////////////////////////////// CLI2::getOverride (argc, argv, home_dir, rc_file); - CLI::getOverride (argc, argv, home_dir, rc_file); char* override = getenv ("TASKRC"); if (override) @@ -122,7 +121,6 @@ int Context::initialize (int argc, const char** argv) config.clear (); config.load (rc_file); CLI2::applyOverrides (argc, argv); - CLI::applyOverrides (argc, argv); //////////////////////////////////////////////////////////////////////////// // @@ -136,7 +134,6 @@ int Context::initialize (int argc, const char** argv) //////////////////////////////////////////////////////////////////////////// CLI2::getDataLocation (argc, argv, data_dir); - CLI::getDataLocation (argc, argv, data_dir); override = getenv ("TASKDATA"); if (override)