MCPcopy Index your code
hub / github.com/hashicorp/vault / StringSliceVar

Method StringSliceVar

command/base_flags.go:704–728  ·  view source on GitHub ↗
(i *StringSliceVar)

Source from the content-addressed store, hash-verified

702}
703
704func (f *FlagSet) StringSliceVar(i *StringSliceVar) {
705 initial := i.Default
706 if v, exist := os.LookupEnv(i.EnvVar); exist {
707 parts := strings.Split(v, ",")
708 for i := range parts {
709 parts[i] = strings.TrimSpace(parts[i])
710 }
711 initial = parts
712 }
713
714 def := ""
715 if i.Default != nil {
716 def = strings.Join(i.Default, ",")
717 }
718
719 f.VarFlag(&VarFlag{
720 Name: i.Name,
721 Aliases: i.Aliases,
722 Usage: i.Usage,
723 Default: def,
724 EnvVar: i.EnvVar,
725 Value: newStringSliceValue(initial, i.Target, i.Hidden),
726 Completion: i.Completion,
727 })
728}
729
730type stringSliceValue struct {
731 hidden bool

Callers 15

FlagsMethod · 0.95
FlagsMethod · 0.95
FlagsMethod · 0.95
FlagsMethod · 0.95
FlagsMethod · 0.95
FlagsMethod · 0.95
FlagsMethod · 0.95
FlagsMethod · 0.95
FlagsMethod · 0.95
FlagsMethod · 0.95
FlagsMethod · 0.95
flagSetMethod · 0.95

Calls 2

VarFlagMethod · 0.95
newStringSliceValueFunction · 0.85

Tested by

no test coverage detected