X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=setdircommand.cpp;h=ca8c62d43821652d6bf4ea868e9444d54c256ff4;hb=01f8d2c7d982a6209211f5abbcf2a086fdf60d0a;hp=55b752dba4f40e76f11a46d2608e75d43c0de506;hpb=eb4bb52af987ff4df7354d95d60cd763aec537e1;p=mothur.git diff --git a/setdircommand.cpp b/setdircommand.cpp index 55b752d..ca8c62d 100644 --- a/setdircommand.cpp +++ b/setdircommand.cpp @@ -12,7 +12,8 @@ //********************************************************************************************************************** vector SetDirectoryCommand::setParameters(){ try { - CommandParameter ptempdefault("tempdefault", "String", "", "", "", "", "",false,false); parameters.push_back(ptempdefault); + CommandParameter ptempdefault("tempdefault", "String", "", "", "", "", "",false,false); parameters.push_back(ptempdefault); + CommandParameter pdebug("debug", "Boolean", "", "F", "", "", "",false,false); parameters.push_back(pdebug); CommandParameter pinput("input", "String", "", "", "", "", "",false,false); parameters.push_back(pinput); CommandParameter poutput("output", "String", "", "", "", "", "",false,false); parameters.push_back(poutput); CommandParameter pinputdir("inputdir", "String", "", "", "", "", "",false,false); parameters.push_back(pinputdir); @@ -34,7 +35,9 @@ string SetDirectoryCommand::getHelpString(){ helpString += "The set.dir command can be used to direct the output files generated by mothur to a specific place, the directory must exist.\n"; helpString += "The set.dir command can also be used to specify the directory where your input files are located, the directory must exist.\n"; helpString += "The set.dir command can also be used to override or set the default location mothur will look for files if it is unable to find them, the directory must exist.\n"; - helpString += "The set.dir command parameters are input, output and tempdefault and one is required.\n"; + helpString += "The set.dir command can also be used to run mothur in debug mode.\n"; + helpString += "The set.dir command parameters are input, output, tempdefault and debug and one is required.\n"; + helpString += "To run mothur in debug mode set debug=true. Default debug=false.\n"; helpString += "To return the output to the same directory as the input files you may enter: output=clear.\n"; helpString += "To return the input to the current working directory you may enter: input=clear.\n"; helpString += "To set the output to the directory where mothur.exe is located you may enter: output=default.\n"; @@ -81,10 +84,20 @@ SetDirectoryCommand::SetDirectoryCommand(string option) { tempdefault = validParameter.validFile(parameters, "tempdefault", false); if (tempdefault == "not found") { tempdefault = ""; } + + bool debug = false; + bool nodebug = false; + debugOnly = false; + string temp = validParameter.validFile(parameters, "debug", false); + if (temp == "not found") { debug = false; nodebug=true; } + else { debug = m->isTrue(temp); } + m->debug = debug; + + if (debug) { m->mothurOut("Setting [DEBUG] flag.\n"); } - if ((input == "") && (output == "") && (tempdefault == "")) { - m->mothurOut("You must provide either an input, output or tempdefault for the set.outdir command."); m->mothurOutEndLine(); abort = true; - } + if ((input == "") && (output == "") && (tempdefault == "") && nodebug) { + m->mothurOut("You must provide either an input, output, tempdefault or debug for the set.outdir command."); m->mothurOutEndLine(); abort = true; + }else if((input == "") && (output == "") && (tempdefault == "")) { debugOnly = true; } } } catch(exception& e) { @@ -99,6 +112,8 @@ int SetDirectoryCommand::execute(){ if (abort == true) { if (calledHelp) { return 0; } return 2; } + if (debugOnly) { return 0; } + commandFactory = CommandFactory::getInstance(); m->mothurOut("Mothur's directories:"); m->mothurOutEndLine();