-
Notifications
You must be signed in to change notification settings - Fork 101
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
Add list and text prompts for bubble tea #4671
Conversation
//go:generate mockgen -destination=./mock_bubleteaprompter.go -package=prompt -self_package github.com/project-radius/radius/pkg/cli/prompt github.com/project-radius/radius/pkg/cli/prompt BubbleTeaPrompter | ||
|
||
// BubbleTeaPrompter contains operation to get user inputs for cli | ||
type BubbleTeaPrompter interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will need this for testing cli prompts in the commands
|
||
// GetTextInput prompts user for a text input | ||
func (i *BubbleTeaPrompterImpl) GetInput(program tea.Program) (string, error) { | ||
// TODO: implement text model |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Text model should probably be implemented under a new folder as discussed yesterday. Is there a change on that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have implemented the text model now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then should this TODO be removed?
pkg/cli/prompt/errors.go
Outdated
return "invalid model for prompt operation" | ||
} | ||
|
||
// Is checks for the error type is ErrUnsupportedModel. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Is checks for the error type is ErrUnsupportedModel. | |
// Is checks if the error provided is of type ErrUnsupportedModel. |
This function actually not only checks if the given error is of type ErrUnsupportedModel
, it also checks to see if the messages are equal. I was wondering if we could use another name here. Not that important though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't feel strongly about the name. But my thought has been to keep it consistent with other places in our code base. Let me know if you feel strongly about it and we can decide a name.
a96a8c6
to
8706b62
Compare
Hoping the windows VM testing was done correctlyl |
31971b7
to
320c01b
Compare
|
||
package prompt | ||
|
||
var _ error = (*ErrUnsupportedModel)(nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would we ever handle this error? If this happens it's a coding mistake right?
// ------------------------------------------------------------ | ||
|
||
package list | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this based on a sample? Would be helpful to link to it if so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/charmbracelet/bubbletea/tree/master/examples/list-default here @rynowak we can update it going forward in the code as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coolio 👍
// BubbleTeaPrompter contains operation to get user inputs for cli | ||
type BubbleTeaPrompter interface { | ||
// GetTextInput prompts user for a text input | ||
GetTextInput(promptMsg string) (string, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this support a default? Most of our text prompts have one.
Description
This change adds list and text prompts functionality for bubble tea. Changes in the respective commands will be made later.
Issue reference
Fixes: #3947
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list:
Mac:
Windows: