MCPcopy Create free account
hub / github.com/OctopusDeploy/cli / MakeItemMapAndOptions

Function MakeItemMapAndOptions

pkg/question/select.go:88–97  ·  view source on GitHub ↗
(items []T, getKey func(item T) string)

Source from the content-addressed store, hash-verified

86}
87
88func MakeItemMapAndOptions[T any](items []T, getKey func(item T) string) (map[string]T, []string) {
89 optionMap := make(map[string]T, len(items))
90 options := make([]string, 0, len(items))
91 for _, item := range items {
92 key := getKey(item)
93 optionMap[key] = item
94 options = append(options, key)
95 }
96 return optionMap, options
97}

Callers 7

getVersionMapFunction · 0.92
MultiSelectMapFunction · 0.85
SelectMapFunction · 0.85
SelectMapWithNewFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected