Skip to content

Move all usage of survey into an internal pkg #2078

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

Merged
merged 1 commit into from
Dec 29, 2023

Conversation

afbjorklund
Copy link
Member

@afbjorklund afbjorklund commented Dec 16, 2023

This makes it easier to replace the deprecated survey module with another Text User Interface implementation, later on.

None of the currently available alternatives is a good replacement, they take over the entire window and add a lot of deps.

@afbjorklund
Copy link
Member Author

afbjorklund commented Dec 16, 2023

Another alternative would be to fork github.com/lima-vm/survey v2.3.7, and keep the API.

replace (
       github.com/AlecAivazis/survey => github.com/lima-vm/survey v2.3.7
)

return ans, nil
}

func Select(message string, options []string) (int, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe "Choose" to avoid confusion with selecting chans or fds

@AkihiroSuda AkihiroSuda added kind/refactoring Refactoring area/cli limactl CLI user experience labels Dec 16, 2023
@afbjorklund afbjorklund changed the title Move all usage of survey into interfaceutil Move all usage of survey into an internal pkg Dec 16, 2023
@afbjorklund afbjorklund marked this pull request as draft December 22, 2023 07:50
This makes it easier to replace the deprecated survey module
with another Text User Interface implementation, later on.

Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
@AkihiroSuda
Copy link
Member

Is this still a draft?

@afbjorklund
Copy link
Member Author

afbjorklund commented Dec 29, 2023

I was mostly using it as a base to experiment with bubbletea. Not so impressed with the result...

lima-bubbletea


But we could add it as a refactoring, if the new (minimal) "API" is enough to build on.

package uiutil  // import "github.com/lima-vm/lima/pkg/uiutil"

func Confirm(message string, defaultParam bool) (bool, error)
func Select(message string, options []string) (int, error)

@afbjorklund afbjorklund marked this pull request as ready for review December 29, 2023 09:19
@AkihiroSuda AkihiroSuda added this to the v0.20.0 milestone Dec 29, 2023
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@AkihiroSuda AkihiroSuda merged commit 59696e7 into lima-vm:master Dec 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli limactl CLI user experience kind/refactoring Refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants