//**********************************************************************************************************************
vector<string> MergeFileCommand::setParameters(){
try {
- 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);
+ CommandParameter pinput("input", "String", "", "", "", "", "","",false,true,true); parameters.push_back(pinput);
+ CommandParameter poutput("output", "String", "", "", "", "", "","",false,true,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<string> myArray;
for (int i = 0; i < parameters.size(); i++) { myArray.push_back(parameters[i].name); }
exit(1);
}
}
-
//**********************************************************************************************************************
MergeFileCommand::MergeFileCommand(){
try {
if(option == "help") {
help();
abort = true; calledHelp = true;
- }
+ }else if(option == "citation") { citation(); abort = true; calledHelp = true;}
else {
vector<string> myArray = setParameters();
try {
if (abort == true) { if (calledHelp) { return 0; } return 2; }
- ofstream outputFile;
- m->openOutputFile(outputFileName, outputFile);
-
- char c;
- for(int i=0;i<numInputFiles;i++){
- ifstream inputFile; //declaration must be inside for loop of windows throws an error
-
- m->openInputFile(fileNames[i], inputFile);
-
- while(!inputFile.eof()){
- if (m->control_pressed) { outputTypes.clear(); inputFile.close(); outputFile.close(); remove(outputFileName.c_str()); return 0; }
-
- c = inputFile.get();
- //-1 is eof char
- if (int(c) != -1) { outputFile << c; }
- }
-
- inputFile.close();
- }
-
- outputFile.close();
+ m->mothurRemove(outputFileName);
+ for(int i=0;i<numInputFiles;i++){ m->appendFiles(fileNames[i], outputFileName); }
- if (m->control_pressed) { outputTypes.clear(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { m->mothurRemove(outputFileName); return 0; }
m->mothurOutEndLine();
- m->mothurOut("Output File Name: "); m->mothurOutEndLine();
+ m->mothurOut("Output File Names: "); m->mothurOutEndLine();
m->mothurOut(outputFileName); m->mothurOutEndLine(); outputNames.push_back(outputFileName); outputTypes["merge"].push_back(outputFileName);
m->mothurOutEndLine();