mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-30 09:06:21 +01:00
tools: make output nicer on program options errors
This commit is contained in:
parent
2df6ddd566
commit
fd2a19c1bc
@ -47,11 +47,17 @@ void mongo::Tool::printHelp(ostream &out) {
|
||||
int mongo::Tool::main( int argc , char ** argv ){
|
||||
boost::filesystem::path::default_name_check( boost::filesystem::no_check );
|
||||
|
||||
po::store( po::command_line_parser( argc , argv ).
|
||||
options( *_options ).
|
||||
positional( _positonalOptions ).run() , _params );
|
||||
try {
|
||||
po::store( po::command_line_parser( argc , argv ).
|
||||
options( *_options ).
|
||||
positional( _positonalOptions ).run() , _params );
|
||||
|
||||
po::notify( _params );
|
||||
po::notify( _params );
|
||||
} catch (po::error &e) {
|
||||
cout << "ERROR: " << e.what() << endl << endl;
|
||||
printHelp(cout);
|
||||
return EXIT_BADOPTIONS;
|
||||
}
|
||||
|
||||
if ( _params.count( "help" ) ){
|
||||
printHelp(cerr);
|
||||
|
Loading…
Reference in New Issue
Block a user