X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=systemcommand.cpp;h=abc07d0743a0a3e8f7172c27fe4094571abb3d5c;hb=4169642e8a8d45f71a4a7241ee02f1b1aae29520;hp=0820b0521961224c04f3b7c6207f4fd3d490c5fd;hpb=5ff964d3871ce86f59fec3052f9c25e872f22c42;p=mothur.git diff --git a/systemcommand.cpp b/systemcommand.cpp index 0820b05..abc07d0 100644 --- a/systemcommand.cpp +++ b/systemcommand.cpp @@ -9,23 +9,66 @@ #include "systemcommand.h" +//********************************************************************************************************************** +vector SystemCommand::getValidParameters(){ + try { + vector myArray; + return myArray; + } + catch(exception& e) { + m->errorOut(e, "SystemCommand", "getValidParameters"); + exit(1); + } +} +//********************************************************************************************************************** +vector SystemCommand::getRequiredParameters(){ + try { + vector myArray; + return myArray; + } + catch(exception& e) { + m->errorOut(e, "SystemCommand", "getRequiredParameters"); + exit(1); + } +} +//********************************************************************************************************************** +vector SystemCommand::getRequiredFiles(){ + try { + vector myArray; + return myArray; + } + catch(exception& e) { + m->errorOut(e, "SystemCommand", "getRequiredFiles"); + exit(1); + } +} //********************************************************************************************************************** -SystemCommand::SystemCommand(string option){ +SystemCommand::SystemCommand(string option) { try { - abort = false; + abort = false; calledHelp = false; //allow user to run help - if(option == "help") { help(); abort = true; } + if(option == "help") { help(); abort = true; calledHelp = true; } else { - if (option = "") { mothurOut("You must enter a command to run."); mothurOutEndLine(); abort = true; } - else { command = option; } + if (option == "") { m->mothurOut("You must enter a command to run."); m->mothurOutEndLine(); abort = true; } + else { + //check for outputdir and inputdir parameters + int commaPos = option.find_first_of(','); + + //if there is a comma then grab string up to that pos + if (commaPos != option.npos) { + option = option.substr(0, commaPos); + } + + command = option; + } } } catch(exception& e) { - errorOut(e, "SystemCommand", "SystemCommand"); + m->errorOut(e, "SystemCommand", "SystemCommand"); exit(1); } } @@ -33,13 +76,13 @@ SystemCommand::SystemCommand(string option){ void SystemCommand::help(){ try { - mothurOut("The system command allows you to execute a system command from within mothur.\n"); - mothurOut("The system has no parameters.\n"); - mothurOut("The system command should be in the following format: system(yourCommand).\n"); - mothurOut("Example system(clear).\n"); + m->mothurOut("The system command allows you to execute a system command from within mothur.\n"); + m->mothurOut("The system has no parameters.\n"); + m->mothurOut("The system command should be in the following format: system(yourCommand).\n"); + m->mothurOut("Example system(clear).\n"); } catch(exception& e) { - errorOut(e, "SystemCommand", "help"); + m->errorOut(e, "SystemCommand", "help"); exit(1); } } @@ -49,7 +92,7 @@ void SystemCommand::help(){ int SystemCommand::execute(){ try { - if (abort == true) { return 0; } + if (abort == true) { if (calledHelp) { return 0; } return 2; } system(command.c_str()); @@ -57,7 +100,7 @@ int SystemCommand::execute(){ } catch(exception& e) { - errorOut(e, "SystemCommand", "execute"); + m->errorOut(e, "SystemCommand", "execute"); exit(1); } }