]> git.donarmstrong.com Git - mothur.git/blob - quitcommand.cpp
broke up globaldata and moved error checking and help into commands
[mothur.git] / quitcommand.cpp
1 /*
2  *  quitcommand.cpp
3  *  Dotur
4  *
5  *  Created by Sarah Westcott on 1/2/09.
6  *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
7  *
8  */
9
10 #include "quitcommand.h"
11
12 //**********************************************************************************************************************
13
14 QuitCommand::QuitCommand(string option){
15                 abort = false;
16                 
17                 //allow user to run help
18                 if(option == "help") { help(); abort = true; }
19                 
20                 else if (option != "") { cout << "There are no valid parameters for the quit command." << endl;  abort = true;  }
21
22 }
23 //**********************************************************************************************************************
24
25 void QuitCommand::help(){
26         try {
27                 cout << "The quit command will terminate mothur and should be in the following format: " << "\n";
28                 cout << "quit() or quit" << "\n" << "\n";
29         }
30         catch(exception& e) {
31                 cout << "Standard Error: " << e.what() << " has occurred in the QuitCommand class Function help. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
32                 exit(1);
33         }
34         catch(...) {
35                 cout << "An unknown error has occurred in the QuitCommand class function help. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
36                 exit(1);
37         }       
38 }
39
40 //**********************************************************************************************************************
41
42 QuitCommand::~QuitCommand(){}
43
44 //**********************************************************************************************************************
45
46 int QuitCommand::execute(){
47         if (abort == true) { return 0; }
48         return 1;
49 }
50
51 //**********************************************************************************************************************