@@ -16,6 +16,14 @@ import (
16
16
"gopkg.in/yaml.v3"
17
17
)
18
18
19
+ // NoOptDefValuer describes behavior when no
20
+ // option is passed into the flag.
21
+ //
22
+ // This is useful for boolean or otherwise binary flags.
23
+ type NoOptDefValuer interface {
24
+ NoOptDefValue () string
25
+ }
26
+
19
27
// Validator is a wrapper around a pflag.Value that allows for validation
20
28
// of the value after or before it has been set.
21
29
type Validator [T pflag.Value ] struct {
@@ -59,14 +67,6 @@ func (i *Validator[T]) Type() string {
59
67
return i .Value .Type ()
60
68
}
61
69
62
- // NoOptDefValuer describes behavior when no
63
- // option is passed into the flag.
64
- //
65
- // This is useful for boolean or otherwise binary flags.
66
- type NoOptDefValuer interface {
67
- NoOptDefValue () string
68
- }
69
-
70
70
// values.go contains a standard set of value types that can be used as
71
71
// Option Values.
72
72
@@ -372,10 +372,12 @@ type Struct[T any] struct {
372
372
Value T
373
373
}
374
374
375
+ //nolint:revive
375
376
func (s * Struct [T ]) Set (v string ) error {
376
377
return yaml .Unmarshal ([]byte (v ), & s .Value )
377
378
}
378
379
380
+ //nolint:revive
379
381
func (s * Struct [T ]) String () string {
380
382
byt , err := yaml .Marshal (s .Value )
381
383
if err != nil {
@@ -404,6 +406,7 @@ func (s *Struct[T]) UnmarshalYAML(n *yaml.Node) error {
404
406
return n .Decode (& s .Value )
405
407
}
406
408
409
+ //nolint:revive
407
410
func (s * Struct [T ]) Type () string {
408
411
return fmt .Sprintf ("struct[%T]" , s .Value )
409
412
}
0 commit comments