MCPcopy Index your code
hub / github.com/devspace-sh/devspace / WithCommandFlags

Function WithCommandFlags

pkg/devspace/context/values/values.go:29–42  ·  view source on GitHub ↗

WithCommandFlags creates a new context with the given flags

(parent context.Context, flagSet *flag.FlagSet)

Source from the content-addressed store, hash-verified

27
28// WithCommandFlags creates a new context with the given flags
29func WithCommandFlags(parent context.Context, flagSet *flag.FlagSet) context.Context {
30 flagsMap := map[string]string{}
31 flagSet.VisitAll(func(f *flag.Flag) {
32 sliceType, ok := f.Value.(flag.SliceValue)
33 if ok {
34 flagsMap[f.Name] = strings.Join(sliceType.GetSlice(), " ")
35 } else {
36 flagsMap[f.Name] = f.Value.String()
37 }
38 })
39
40 gfc := WithValue(parent, commandFlagsKey, flagsMap)
41 return WithValue(gfc, flagsKey, flagsMap)
42}
43
44// FlagsFrom returns a context used to start and stop dev configurations
45func FlagsFrom(ctx context.Context) (map[string]string, bool) {

Callers 2

RunMethod · 0.92
pipelines.goFile · 0.92

Calls 2

WithValueFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected