Skip to content

Commit

Permalink
Fix small bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Ak-Army committed May 13, 2020
1 parent a164ac8 commit a03e446
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ func (cli *CLI) getSubCommand(commandSet *commands, args []string) (*commands, e
return subC, nil
}
if len(args) > 1 {
if err := c.Command.Parse(args[2:]); err != nil {
if err := c.Command.Parse(args[1:]); err != nil {
return c, err
}
} else {
Expand Down Expand Up @@ -290,14 +290,14 @@ func (cli *CLI) defineFlagSet(fs *flag.FlagSet, st reflect.Value) error {
flagValueType := reflect.TypeOf((*flag.Value)(nil)).Elem()
for i := 0; i < st.NumField(); i++ {
typ := st.Type().Field(i)
var name, usage string
tag := typ.Tag.Get("flag")
if typ.Type.Kind() == reflect.Struct {
if err := cli.defineFlagSet(fs, st.Field(i)); err != nil {
return err
}
continue
}
var name, usage string
tag := typ.Tag.Get("flag")
if tag == "" {
continue
}
Expand Down

0 comments on commit a03e446

Please sign in to comment.