iperf3exporter/vendor/github.com/nishanths/exhaustive/regexp_flag.go
Marvin Preuss 2343c9588a
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is failing
first commit
2021-10-20 10:08:56 +02:00

36 lines
420 B
Go

package exhaustive
import (
"regexp"
)
type regexpFlag struct {
r *regexp.Regexp
}
func (v *regexpFlag) String() string {
if v.r != nil {
return v.r.String()
}
return ""
}
func (v *regexpFlag) Set(expr string) error {
if expr == "" {
v.r = nil
return nil
}
r, err := regexp.Compile(expr)
if err != nil {
return err
}
v.r = r
return nil
}
func (v *regexpFlag) Get() interface{} {
return v.r
}