diff options
author | Eliot Horowitz <eliot@10gen.com> | 2010-02-21 10:42:38 -0500 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2010-02-21 10:42:38 -0500 |
commit | a1309b7c345c41d93bf8a942b240ff325c96235f (patch) | |
tree | 32070094e4aafc0c6505f9bb4e35bbde249c9efc /tools | |
parent | 267056081f2fc627a94fa310b7e4a9438006ba2f (diff) | |
download | mongo-a1309b7c345c41d93bf8a942b240ff325c96235f.tar.gz |
changed Tool() cons arguments a bit
Diffstat (limited to 'tools')
-rw-r--r-- | tools/dump.cpp | 2 | ||||
-rw-r--r-- | tools/restore.cpp | 2 | ||||
-rw-r--r-- | tools/tool.cpp | 13 | ||||
-rw-r--r-- | tools/tool.h | 2 |
4 files changed, 11 insertions, 8 deletions
diff --git a/tools/dump.cpp b/tools/dump.cpp index a310e19782e..52e95ce6b28 100644 --- a/tools/dump.cpp +++ b/tools/dump.cpp @@ -28,7 +28,7 @@ namespace po = boost::program_options; class Dump : public Tool { public: - Dump() : Tool( "dump" , "*" ){ + Dump() : Tool( "dump" , true , "*" ){ add_options() ("out,o", po::value<string>()->default_value("dump"), "output directory") ; diff --git a/tools/restore.cpp b/tools/restore.cpp index fbd45228dec..8c2226b4d4e 100644 --- a/tools/restore.cpp +++ b/tools/restore.cpp @@ -31,7 +31,7 @@ namespace po = boost::program_options; class Restore : public Tool { public: - Restore() : Tool( "restore" , "" , "" ){ + Restore() : Tool( "restore" , true , "" , "" ){ add_hidden_options() ("dir", po::value<string>()->default_value("dump"), "directory to restore from") ; diff --git a/tools/tool.cpp b/tools/tool.cpp index 14da5bd5c81..9162045b688 100644 --- a/tools/tool.cpp +++ b/tools/tool.cpp @@ -30,20 +30,23 @@ using namespace mongo; namespace po = boost::program_options; -mongo::Tool::Tool( string name , string defaultDB , string defaultCollection ) : +mongo::Tool::Tool( string name , bool localDBAllowed , string defaultDB , string defaultCollection ) : _name( name ) , _db( defaultDB ) , _coll( defaultCollection ) , _conn(0), _paired(false) { - + _options = new po::options_description( "options" ); _options->add_options() ("help","produce help message") + ("verbose,v", "be more verbose (include multiple times for more verbosity e.g. -vvvvv)") ("host,h",po::value<string>(), "mongo host to connect to (\"left,right\" for pairs)" ) ("db,d",po::value<string>(), "database to use" ) ("collection,c",po::value<string>(), "collection to use (some commands)" ) ("username,u",po::value<string>(), "username" ) ("password,p",po::value<string>(), "password" ) - ("dbpath",po::value<string>(), "directly access mongod data files in this path, instead of connecting to a mongod instance" ) - ("directoryperdb", "if dbpath specified, each db is in a separate directory" ) - ("verbose,v", "be more verbose (include multiple times for more verbosity e.g. -vvvvv)") + ; + if ( localDBAllowed ) + _options->add_options() + ("dbpath",po::value<string>(), "directly access mongod data files in this path, instead of connecting to a mongod instance" ) + ("directoryperdb", "if dbpath specified, each db is in a separate directory" ) ; _hidden_options = new po::options_description( name + " hidden options" ); diff --git a/tools/tool.h b/tools/tool.h index ed8822e888c..baebdea19b2 100644 --- a/tools/tool.h +++ b/tools/tool.h @@ -35,7 +35,7 @@ namespace mongo { class Tool { public: - Tool( string name , string defaultDB="test" , string defaultCollection=""); + Tool( string name , bool localDBAllowed=true, string defaultDB="test" , string defaultCollection=""); virtual ~Tool(); int main( int argc , char ** argv ); |