Do not return error when flag parsing should be skipped

Signed-off-by: Nathan LeClaire <nathan.leclaire@gmail.com>
This commit is contained in:
Nathan LeClaire
2015-09-25 14:13:36 -07:00
committed by Jesse Szwedko
parent 70e3fa51eb
commit c538c376c9
2 changed files with 28 additions and 0 deletions

View File

@@ -102,6 +102,12 @@ func (c Command) Run(ctx *Context) error {
err = set.Parse(append(flagArgs, regularArgs...))
} else {
err = set.Parse(ctx.Args().Tail())
// Work around issue where if the first arg in ctx.Args.Tail()
// is a flag, set.Parse returns an error
if c.SkipFlagParsing {
err = nil
}
}
if err != nil {