As mentioned before, v0.8.0 introduces a breaking change by rewriting the selection prompt to use generics, but there are also a few other changes.
Changelog:
selection: The selection prompt now utilizes generics such that the choices don't have to be wrapped in Choice objects anymore and now the actual value of the the selected choice is returned. Migration instructions can be found below.
selection: A new option called LoopCursor was added. If enabled, the cursor now jumps to the top when pressing 'down' on the last entry and the other way around. See the custom selection prompt example for information on how to use it.
Fixed an issue where the wrong color profile was applied.
All dependencies were updated.
Migration:
When creating the selection prompt, instead of wrapping the choices like this
// before
selection.New("What do you pick?", selection.Choices([]string{"Horse", "Car", "Plane", "Bike"}))
they are now passed directly like this:
// now
selection.New("What do you pick?", []string{"Horse", "Car", "Plane", "Bike"})
The result is now directly returned, so instead of unwrapping the value from the choice object like this
// before
selected, err := sp.RunPrompt()
fmt.Println(selected.Value)
It can now be directly used instead:
// now
selected, err := sp.RunPrompt()
fmt.Println(selected)
selection.Model now can return both the selected choice in wrapped and unwrapped from with Model.Value() and Model.ValueAsChoice().
Some of the function properties of the selection prompt such as Filter or SelectedChoiceStyle now have a slightly different signature. Take a look at the custom selection example in which these properties are used.
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Bumps github.com/erikgeiser/promptkit from 0.7.0 to 0.8.0.
Release notes
Sourced from github.com/erikgeiser/promptkit's releases.
Commits
dc4c610
Fix linter issues9a4a463
Fix linter issues8f089ac
Update dependencies00954b6
Fix badges1f33bc7
Remove parts of the disclaimer880603f
Remove unnecessary linter directives63039da
Update golangci-lint1d65b22
Update dependencies1fa7654
Don't export choices variable and make choice index read-onlyf8cc536
Rewrite selection prompt to use genericsDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)