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

Function ByName

pkg/question/selectors/selectors.go:23–32  ·  view source on GitHub ↗
(ask question.Asker, list []T, message string)

Source from the content-addressed store, hash-verified

21}
22
23func ByName[T Nameable](ask question.Asker, list []T, message string) (T, error) {
24 var selectedItem T
25 selectedItem, err := question.SelectMap(ask, message, list, func(item T) string {
26 return item.GetName()
27 })
28 if err != nil {
29 return selectedItem, err
30 }
31 return selectedItem, nil
32}
33
34func SelectOptions[T any](ask question.Asker, questionText string, itemsCallback func() []*SelectOption[T]) (*SelectOption[T], error) {
35 items := itemsCallback()

Callers 10

PromptMissingFunction · 0.92
PromptMissingFunction · 0.92
PromptMissingFunction · 0.92
deleteRunFunction · 0.92
PromptMissingFunction · 0.92
PromptMissingFunction · 0.92
PromptMissingFunction · 0.92
deleteRunFunction · 0.92
deleteRunFunction · 0.92
PromptValueFunction · 0.92

Calls 2

SelectMapFunction · 0.92
GetNameMethod · 0.65

Tested by

no test coverage detected