From 48cb0209ffb9f48dea927115f8ebf12d066ea9fb Mon Sep 17 00:00:00 2001 From: David Irvine Date: Wed, 7 Dec 2016 12:08:28 -0500 Subject: [PATCH] Allow bound struct to omit --help and --version keys --- opts.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/opts.go b/opts.go index 6a7fc58..574282e 100644 --- a/opts.go +++ b/opts.go @@ -135,6 +135,9 @@ func (o Opts) Bind(v interface{}) error { for k, v := range o { i, ok := indexMap[k] if !ok { + if k == "--help" || k == "--version" { + continue + } return newError("mapping of '%s' is not found in given struct, or an unexported field", k) } field := value.Field(i)