We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 61920a7 commit 9b3745cCopy full SHA for 9b3745c
internal/args/unmarshal.go
@@ -115,6 +115,14 @@ var unmarshalFuncs = map[reflect.Type]UnmarshalFunc{
115
*(dest.(*[]byte)) = []byte(value)
116
return nil
117
},
118
+ reflect.TypeOf((*scw.Duration)(nil)).Elem(): func(value string, dest interface{}) error {
119
+ duration, err := time.ParseDuration(value)
120
+ if err != nil {
121
+ return fmt.Errorf("failed to parse duration: %w", err)
122
+ }
123
+ *(dest.(*scw.Duration)) = *scw.NewDurationFromTimeDuration(duration)
124
+ return nil
125
+ },
126
}
127
128
// UnmarshalStruct parses args like ["arg1=1", "arg2=2"] to a Go structure using reflection.
0 commit comments