8 #include <boost/program_options.hpp> 16 using namespace boost::program_options;
18 static const char*
const kFilesOpt =
"files";
19 static const char*
const kFilesCommandOpt =
"files,f";
20 static const char*
const kAllFilesOpt =
"all_files";
21 static const char*
const kAllFilesCommandOpt =
"all_files,a";
22 static const char*
const kHelpOpt =
"help";
26 descString +=
" [options]";
27 descString +=
"\nAllowed options";
28 options_description desc(descString);
29 desc.add_options()(
kHelpCommandOpt,
"produce help message")(kFilesCommandOpt,
30 "list the file from which a plugin will come")(
31 kAllFilesCommandOpt,
"list all the files to which a plugin is registered")
37 store(command_line_parser(argc, argv).
options(desc).
run(), vm);
39 }
catch (
const error& iException) {
44 if (vm.count(kHelpOpt)) {
49 bool printFiles =
false;
50 if (vm.count(kFilesOpt)) {
54 bool printAllFiles =
false;
55 if (vm.count(kAllFilesOpt)) {
60 int returnValue = EXIT_SUCCESS;
69 for (CatToInfos::const_iterator it = catToInfos.begin(), itEnd = catToInfos.end(); it != itEnd; ++it) {
70 std::cout <<
"Category " << it->first <<
":" << std::endl;
72 for (edmplugin::PluginManager::Infos::const_iterator itInfo = it->second.begin(), itInfoEnd = it->second.end();
76 if (pluginName != prevPluginName) {
77 std::cout <<
" " << pluginName << std::endl;
79 std::cout <<
" " << itInfo->loadable_.string() << std::endl;
81 prevPluginName = pluginName;
82 }
else if (printAllFiles) {
83 std::cout <<
" " << itInfo->loadable_.string() << std::endl;
88 std::cerr <<
"Caught exception " << iException.what() << std::endl;
89 returnValue = EXIT_FAILURE;
const CategoryToInfos & categoryToInfos() const
static PluginManager & configure(const Config &)
std::map< std::string, Infos > CategoryToInfos
PluginManager::Config config()
static const char *const kHelpCommandOpt
int main(int argc, char **argv)
static const char *const kHelpOpt
static PluginManager * get()