summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mongodump/main/mongodump.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/mongodump/main/mongodump.go b/mongodump/main/mongodump.go
index ec8f5b128ff..4c228fe922a 100644
--- a/mongodump/main/mongodump.go
+++ b/mongodump/main/mongodump.go
@@ -6,6 +6,7 @@ import (
"github.com/mongodb/mongo-tools/mongodump"
"github.com/mongodb/mongo-tools/mongodump/options"
"os"
+ "strings"
)
func main() {
@@ -17,13 +18,21 @@ func main() {
outputOpts := &options.OutputOptions{}
opts.AddOptions(outputOpts)
- _, err := opts.Parse()
+ extraArgs, err := opts.Parse()
if err != nil {
log.Logf(log.Always, "error parsing command line options: %v\n\n", err)
opts.PrintHelp(true)
return
}
+ if len(extraArgs) > 0 {
+ log.Logf(log.Always,
+ "error: mongodump does not accept positional arguments (%v) see help text",
+ strings.Join(extraArgs, ", "))
+ opts.PrintHelp(true)
+ os.Exit(1)
+ }
+
// print help, if specified
if opts.PrintHelp(false) {
return