X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=getlinecommand.cpp;h=5f459bf7e6a8013ee61893502c01e5c6a306c4b1;hp=df14f5123d2bd2e8c6d02380520810211e19c461;hb=0470f6d037aacb3563c3f7010708120a4a67d4e6;hpb=bede5752eaeedb5a7e339439b6ba2f6670bca2b9 diff --git a/getlinecommand.cpp b/getlinecommand.cpp index df14f51..5f459bf 100644 --- a/getlinecommand.cpp +++ b/getlinecommand.cpp @@ -9,10 +9,21 @@ #include "getlinecommand.h" - -GetlineCommand::GetlineCommand(){ +//********************************************************************************************************************** +GetlineCommand::GetlineCommand(string option){ try { globaldata = GlobalData::getInstance(); + abort = false; + + //allow user to run help + if(option == "help") { help(); abort = true; } + + else { + if (option != "") { cout << "There are no valid parameters for the get.line command." << endl; abort = true; } + + if ((globaldata->getListFile() == "") && (globaldata->getRabundFile() == "") && (globaldata->getSabundFile() == "")) { cout << "You must read a list, sabund or rabund before you can use the get.line command." << endl; abort = true; } + } + } catch(exception& e) { cout << "Standard Error: " << e.what() << " has occurred in the GetlineCommand class Function GetlineCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; @@ -24,6 +35,25 @@ GetlineCommand::GetlineCommand(){ } } +//********************************************************************************************************************** + +void GetlineCommand::help(){ + try { + cout << "The get.line command can only be executed after a successful read.otu command." << "\n"; + cout << "You may not use any parameters with the get.line command." << "\n"; + cout << "The get.line command should be in the following format: " << "\n"; + cout << "get.line()" << "\n"; + cout << "Example get.line()." << "\n"; + } + catch(exception& e) { + cout << "Standard Error: " << e.what() << " has occurred in the GetlineCommand class Function help. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } + catch(...) { + cout << "An unknown error has occurred in the GetlineCommand class function help. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } +} //********************************************************************************************************************** @@ -34,6 +64,9 @@ GetlineCommand::~GetlineCommand(){ int GetlineCommand::execute(){ try { + + if (abort == true) { return 0; } + filename = globaldata->inputFileName; ifstream in; openInputFile(filename, in);