docopt / docopt.go

A command-line arguments parser that will make you smile.
http://docopt.org/
MIT License
1.43k stars 108 forks source link

Add a more helpful error message when unkown options are encountered #65

Open caldwell opened 6 years ago

caldwell commented 6 years ago

When there is a bad option, docopt-go silently prints the usage and gives no indication of which option(s) it didn't like. It's very confusing when a program with a lot of options has a command line with one of them misspelled.

This patch complains about unknown options instead of silently printing the usage.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.08%) to 88.344% when pulling 871d90846fc38b116fc1dff75bbe5e2b262d1f54 on caldwell:unknown-option-err into ee0de3bc6815ee19d4a46c7eb90f829db0e014b1 on docopt:master.

artburkart commented 5 years ago

I just ran into this, so now my go.mod looks like this:

module github.com/username/project-name

require (
    github.com/caldwell/docopt.go v0.0.0-20180924233533-871d90846fc3
)

and my go file looks like this:

package main
import (
    docopt "github.com/caldwell/docopt.go"
)