Skip to content
This repository has been archived by the owner on Dec 7, 2020. It is now read-only.

Commit

Permalink
CLI Relfection
Browse files Browse the repository at this point in the history
- forgot to add the parsing of Duration and unit64 types (capturing the time.Duration really)
  • Loading branch information
gambol99 committed Jan 9, 2017
1 parent 260d2c8 commit 2affd1d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,17 @@ func parseCLIOptions(cx *cli.Context, config *Config) (err error) {
for _, x := range cx.StringSlice(name) {
reflect.Append(reflect.ValueOf(config).Elem().FieldByName(field.Name), reflect.ValueOf(x))
}
case reflect.Int64:
switch field.Type.String() {
case "time.Duration":
reflect.ValueOf(config).Elem().FieldByName(field.Name).SetInt(int64(cx.Duration(name)))
default:
reflect.ValueOf(config).Elem().FieldByName(field.Name).SetInt(cx.Int64(name))
}
}
}
}
fmt.Printf("cors %s", config.CorsMaxAge.String())
if cx.IsSet("tag") {
tags, err := decodeKeyPairs(cx.StringSlice("tag"))
if err != nil {
Expand Down

0 comments on commit 2affd1d

Please sign in to comment.