Custom type for arguments

This commit is contained in:
Alexander Rødseth
2013-11-24 14:40:21 +01:00
parent fbbda7a902
commit 1bea6dcbf0
6 changed files with 40 additions and 23 deletions

View File

@@ -43,11 +43,12 @@ 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 {