-
Notifications
You must be signed in to change notification settings - Fork 13
feat: use tab to toggle, add final step #50
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
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9848397
Make styling consistent
18e1dc4
Update title punctuation and capitalization
5dc7a94
Add border around rendered markdown
3cd6b5d
use tab to toggle flag, add final congrats step
94f41da
update wizard
e50b117
merge main
617ef45
quit when we've run out of models
0ac9fc1
no emojis :(
38daa3c
add placeholder cta to final step
79361e9
different placeholder text
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ import ( | |
|
|
||
| "github.com/charmbracelet/bubbles/key" | ||
| tea "github.com/charmbracelet/bubbletea" | ||
| "github.com/muesli/reflow/wordwrap" | ||
| ) | ||
|
|
||
| // TODO: we may want to rename this for clarity | ||
|
|
@@ -102,7 +103,10 @@ func (m WizardModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { | |
| case flagToggleStep: | ||
| updatedModel, _ := m.steps[flagToggleStep].Update(msg) | ||
| m.steps[flagToggleStep] = updatedModel | ||
| m.currStep += 1 | ||
| default: | ||
| return m, tea.Quit | ||
|
Contributor
Author
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. if we're here that means we're done! will prevent out of index errors |
||
|
|
||
| } | ||
| case key.Matches(msg, keys.Back): | ||
| // only go back if not on the first step | ||
|
|
@@ -130,14 +134,19 @@ func (m WizardModel) View() string { | |
| return fmt.Sprintf("ERROR: %s", m.err) | ||
| } | ||
|
|
||
| if m.currStep > flagToggleStep { | ||
| return wordwrap.String("\nCongratulations! You’ve just used feature flags to control how your application works, without having to rebuild or redeploy your application.\n\nNow that you’re set up with your first feature flag, let’s make it easier to manage your flags collaboratively with your team. <Instructions will go here>", m.width) | ||
| } | ||
|
|
||
| return fmt.Sprintf("\nStep %d of %d\n"+m.steps[m.currStep].View(), m.currStep+1, len(m.steps)) | ||
| } | ||
|
|
||
| type keyMap struct { | ||
| Back key.Binding | ||
| Enter key.Binding | ||
| Help key.Binding | ||
| Quit key.Binding | ||
| Back key.Binding | ||
| Enter key.Binding | ||
| Help key.Binding | ||
| Quit key.Binding | ||
| Toggle key.Binding | ||
| } | ||
|
|
||
| var keys = keyMap{ | ||
|
|
@@ -157,4 +166,8 @@ var keys = keyMap{ | |
| key.WithKeys("ctrl+c", "q"), | ||
| key.WithHelp("q", "quit"), | ||
| ), | ||
| Toggle: key.NewBinding( | ||
| key.WithKeys("tab"), | ||
| key.WithHelp("tab", "toggle"), | ||
| ), | ||
| } | ||
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.
increment here on enter so we can see the final text