23 lines
367 B
Go
23 lines
367 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"encoding"
|
||
|
"fmt"
|
||
|
)
|
||
|
|
||
|
type textUnmarshalerFlag struct {
|
||
|
inner interface {
|
||
|
encoding.TextUnmarshaler
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (f textUnmarshalerFlag) Set(v string) error {
|
||
|
return f.inner.UnmarshalText([]byte(v))
|
||
|
}
|
||
|
|
||
|
func (f textUnmarshalerFlag) String() string {
|
||
|
return fmt.Sprint(f.inner)
|
||
|
}
|
||
|
|
||
|
func (f textUnmarshalerFlag) Type() string { return "string" }
|