Skip to content

Move interactive functions to cmd #2893

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
phillebaba opened this issue Aug 15, 2024 · 1 comment
Open

Move interactive functions to cmd #2893

phillebaba opened this issue Aug 15, 2024 · 1 comment

Comments

@phillebaba
Copy link
Contributor

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

@mkcp mkcp added this to Zarf Mar 3, 2025
@github-project-automation github-project-automation bot moved this to Triage in Zarf Mar 3, 2025
@brandtkeller brandtkeller moved this from Triage to Backlog in Zarf Mar 5, 2025
@brandtkeller
Copy link
Member

Should be considered in context for #3525

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

No branches or pull requests

3 participants