Skip to content

Commit

Permalink
Allow bound struct to omit --help and --version keys
Browse files Browse the repository at this point in the history
  • Loading branch information
aviddiviner committed Dec 7, 2016
1 parent 79cce15 commit 48cb020
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 48cb020

Please sign in to comment.