mirror of
https://github.com/kubereboot/kured.git
synced 2026-08-22 12:56:34 +00:00
32 lines
417 B
Go
32 lines
417 B
Go
package main
|
|
|
|
import (
|
|
"regexp"
|
|
)
|
|
|
|
type regexpValue struct {
|
|
value **regexp.Regexp
|
|
}
|
|
|
|
func (rev *regexpValue) String() string {
|
|
if *rev.value == nil {
|
|
return ""
|
|
}
|
|
return (*rev.value).String()
|
|
}
|
|
|
|
func (rev *regexpValue) Set(s string) error {
|
|
value, err := regexp.Compile(s)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
*rev.value = value
|
|
|
|
return nil
|
|
}
|
|
|
|
func (rev *regexpValue) Type() string {
|
|
return "regexp.Regexp"
|
|
}
|