Skip to content

Move interactive functions to cmd #2893

Open
@phillebaba

Description

@phillebaba

Describe what should be investigated or refactored

We have a lot of code that uses interactive functions to get user input in our library functions. This requires the code to be aware of it is being used in a context where user input could be fetched. Making the code questionably thread safe in these situations if it were to be called in parallel.

It would be best to move any use of code related to user input to the cmd package. In the future any code that is being exported for library use should not concert itself with user input.

Links to any relevant code

setVal, err := interactive.PromptVariable(v1alpha1.InteractiveVariable{
Variable: v1alpha1.Variable{Name: key},
})

component, err := interactive.SelectChoiceGroup(group)
if err != nil {
return nil, fmt.Errorf("%w: %w", ErrSelectionCanceled, err)
}

selected, err := interactive.SelectOptionalComponent(component)
if err != nil {
return nil, fmt.Errorf("%w: %w", ErrSelectionCanceled, err)
}

Additional context

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Ready

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions