erikgeiser/promptkit
### [`v0.8.0`](https://togithub.com/erikgeiser/promptkit/releases/tag/v0.8.0)
[Compare Source](https://togithub.com/erikgeiser/promptkit/compare/v0.7.0...v0.8.0)
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](https://togithub.com/erikgeiser/promptkit/blob/dc4c610a40ec004ef128a2bb067deffcfb25760d/examples/selection_custom/main.go#L62) 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
```go
// before
selection.New("What do you pick?", selection.Choices([]string{"Horse", "Car", "Plane", "Bike"}))
```
they are now passed directly like this:
```go
// 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
```go
// before
selected, err := sp.RunPrompt()
fmt.Println(selected.Value)
```
It can now be directly used instead:
```go
// 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](https://togithub.com/erikgeiser/promptkit/blob/dc4c610a40ec004ef128a2bb067deffcfb25760d/examples/selection_custom/main.go) in which these properties are used.
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
[ ] If you want to rebase/retry this PR, check this box
This PR has been generated by Mend Renovate. View repository job log here.
This PR contains the following updates:
v0.7.0
->v0.8.0
Release Notes
erikgeiser/promptkit
### [`v0.8.0`](https://togithub.com/erikgeiser/promptkit/releases/tag/v0.8.0) [Compare Source](https://togithub.com/erikgeiser/promptkit/compare/v0.7.0...v0.8.0) 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](https://togithub.com/erikgeiser/promptkit/blob/dc4c610a40ec004ef128a2bb067deffcfb25760d/examples/selection_custom/main.go#L62) 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 ```go // before selection.New("What do you pick?", selection.Choices([]string{"Horse", "Car", "Plane", "Bike"})) ``` they are now passed directly like this: ```go // 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 ```go // before selected, err := sp.RunPrompt() fmt.Println(selected.Value) ``` It can now be directly used instead: ```go // 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](https://togithub.com/erikgeiser/promptkit/blob/dc4c610a40ec004ef128a2bb067deffcfb25760d/examples/selection_custom/main.go) in which these properties are used.Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate. View repository job log here.