import-trace: help sports all available importers

This change extends import-trace's help functionality for importers,
adds the ?-operator to option "-i" and refactors main.cc a little.
The extensions are "doing something useful with the AliasedRegistry"
and are merely listings of all importers' prime aliases.

Change-Id: I7bb184fc45dd9f90664e37455edfccc704d99ef1
This commit is contained in:
Michael Lenz
2014-02-26 10:54:02 +01:00
parent af92a751d9
commit 73843fa634

View File

@ -101,9 +101,10 @@ int main(int argc, char *argv[]) {
CommandLine::option_handle BENCHMARK =
cmd.addOption("b", "benchmark", Arg::Required,
"-b/--benchmark \tBenchmark label (default: \"none\")\n");
CommandLine::option_handle IMPORTER =
cmd.addOption("i", "importer", Arg::Required,
"-i/--importer \tWhich import method to use (default: MemoryImporter)");
std::string importer_help = "-i/--importer \tWhich import method to use (default: MemoryImporter); available import methods: " + importers;
CommandLine::option_handle IMPORTER = cmd.addOption("i", "importer", Arg::Required, importer_help);
CommandLine::option_handle ELF_FILE =
cmd.addOption("e", "elf-file", Arg::Required,
"-e/--elf-file \tELF File (default: UNSET)");
@ -154,7 +155,10 @@ int main(int argc, char *argv[]) {
// try and get the according importer object ; die on failure
if ((importer = (Importer *)registry.get(imp)) == 0) {
LOG << "Unknown import method: " << imp << endl;
if (imp != "?" ) {
std::cerr << "Unknown import method: " << imp << std::endl;
}
std::cerr << "Available import methods: " << importers << std::endl;
exit(-1);
}