diff options
Diffstat (limited to 'src/mongo/tools/mongooplog_options.cpp')
-rw-r--r-- | src/mongo/tools/mongooplog_options.cpp | 34 |
1 files changed, 9 insertions, 25 deletions
diff --git a/src/mongo/tools/mongooplog_options.cpp b/src/mongo/tools/mongooplog_options.cpp index d1e7a7edda8..cd7d27d5cc7 100644 --- a/src/mongo/tools/mongooplog_options.cpp +++ b/src/mongo/tools/mongooplog_options.cpp @@ -18,11 +18,8 @@ #include "mongo/base/status.h" #include "mongo/util/log.h" -#include "mongo/util/options_parser/environment.h" -#include "mongo/util/options_parser/option_description.h" -#include "mongo/util/options_parser/option_section.h" -#include "mongo/util/options_parser/options_parser.h" #include "mongo/util/options_parser/startup_option_init.h" +#include "mongo/util/options_parser/startup_options.h" namespace mongo { @@ -70,15 +67,15 @@ namespace mongo { return Status::OK(); } - void printMongoOplogHelp(const moe::OptionSection options, std::ostream* out) { + void printMongoOplogHelp(std::ostream* out) { *out << "Pull and replay a remote MongoDB oplog.\n" << std::endl; - *out << options.helpString(); + *out << moe::startupOptions.helpString(); *out << std::flush; } Status handlePreValidationMongoOplogOptions(const moe::Environment& params) { - if (toolsParsedOptions.count("help")) { - printMongoOplogHelp(toolsOptions, &std::cout); + if (params.count("help")) { + printMongoOplogHelp(&std::cout); ::_exit(0); } return Status::OK(); @@ -106,28 +103,15 @@ namespace mongo { } MONGO_GENERAL_STARTUP_OPTIONS_REGISTER(MongoOplogOptions)(InitializerContext* context) { - return addMongoOplogOptions(&toolsOptions); - } - - MONGO_STARTUP_OPTIONS_PARSE(MongoOplogOptions)(InitializerContext* context) { - moe::OptionsParser parser; - Status ret = parser.run(toolsOptions, context->args(), context->env(), - &toolsParsedOptions); - if (!ret.isOK()) { - std::cerr << ret.reason() << std::endl; - std::cerr << "try '" << context->args()[0] - << " --help' for more information" << std::endl; - ::_exit(EXIT_BADOPTIONS); - } - return Status::OK(); + return addMongoOplogOptions(&moe::startupOptions); } MONGO_STARTUP_OPTIONS_VALIDATE(MongoOplogOptions)(InitializerContext* context) { - Status ret = handlePreValidationMongoOplogOptions(toolsParsedOptions); + Status ret = handlePreValidationMongoOplogOptions(moe::startupOptionsParsed); if (!ret.isOK()) { return ret; } - ret = toolsParsedOptions.validate(); + ret = moe::startupOptionsParsed.validate(); if (!ret.isOK()) { return ret; } @@ -135,6 +119,6 @@ namespace mongo { } MONGO_STARTUP_OPTIONS_STORE(MongoOplogOptions)(InitializerContext* context) { - return storeMongoOplogOptions(toolsParsedOptions, context->args()); + return storeMongoOplogOptions(moe::startupOptionsParsed, context->args()); } } |