X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=getcommandinfocommand.cpp;h=b61236dbac71421d0e63a2dbd5c89071182652e2;hb=a0f1fca79d2ddfa7ad36b4485039c68b5704fe8d;hp=7ca245369136a19da6ec607d0055a1b0351d2cc7;hpb=1d898dc6edaf9e9f287fab53bf1f21fb29757a17;p=mothur.git diff --git a/getcommandinfocommand.cpp b/getcommandinfocommand.cpp index 7ca2453..b61236d 100644 --- a/getcommandinfocommand.cpp +++ b/getcommandinfocommand.cpp @@ -12,9 +12,9 @@ //********************************************************************************************************************** vector GetCommandInfoCommand::setParameters(){ try { - CommandParameter poutput("output", "String", "", "", "", "", "",false,false); parameters.push_back(poutput); - CommandParameter pinputdir("inputdir", "String", "", "", "", "", "",false,false); parameters.push_back(pinputdir); - CommandParameter poutputdir("outputdir", "String", "", "", "", "", "",false,false); parameters.push_back(poutputdir); + CommandParameter poutput("output", "String", "", "", "", "", "","",false,false); parameters.push_back(poutput); + CommandParameter pinputdir("inputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(pinputdir); + CommandParameter poutputdir("outputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(poutputdir); vector myArray; for (int i = 0; i < parameters.size(); i++) { myArray.push_back(parameters[i].name); } @@ -45,6 +45,7 @@ GetCommandInfoCommand::GetCommandInfoCommand(string option) { //allow user to run help if(option == "help") { help(); abort = true; calledHelp = true; } + else if(option == "citation") { citation(); abort = true; calledHelp = true;} else { vector myArray = setParameters(); @@ -91,7 +92,7 @@ int GetCommandInfoCommand::execute(){ //loop through each command outputting info for (it = commands.begin(); it != commands.end(); it++) { - if (m->control_pressed) { m->mothurOut("[ERROR]: did not complete making the file."); m->mothurOutEndLine(); out.close(); remove((output+".temp").c_str()); } + if (m->control_pressed) { m->mothurOut("[ERROR]: did not complete making the file."); m->mothurOutEndLine(); out.close(); m->mothurRemove((output+".temp")); } Command* thisCommand = commandFactory->getCommand(it->first); @@ -101,6 +102,7 @@ int GetCommandInfoCommand::execute(){ //general info out << "commandName=" << thisCommand->getCommandName() << endl; + //cout << thisCommand->getCommandName() << " current citation = " << thisCommand->getCitation() << endl; out << "commandCategory=" << thisCommand->getCommandCategory() << endl; //remove /n from help string since gui reads line by line @@ -111,17 +113,31 @@ int GetCommandInfoCommand::execute(){ } out << "help=" << newHelpString << endl; + //remove /n from citation string since gui reads line by line + string mycitationString = thisCommand->getCitation(); + string newCitationString = ""; + for (int i = 0; i < mycitationString.length(); i++) { + if (mycitationString[i] != '\n') { newCitationString += mycitationString[i]; } + } + out << "citation=" << newCitationString << endl; + + out << "description=" << thisCommand->getDescription() << endl; + //outputTypes - makes something like outputTypes=fasta-name-qfile map > thisOutputTypes = thisCommand->getOutputFiles(); map >::iterator itTypes; - if (thisOutputTypes.size() == 0) { out << "outputTypes=none" << endl; } + if (thisOutputTypes.size() == 0) { out << "outputTypesNames=0" << endl; } else { - string types = ""; - for (itTypes = thisOutputTypes.begin(); itTypes != thisOutputTypes.end(); itTypes++) { types += itTypes->first + "-"; } + //string types = ""; + //for (itTypes = thisOutputTypes.begin(); itTypes != thisOutputTypes.end(); itTypes++) { types += itTypes->first + "-"; } //rip off last - - types = types.substr(0, types.length()-1); - out << "outputTypes=" << types << endl; + //types = types.substr(0, types.length()-1); + out << "outputTypesNames=" << thisOutputTypes.size() << endl; + + for (itTypes = thisOutputTypes.begin(); itTypes != thisOutputTypes.end(); itTypes++) { + out << itTypes->first << "=" << thisCommand->getOutputPattern(itTypes->first) << endl; + } } vector booleans; vector numbers; vector multiples; vector Strings; @@ -174,7 +190,7 @@ int GetCommandInfoCommand::execute(){ out2.close(); m->appendFiles(output+".temp", output); - remove((output+".temp").c_str()); + m->mothurRemove((output+".temp")); m->mothurOutEndLine(); m->mothurOut("Output File Names: "); m->mothurOutEndLine(); @@ -200,34 +216,54 @@ int GetCommandInfoCommand::getInfo(vector para, vector for (int i = 0; i < para.size(); i++) { if ((para[i].name == "inputdir") || (para[i].name == "outputdir")) {} //ignore else { + string important = "|F"; + if (para[i].important || para[i].required) { important = "|T"; } + + string outputType = "|none"; + if (para[i].outputTypes != "") { outputType = "|" + para[i].outputTypes; } + if (para[i].type == "Boolean") { - string temp = para[i].name + "=" + para[i].optionsDefault; + string temp = para[i].name + "=" + para[i].optionsDefault + important + outputType; booleans.push_back(temp); }else if (para[i].type == "Multiple") { string multAllowed = "F"; if (para[i].multipleSelectionAllowed) { multAllowed = "T"; } - string temp = para[i].name + "=" + para[i].options + "|" + para[i].optionsDefault + "|" + multAllowed; + string temp = para[i].name + "=" + para[i].options + "|" + para[i].optionsDefault + "|" + multAllowed + important + outputType; multiples.push_back(temp); }else if (para[i].type == "Number") { - string temp = para[i].name + "=" + para[i].optionsDefault; + string temp = para[i].name + "=" + para[i].optionsDefault + important + outputType; numbers.push_back(temp); }else if (para[i].type == "String") { - string temp = para[i].name + "=" + para[i].optionsDefault; + string temp = para[i].name + "=" + para[i].optionsDefault + important + outputType; strings.push_back(temp); }else if (para[i].type == "InputTypes") { string required = "F"; if (para[i].required) { required = "T"; } - string temp = required + "|" + para[i].chooseOnlyOneGroup + "|" + para[i].chooseAtLeastOneGroup + "|" + para[i].linkedGroup; + string temp = required + important + "|" + para[i].chooseOnlyOneGroup + "|" + para[i].chooseAtLeastOneGroup + "|" + para[i].linkedGroup + outputType; inputTypes[para[i].name] = temp; //add choose only one groups - groups[para[i].chooseOnlyOneGroup].insert(para[i].name); - + vector tempGroups; + m->splitAtDash(para[i].chooseOnlyOneGroup, tempGroups); + for (int l = 0; l < tempGroups.size(); l++) { + groups[tempGroups[l]].insert(para[i].name); + } + tempGroups.clear(); + //add at least one group names - groups[para[i].chooseAtLeastOneGroup].insert(para[i].name); + m->splitAtDash(para[i].chooseAtLeastOneGroup, tempGroups); + for (int l = 0; l < tempGroups.size(); l++) { + groups[tempGroups[l]].insert(para[i].name); + } + tempGroups.clear(); + //add at linked group names - groups[para[i].linkedGroup].insert(para[i].name); + m->splitAtDash(para[i].linkedGroup, tempGroups); + for (int l = 0; l < tempGroups.size(); l++) { + groups[tempGroups[l]].insert(para[i].name); + } + tempGroups.clear(); }else { m->mothurOut("[ERROR]: " + para[i].type + " is an unknown parameter type, please correct."); m->mothurOutEndLine(); } }