diff options
Diffstat (limited to 'tools/dump.cpp')
-rw-r--r-- | tools/dump.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tools/dump.cpp b/tools/dump.cpp index a1690b2..971575d 100644 --- a/tools/dump.cpp +++ b/tools/dump.cpp @@ -37,7 +37,7 @@ class Dump : public Tool { FILE* _f; }; public: - Dump() : Tool( "dump" , ALL , "*" , "*" , false ) { + Dump() : Tool( "dump" , ALL , "*" , "*" , true ) { add_options() ("out,o", po::value<string>()->default_value("dump"), "output directory or \"-\" for stdout") ("query,q", po::value<string>() , "json query" ) @@ -47,6 +47,19 @@ public: ; } + virtual void preSetup() { + string out = getParam("out"); + if ( out == "-" ) { + // write output to standard error to avoid mangling output + // must happen early to avoid sending junk to stdout + useStandardOutput(false); + } + } + + virtual void printExtraHelp(ostream& out) { + out << "Export MongoDB data to BSON files.\n" << endl; + } + // This is a functor that writes a BSONObj to a file struct Writer { Writer(FILE* out, ProgressMeter* m) :_out(out), _m(m) {} |