Merge branch 'master' of github.com:xyproto/cli into xyproto-master

Conflicts:
	app.go
	context.go
This commit is contained in:
Jeremy Saenz
2013-11-28 07:51:31 -08:00
7 changed files with 94 additions and 35 deletions

View File

@@ -43,15 +43,16 @@ func (c Command) Run(ctx *Context) error {
var err error
if firstFlagIndex > -1 {
args := ctx.Args()[1:firstFlagIndex]
flags := ctx.Args()[firstFlagIndex:]
err = set.Parse(append(flags, args...))
args := ctx.Args()
regularArgs := args[1:firstFlagIndex]
flagArgs := args[firstFlagIndex:]
err = set.Parse(append(flagArgs, regularArgs...))
} else {
err = set.Parse(ctx.Args()[1:])
err = set.Parse(ctx.Args().Tail())
}
if err != nil {
fmt.Println("Incorrect Usage.\n")
fmt.Printf("Incorrect Usage.\n\n")
ShowCommandHelp(ctx, c.Name)
fmt.Println("")
return err