X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=mergefilecommand.cpp;fp=mergefilecommand.cpp;h=cb241c6b301396e7c7d0482d98be861a926b8a64;hb=ca9ac1d80c62f57270b0dcd49410ebe08a8aecd6;hp=2b34a00b8c3961d581032dcf6b6929404428a3b4;hpb=36a867cbd85d9c276d3c8d13f25a150bbbe2466b;p=mothur.git diff --git a/mergefilecommand.cpp b/mergefilecommand.cpp index 2b34a00..cb241c6 100644 --- a/mergefilecommand.cpp +++ b/mergefilecommand.cpp @@ -10,49 +10,48 @@ #include "mergefilecommand.h" //********************************************************************************************************************** -vector MergeFileCommand::getValidParameters(){ +vector MergeFileCommand::setParameters(){ try { - string Array[] = {"input", "output","outputdir","inputdir"}; - vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); + CommandParameter pinput("input", "String", "", "", "", "", "",false,true); parameters.push_back(pinput); + CommandParameter poutput("output", "String", "", "", "", "", "",false,true); 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); } return myArray; } catch(exception& e) { - m->errorOut(e, "MergeFileCommand", "getValidParameters"); + m->errorOut(e, "MergeFileCommand", "setParameters"); exit(1); } } //********************************************************************************************************************** -MergeFileCommand::MergeFileCommand(){ +string MergeFileCommand::getHelpString(){ try { - abort = true; calledHelp = true; - vector tempOutNames; - outputTypes["merge"] = tempOutNames; + string helpString = ""; + helpString += "The merge.file command takes a list of files separated by dashes and merges them into one file."; + helpString += "The merge.file command parameters are input and output."; + helpString += "Example merge.file(input=small.fasta-large.fasta, output=all.fasta)."; + helpString += "Note: No spaces between parameter labels (i.e. output), '=' and parameters (i.e.yourOutputFileName).\n\n"; + return helpString; } catch(exception& e) { - m->errorOut(e, "MergeFileCommand", "MergeFileCommand"); - exit(1); - } -} -//********************************************************************************************************************** -vector MergeFileCommand::getRequiredParameters(){ - try { - string Array[] = {"input","output"}; - vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); - return myArray; - } - catch(exception& e) { - m->errorOut(e, "MergeFileCommand", "getRequiredParameters"); + m->errorOut(e, "MergeFileCommand", "getHelpString"); exit(1); } } + //********************************************************************************************************************** -vector MergeFileCommand::getRequiredFiles(){ +MergeFileCommand::MergeFileCommand(){ try { - vector myArray; - return myArray; + abort = true; calledHelp = true; + setParameters(); + vector tempOutNames; + outputTypes["merge"] = tempOutNames; } catch(exception& e) { - m->errorOut(e, "MergeFileCommand", "getRequiredFiles"); + m->errorOut(e, "MergeFileCommand", "MergeFileCommand"); exit(1); } } @@ -67,9 +66,7 @@ MergeFileCommand::MergeFileCommand(string option) { abort = true; calledHelp = true; } else { - //valid paramters for this command - string Array[] = {"input", "output","outputdir","inputdir"}; - vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); + vector myArray = setParameters(); OptionParser parser(option); map parameters = parser.getParameters(); @@ -127,11 +124,6 @@ MergeFileCommand::MergeFileCommand(string option) { exit(1); } } - -//********************************************************************************************************************** - -MergeFileCommand::~MergeFileCommand() { /* do nothing */ } - //********************************************************************************************************************** int MergeFileCommand::execute(){ @@ -174,17 +166,4 @@ int MergeFileCommand::execute(){ exit(1); } } - -//********************************************************************************************************************** - -void MergeFileCommand::help(){ - try { - m->mothurOut("The merge.file command..."); m->mothurOutEndLine(); - } - catch(exception& e) { - m->errorOut(e, "MergeFileCommand", "help"); - exit(1); - } -} - //**********************************************************************************************************************