X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=getlabelcommand.cpp;h=1c08eb1fab8905674700bdc440a93ebd38b88a4f;hb=30f2d98fffb579b870c8969ddcc1dfc61ccbb70a;hp=40c656bb0286122f013ec9dfe65a6da2ea42244a;hpb=02909d6cae9963ba00dc746969a370fa8ca934fc;p=mothur.git diff --git a/getlabelcommand.cpp b/getlabelcommand.cpp index 40c656b..1c08eb1 100644 --- a/getlabelcommand.cpp +++ b/getlabelcommand.cpp @@ -11,7 +11,7 @@ //********************************************************************************************************************** -GetlabelCommand::GetlabelCommand(string option){ +GetlabelCommand::GetlabelCommand(string option) { try { globaldata = GlobalData::getInstance(); abort = false; @@ -20,40 +20,29 @@ GetlabelCommand::GetlabelCommand(string option){ if(option == "help") { help(); abort = true; } else { - if (option != "") { cout << "There are no valid parameters for the get.label 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.label command." << endl; abort = true; } + if ((globaldata->getListFile() == "") && (globaldata->getRabundFile() == "") && (globaldata->getSabundFile() == "")) { m->mothurOut("You must read a list, sabund or rabund before you can use the get.label command."); m->mothurOutEndLine(); abort = true; } } } catch(exception& e) { - cout << "Standard Error: " << e.what() << " has occurred in the GetlabelCommand class Function GetlabelCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + m->errorOut(e, "GetlabelCommand", "GetlabelCommand"); exit(1); } - catch(...) { - cout << "An unknown error has occurred in the GetlabelCommand class function GetlabelCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; - exit(1); - } - } //********************************************************************************************************************** void GetlabelCommand::help(){ try { - cout << "The get.label command can only be executed after a successful read.otu command." << "\n"; - cout << "You may not use any parameters with the get.label command." << "\n"; - cout << "The get.label command should be in the following format: " << "\n"; - cout << "get.label()" << "\n"; - cout << "Example get.label()." << "\n"; + m->mothurOut("The get.label command can only be executed after a successful read.otu command.\n"); + m->mothurOut("You may not use any parameters with the get.label command.\n"); + m->mothurOut("The get.label command should be in the following format: \n"); + m->mothurOut("get.label()\n"); + m->mothurOut("Example get.label().\n"); } catch(exception& e) { - cout << "Standard Error: " << e.what() << " has occurred in the GetlabelCommand class Function help. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + m->errorOut(e, "GetlabelCommand", "help"); exit(1); } - catch(...) { - cout << "An unknown error has occurred in the GetlabelCommand class function help. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; - exit(1); - } } //********************************************************************************************************************** @@ -75,10 +64,13 @@ int GetlabelCommand::execute(){ int numBins = 0; int count = -1; while(in.good()) { + + if (m->control_pressed) { in.close(); return 0; } + if(count > numBins) count = 0; if(count == 0) { - cout << label << "\n"; + m->mothurOut(label); m->mothurOutEndLine(); in >> numBins; } in >> label; @@ -90,12 +82,8 @@ int GetlabelCommand::execute(){ } catch(exception& e) { - cout << "Standard Error: " << e.what() << " has occurred in the GetlabelCommand class Function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + m->errorOut(e, "GetlabelCommand", "execute"); exit(1); } - catch(...) { - cout << "An unknown error has occurred in the GetlabelCommand class function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; - exit(1); - } }