X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=commandfactory.cpp;h=c8421d29c513f65bfe8684fe10a09e8c439d7915;hb=8159f34321e2c771638059b59a986caca9f3ab60;hp=a691509ab0ae00e5f19ae52a8bffe6801fc26a31;hpb=601d30778afd12a8dcdd0e2825d54754a3980cf4;p=mothur.git diff --git a/commandfactory.cpp b/commandfactory.cpp index a691509..c8421d2 100644 --- a/commandfactory.cpp +++ b/commandfactory.cpp @@ -892,6 +892,41 @@ void CommandFactory::printCommands(ostream& out) { } } /***********************************************************************/ +void CommandFactory::printCommandsCategories(ostream& out) { + try { + map commands = getListCommands(); + map::iterator it; + + map categories; + map::iterator itCat; + //loop through each command outputting info + for (it = commands.begin(); it != commands.end(); it++) { + + Command* thisCommand = getCommand(it->first); + + //don't add hidden commands + if (thisCommand->getCommandCategory() != "Hidden") { + itCat = categories.find(thisCommand->getCommandCategory()); + if (itCat == categories.end()) { + categories[thisCommand->getCommandCategory()] = thisCommand->getCommandName(); + }else { + categories[thisCommand->getCommandCategory()] += ", " + thisCommand->getCommandName(); + } + } + } + + for (itCat = categories.begin(); itCat != categories.end(); itCat++) { + out << itCat->first << " commmands include: " << itCat->second << endl; + } + + } + catch(exception& e) { + m->errorOut(e, "CommandFactory", "printCommandsCategories"); + exit(1); + } +} + +/***********************************************************************/