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

Function SelectOrNew

pkg/question/selectors/selectors.go:57–64  ·  view source on GitHub ↗

SelectOrNew is the same as Select but show a create new option at the bottom of the list When create new is selected the returned bool will be true

(ask question.Asker, questionText string, itemsCallback func() ([]T, error), getKey func(item T) string)

Source from the content-addressed store, hash-verified

55// SelectOrNew is the same as Select but show a create new option at the bottom of the list
56// When create new is selected the returned bool will be true
57func SelectOrNew[T any](ask question.Asker, questionText string, itemsCallback func() ([]T, error), getKey func(item T) string) (T, bool, error) {
58 items, err := itemsCallback()
59 if err != nil {
60 var item T
61 return item, false, err
62 }
63 return question.SelectMapWithNew(ask, questionText, items, getKey)
64}

Callers 1

AskProjectGroupsFunction · 0.92

Calls 1

SelectMapWithNewFunction · 0.92

Tested by

no test coverage detected