-
Notifications
You must be signed in to change notification settings - Fork 34
refactor(experiment): move charm huh implementations to iostreams forms package #415
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
+40
β38
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
5d95501
refactor(experiment): move charm/huh implementations to iostreams forβ¦
zimeg cf5d1f7
chore(claude): sort settings
zimeg 36ab47b
chore(claude): add git settings
zimeg 40102fc
chore: merge w main
zimeg 426fe46
chore(claude): rm git mv
zimeg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,7 +14,7 @@ | |
|
|
||
| package iostreams | ||
|
|
||
| // Prompt type definitions shared between survey and charm implementations. | ||
| // Prompts handle flag values and interactive forms for gathering user input. | ||
|
|
||
| import ( | ||
| "context" | ||
|
|
@@ -194,7 +194,7 @@ func errInteractivityFlags(cfg PromptConfig) error { | |
| // the message | ||
| func (io *IOStreams) ConfirmPrompt(ctx context.Context, message string, defaultValue bool) (bool, error) { | ||
| if io.config.WithExperimentOn(experiment.Huh) { | ||
| return charmConfirmPrompt(io, ctx, message, defaultValue) | ||
| return confirmForm(io, ctx, message, defaultValue) | ||
| } | ||
| return surveyConfirmPrompt(io, ctx, message, defaultValue) | ||
| } | ||
|
|
@@ -203,7 +203,7 @@ func (io *IOStreams) ConfirmPrompt(ctx context.Context, message string, defaultV | |
| // optionally be made required | ||
| func (io *IOStreams) InputPrompt(ctx context.Context, message string, cfg InputPromptConfig) (string, error) { | ||
| if io.config.WithExperimentOn(experiment.Huh) { | ||
| return charmInputPrompt(io, ctx, message, cfg) | ||
| return inputForm(io, ctx, message, cfg) | ||
| } | ||
| return surveyInputPrompt(io, ctx, message, cfg) | ||
| } | ||
|
|
@@ -212,7 +212,7 @@ func (io *IOStreams) InputPrompt(ctx context.Context, message string, cfg InputP | |
| // returns the selected values | ||
| func (io *IOStreams) MultiSelectPrompt(ctx context.Context, message string, options []string) ([]string, error) { | ||
| if io.config.WithExperimentOn(experiment.Huh) { | ||
| return charmMultiSelectPrompt(io, ctx, message, options) | ||
| return multiSelectForm(io, ctx, message, options) | ||
| } | ||
| return surveyMultiSelectPrompt(io, ctx, message, options) | ||
| } | ||
|
|
@@ -230,7 +230,7 @@ func (io *IOStreams) PasswordPrompt(ctx context.Context, message string, cfg Pas | |
| } | ||
|
|
||
| if io.config.WithExperimentOn(experiment.Huh) { | ||
| return charmPasswordPrompt(io, ctx, message, cfg) | ||
| return passwordForm(io, ctx, message, cfg) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. praise: These read very well! |
||
| } | ||
| return surveyPasswordPrompt(io, ctx, message, cfg) | ||
| } | ||
|
|
@@ -258,7 +258,7 @@ func (io *IOStreams) SelectPrompt(ctx context.Context, msg string, options []str | |
| } | ||
|
|
||
| if io.config.WithExperimentOn(experiment.Huh) { | ||
| return charmSelectPrompt(io, ctx, msg, options, cfg) | ||
| return selectForm(io, ctx, msg, options, cfg) | ||
| } | ||
| return surveySelectPrompt(io, ctx, msg, options, cfg) | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
π note: This has the callout of prompts I'd like to make! I'm hoping we can improve how flags are parsed in prompts with the thinking that prompts have option for a flag value or form interactive input.
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.
This sounds like a healthy improvement opportunity for how we handle forms and flags. The first iteration has treated us well, but I agree that there is room for improvement!