Skip to content
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

WIP Prototype using charmbracelet/huh for prompter #166

Draft
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

andyfeller
Copy link
Contributor

@andyfeller andyfeller commented Jun 3, 2024

Relates cli/cli#8084
Relates #164

With go-survey/survey being unmaintained, this is an initial prototype of using https://github.com/charmbracelet/huh as an optional prompting experience including support for accessiblity needs.

Additionally, this commit includes a simple example to demo the existing and new experiences in examples/prompter/main.go:

  • by default, the existing go-survey/survey experience
  • specifying GH_PROMPTER=accessible, the new charmbracelet/huh experience in rich mode
  • specifying ACCESSIBLE=1 with GH_PROMPTER=accessible, the new charmbracelet/huh experience in accessible mode
Screenshare.-.2024-06-03.10_26_38.AM.mp4

Relates cli/cli#8084
Relates #164

With go-survey/survey being unmaintained, this is an initial prototype of using
https://github.com/charmbracelet/huh as an optional prompting experience
including support for accessiblity needs.

Additionally, this commit includes a simple example to demo the existing and
new experiences in `examples/prompter/main.go`:

- by default, the existing go-survey/survey experience
- specifying `GH_PROMPTER=accessible`, the new charmbracelet/huh experience in rich mode
- specifying `ACCESSIBLE=1` with `GH_PROMPTER=accessible`, the new charmbracelet/huh experience in accessible mode
stderr io.Writer
}

func NewAccessiblePrompter(stdin io.Reader, stdout io.Writer, stderr io.Writer) *AccessiblePrompter {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Feedback from @maaslalani : rename this to something like GlamorousPrompter

stderr FileWriter
}

func NewLegacyPrompter(stdin FileReader, stdout FileWriter, stderr FileWriter) *LegacyPrompter {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alternate naming option: GoSurveyPrompter

@@ -32,103 +34,40 @@ type FileReader interface {

// New instantiates a new Prompter.
func New(stdin FileReader, stdout FileWriter, stderr FileWriter) *Prompter {
// TODO: Enhance logic to look at configuration for prompter type.
prompterType := os.Getenv("GH_PROMPTER")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Idea from @maaslalani : what if we forced GH_PROMPTER to the new glamorous prompter experience if ACCESSIBLE=1?

main concern about how the user's experience with 3rd party extensions would play out when they eventually upgrade cli/go-gh but didn't consider the changes 🤔

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

Successfully merging this pull request may close these issues.

1 participant