tools(kdb-import): use provider database to lookup suiting plugins
partly implements
#include <kdb.hpp>
#include <keysetio.hpp>
#include <modules.hpp>
+#include <plugindatabase.hpp>
#include <toolexcept.hpp>
#include <iostream>
@@ -53,8 +54,15 @@ int ImportCommand::execute (Cmdline const & cl)
string file = "/dev/stdin";
if (argc > 2 && cl.arguments[2] != "-") file = cl.arguments[2];
+ if (cl.verbose) std::cout << "lookup provider for: " << format << endl;
+
+ ModulesPluginDatabase pluginDatabase;
+ PluginSpec provides = pluginDatabase.lookupProvides (format);
+
+ if (cl.verbose) std::cout << "found provider: " << provides.getName () << endl;
+
Modules modules;
- PluginPtr plugin = modules.load (format, cl.getPluginsConfig ());
+ PluginPtr plugin = modules.load (provides.getName (), cl.getPluginsConfig ());
Key errorKey (root);
errorKey.setString (file);
