Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetPath ¶
GetPath returns a GetFunc that expands a slice of strings into individual paths based on standard POSIX shell $PATH separator parsing.
Example ¶
package main import ( "fmt" "github.com/spf13/viper" "vitess.io/vitess/go/viperutil" "vitess.io/vitess/go/viperutil/funcs" "vitess.io/vitess/go/viperutil/internal/value" ) func main() { v := viper.New() val := viperutil.Configure("path", viperutil.Options[[]string]{ GetFunc: funcs.GetPath, }) stub(val, v) v.Set(val.Key(), []string{"/var/www", "/usr:/usr/bin", "/vt"}) fmt.Println(val.Get()) } func stub[T any](val viperutil.Value[T], v *viper.Viper) { // N.B.: You cannot do this in normal code because these types are internal // to viperutil, but you also will not need to do this. However it's // necessary for the example to work here. base := val.(*value.Static[T]).Base base.BoundGetFunc = base.GetFunc(v) }
Output: [/var/www /usr /usr/bin /vt]
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.