diff --git a/src/CLI.cpp b/src/CLI.cpp index 235503a56..55851c06a 100644 --- a/src/CLI.cpp +++ b/src/CLI.cpp @@ -230,30 +230,10 @@ void CLI::initialize (int argc, const char** argv) { // Clean what needs to be cleaned. Everything in this case. _original_args.clear (); - _args.clear (); - for (int i = 0; i < argc; ++i) - { _original_args.push_back (argv[i]); - if (i == 0) - { - A a ("arg", argv[i]); - a.tag ("ORIGINAL"); - a.tag ("BINARY"); - _args.push_back (a); - } - else - { - A a ("arg", argv[i]); - a.tag ("ORIGINAL"); - _args.push_back (a); - } - } - - aliasExpansion (); - findOverrides (); - categorize (); + analyze (); } //////////////////////////////////////////////////////////////////////////////// @@ -261,9 +241,20 @@ void CLI::initialize (int argc, const char** argv) void CLI::add (const std::string& arg) { // Clean what needs to be cleaned. Most in this case. - _args.clear (); _original_args.push_back (arg); + analyze (); +} + +//////////////////////////////////////////////////////////////////////////////// +// Intended to be called after ::initialize() and ::add(), to perform the final +// analysis. Analysis is also performed directly after the above, because there +// is a need to extract overrides early, before entities are proviedd. +void CLI::analyze () +{ + // Clean what needs to be cleaned. Most in this case. + _args.clear (); + for (int i = 0; i < _original_args.size (); ++i) { if (i == 0) diff --git a/src/CLI.h b/src/CLI.h index fafe74d29..99546668e 100644 --- a/src/CLI.h +++ b/src/CLI.h @@ -66,6 +66,7 @@ public: void entity (const std::string&, const std::string&); void initialize (int, const char**); void add (const std::string&); + void analyze (); const std::string getFilter (); const std::vector getWords (); const std::vector getModifications (); diff --git a/src/Context.cpp b/src/Context.cpp index ad21ccf82..1cc1ebc88 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -248,6 +248,7 @@ int Context::initialize (int argc, const char** argv) staticInitialization (); // Decouple code from Context. parser.parse (); // Parse all elements. + cli.analyze (); // Parse all elements. tdb2.set_location (data_dir); // Prepare the task database.