X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=commandfactory.cpp;h=c8421d29c513f65bfe8684fe10a09e8c439d7915;hb=20071b183e619c122bf9f63b4bb42722507c4e4a;hp=6d87a68c49c6d9154572adcbc51ebc3b4555a35f;hpb=035f86272c776e1cccaa47021e26782e49cd41e7;p=mothur.git diff --git a/commandfactory.cpp b/commandfactory.cpp index 6d87a68..c8421d2 100644 --- a/commandfactory.cpp +++ b/commandfactory.cpp @@ -136,6 +136,7 @@ #include "loadlogfilecommand.h" #include "sffmultiplecommand.h" #include "classifysharedcommand.h" +#include "filtersharedcommand.h" /*******************************************************/ @@ -295,6 +296,7 @@ CommandFactory::CommandFactory(){ commands["sff.multiple"] = "sff.multiple"; commands["quit"] = "MPIEnabled"; commands["classify.shared"] = "classify.shared"; + commands["filter.shared"] = "filter.shared"; } @@ -510,6 +512,7 @@ Command* CommandFactory::getCommand(string commandName, string optionString){ else if(commandName == "load.logfile") { command = new LoadLogfileCommand(optionString); } else if(commandName == "sff.multiple") { command = new SffMultipleCommand(optionString); } else if(commandName == "classify.shared") { command = new ClassifySharedCommand(optionString); } + else if(commandName == "filter.shared") { command = new FilterSharedCommand(optionString); } else { command = new NoCommand(optionString); } return command; @@ -666,6 +669,7 @@ Command* CommandFactory::getCommand(string commandName, string optionString, str else if(commandName == "load.logfile") { pipecommand = new LoadLogfileCommand(optionString); } else if(commandName == "sff.multiple") { pipecommand = new SffMultipleCommand(optionString); } else if(commandName == "classify.shared") { pipecommand = new ClassifySharedCommand(optionString); } + else if(commandName == "filter.shared") { pipecommand = new FilterSharedCommand(optionString); } else { pipecommand = new NoCommand(optionString); } return pipecommand; @@ -808,6 +812,7 @@ Command* CommandFactory::getCommand(string commandName){ else if(commandName == "load.logfile") { shellcommand = new LoadLogfileCommand(); } else if(commandName == "sff.multiple") { shellcommand = new SffMultipleCommand(); } else if(commandName == "classify.shared") { shellcommand = new ClassifySharedCommand(); } + else if(commandName == "filter.shared") { shellcommand = new FilterSharedCommand(); } else { shellcommand = new NoCommand(); } return shellcommand; @@ -887,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); + } +} + +/***********************************************************************/