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

Function promptForVariable

pkg/cmd/tenant/variables/update/update.go:476–489  ·  view source on GitHub ↗
(opts *UpdateOptions, tenantVariables *[]T, variableFilter func(opts *UpdateOptions, tenantVariables *[]T) []*PossibleVariable)

Source from the content-addressed store, hash-verified

474}
475
476func promptForVariable[T any](opts *UpdateOptions, tenantVariables *[]T, variableFilter func(opts *UpdateOptions, tenantVariables *[]T) []*PossibleVariable) (*PossibleVariable, error) {
477 possibleVariables := variableFilter(opts, tenantVariables)
478 selectedVariable, err := selectors.Select(opts.Ask, "You have not specified a variable", func() ([]*PossibleVariable, error) { return possibleVariables, nil }, func(variable *PossibleVariable) string {
479 return fmt.Sprintf("%s / %s", variable.Owner, variable.VariableName)
480 })
481 if err != nil {
482 return nil, err
483 }
484
485 opts.Name.Value = selectedVariable.VariableName
486 opts.VariableId = selectedVariable.ID
487 opts.TemplateId = selectedVariable.TemplateID
488 return selectedVariable, nil
489}
490
491func mapVariableControlTypeToVariableType(controlType resources.ControlType) (sharedVariable.VariableType, error) {
492 switch controlType {

Callers 1

PromptMissingFunction · 0.70

Calls 1

SelectFunction · 0.92

Tested by

no test coverage detected