]> git.donarmstrong.com Git - mothur.git/blobdiff - quitcommand.cpp
broke up globaldata and moved error checking and help into commands
[mothur.git] / quitcommand.cpp
index 6b90f4b15c1cf64ae04bed98db42138f0edcf2d7..87c2fa0672478e9899c60887ff0aa459f79551ee 100644 (file)
 
 //**********************************************************************************************************************
 
-QuitCommand::QuitCommand(){}
+QuitCommand::QuitCommand(string option){
+               abort = false;
+               
+               //allow user to run help
+               if(option == "help") { help(); abort = true; }
+               
+               else if (option != "") { cout << "There are no valid parameters for the quit command." << endl;  abort = true;  }
+
+}
+//**********************************************************************************************************************
+
+void QuitCommand::help(){
+       try {
+               cout << "The quit command will terminate mothur and should be in the following format: " << "\n";
+               cout << "quit() or quit" << "\n" << "\n";
+       }
+       catch(exception& e) {
+               cout << "Standard Error: " << e.what() << " has occurred in the QuitCommand class Function help. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }
+       catch(...) {
+               cout << "An unknown error has occurred in the QuitCommand class function help. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }       
+}
 
 //**********************************************************************************************************************
 
@@ -20,6 +44,7 @@ QuitCommand::~QuitCommand(){}
 //**********************************************************************************************************************
 
 int QuitCommand::execute(){
+       if (abort == true) { return 0; }
        return 1;
 }