Skip to content

Commit

Permalink
Fixed error in parse command period (corecli)
Browse files Browse the repository at this point in the history
  • Loading branch information
memclutter committed Jan 6, 2022
1 parent 753b212 commit 641ab80
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/corecli/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,11 @@ func initCommand(typeOf reflect.Type, valueOf reflect.Value) (*cli.Command, refl
}

// Periodical command
period, err = time.ParseDuration(field.Tag.Get("cli.command.period"))
if err != nil {
return nil, flagsFieldValueOf, period, fmt.Errorf("parse period error: %v", err)
if periodTag, ok := field.Tag.Lookup("cli.command.period"); ok {
period, err = time.ParseDuration(periodTag)
if err != nil {
return nil, flagsFieldValueOf, period, fmt.Errorf("parse period error: %v", err)
}
}

// Command subcommands
Expand Down

0 comments on commit 641ab80

Please sign in to comment.