summaryrefslogtreecommitdiff
path: root/src/mongo/util/options_parser/option_section.cpp
diff options
context:
space:
mode:
authorShaun Verch <shaun.verch@10gen.com>2013-10-10 10:53:56 -0400
committerShaun Verch <shaun.verch@10gen.com>2013-10-23 19:41:30 -0400
commit4686f81fe1ad2dc700ab17748d96e9c24f824579 (patch)
treeb3d16f6d6f49622bcafb1513c31c4e52b95037ea /src/mongo/util/options_parser/option_section.cpp
parent0f9712f7a666699b83cee27fa7136ea92aa9e555 (diff)
downloadmongo-4686f81fe1ad2dc700ab17748d96e9c24f824579.tar.gz
SERVER-11144 Add attribute to affect what sources an option can have
Diffstat (limited to 'src/mongo/util/options_parser/option_section.cpp')
-rw-r--r--src/mongo/util/options_parser/option_section.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/mongo/util/options_parser/option_section.cpp b/src/mongo/util/options_parser/option_section.cpp
index bfd41d507b3..f6819549d9f 100644
--- a/src/mongo/util/options_parser/option_section.cpp
+++ b/src/mongo/util/options_parser/option_section.cpp
@@ -98,7 +98,9 @@ namespace optionenvironment {
try {
addOptionChaining(positionalOption._name, positionalOption._name,
- positionalOption._type, "hidden description").hidden();
+ positionalOption._type, "hidden description")
+ .hidden()
+ .setSources(SourceCommandLine);
}
catch (DBException &e) {
return e.toStatus();
@@ -370,11 +372,15 @@ namespace optionenvironment {
Status OptionSection::getBoostOptions(po::options_description* boostOptions,
bool visibleOnly,
- bool includeDefaults) const {
+ bool includeDefaults,
+ OptionSources sources) const {
std::list<OptionDescription>::const_iterator oditerator;
for (oditerator = _options.begin(); oditerator != _options.end(); oditerator++) {
- if (!visibleOnly || (oditerator->_isVisible)) {
+ // Only include this option if it matches the sources we specified and the option is
+ // either visible or we are requesting hidden options
+ if ((!visibleOnly || (oditerator->_isVisible)) &&
+ (oditerator->_sources & sources)) {
std::auto_ptr<po::value_semantic> boostType;
Status ret = typeToBoostType(&boostType,
oditerator->_type,