mirror of
https://github.com/kubereboot/kured.git
synced 2026-08-19 03:16:23 +00:00
This will remove double pointers, and be explicit about the type we are using. Signed-off-by: Jean-Philippe Evrard <open-source@a.spamming.party>
31 lines
455 B
Go
31 lines
455 B
Go
package main
|
|
|
|
import (
|
|
"regexp"
|
|
)
|
|
|
|
type regexpValue struct {
|
|
*regexp.Regexp
|
|
}
|
|
|
|
func (rev *regexpValue) String() string {
|
|
if rev.Regexp == nil {
|
|
return ""
|
|
}
|
|
return rev.Regexp.String()
|
|
}
|
|
|
|
func (rev *regexpValue) Set(s string) error {
|
|
value, err := regexp.Compile(s)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
rev.Regexp = value
|
|
return nil
|
|
}
|
|
|
|
// Type method returns the type of the flag as a string
|
|
func (rev *regexpValue) Type() string {
|
|
return "regexp"
|
|
}
|