(opts *UpdateOptions, tenantVariables *[]T, variableFilter func(opts *UpdateOptions, tenantVariables *[]T) []*PossibleVariable)
| 474 | } |
| 475 | |
| 476 | func 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 | |
| 491 | func mapVariableControlTypeToVariableType(controlType resources.ControlType) (sharedVariable.VariableType, error) { |
| 492 | switch controlType { |
no test coverage detected