fs: Make Option.GetValue() public #2541
This commit is contained in:
parent
e7e467fb3a
commit
1557287c64
1 changed files with 5 additions and 5 deletions
10
fs/fs.go
10
fs/fs.go
|
@ -125,8 +125,8 @@ type Option struct {
|
||||||
Advanced bool // set if this is an advanced config option
|
Advanced bool // set if this is an advanced config option
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gets the current current value which is the default if not set
|
// GetValue gets the current current value which is the default if not set
|
||||||
func (o *Option) value() interface{} {
|
func (o *Option) GetValue() interface{} {
|
||||||
val := o.Value
|
val := o.Value
|
||||||
if val == nil {
|
if val == nil {
|
||||||
val = o.Default
|
val = o.Default
|
||||||
|
@ -136,12 +136,12 @@ func (o *Option) value() interface{} {
|
||||||
|
|
||||||
// String turns Option into a string
|
// String turns Option into a string
|
||||||
func (o *Option) String() string {
|
func (o *Option) String() string {
|
||||||
return fmt.Sprint(o.value())
|
return fmt.Sprint(o.GetValue())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set a Option from a string
|
// Set a Option from a string
|
||||||
func (o *Option) Set(s string) (err error) {
|
func (o *Option) Set(s string) (err error) {
|
||||||
newValue, err := configstruct.StringToInterface(o.value(), s)
|
newValue, err := configstruct.StringToInterface(o.GetValue(), s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ func (o *Option) Set(s string) (err error) {
|
||||||
|
|
||||||
// Type of the value
|
// Type of the value
|
||||||
func (o *Option) Type() string {
|
func (o *Option) Type() string {
|
||||||
return reflect.TypeOf(o.value()).Name()
|
return reflect.TypeOf(o.GetValue()).Name()
|
||||||
}
|
}
|
||||||
|
|
||||||
// FlagName for the option
|
// FlagName for the option
|
||||||
|
|
Loading…
Add table
Reference in a new issue