Comments (2)
Hey, thanks for your feedback and sorry for the late reply. I'm not sure I understand you correctly, but as far as I can tell the examples are correct but you are using another version of the library locally. I'd like to give some context on the issue because it could be confusing for other people, too.
When I started writing the library I knew that a nice API for selection prompts would profit a lot from generics, but Go 1.18 was delayed, so I initially used the abstraction []*selection.Choices
. However, I planned to change the API as soon as generics were available, that's also why I put a disclaimer in the README. Currently, the latest tagged version v0.7.0
still uses the abstraction.
The main
branch, however, is already update to utilize generics. I'm guessing your problem is that go get github.com/erikgeiser/promptkit
fetches the latest tagged version (v0.7.0
with []*selection.Choices
) instead of the current state of the main
branch, but when you look at the examples on Github, you already see the newer, untagged version with generics.
The reason I haven't tagged a new release yet is that I currently have little time and I want to help a few of the bigger projects that use promptkit
to migrate by creating PRs because I want to avoid that they are put off by unexpected API changes. I haven't found the time to do that, yet.
The Fix:
If you are already using Go 1.18 or newer, you can use the latest, untagged version of promptkit with generics by specifying that you want to fetch the main branch like this:
go get github.com/erikgeiser/promptkit@main
If you are using an earlier Go version you can look at the examples at the snapshot of the currently tagged version v0.7.0
here:
https://github.com/erikgeiser/promptkit/tree/912fe7f8487dabfb392d159b9e5cb28a0f7e252e
I'm leaving this issue open so other people with the same problem can easily find it.
from promptkit.
I have now tagged and released a new version which fixes the mismatch between documentation and latest released version.
from promptkit.
Related Issues (15)
- Multiple Selections HOT 8
- Integrate with bubbletea HOT 5
- Update preview clips in README
- Choices example not refactored HOT 2
- Tests fail with github.com/muesli/termenv v0.13.0 HOT 3
- Init page of paged choices are in a weird order
- Latest bubbles break promptkit HOT 5
- error: running prompt: unable to set console to raw mode: HOT 3
- selection.New(selection.Choice[T]) doesn't work HOT 7
- can't use confirmation prompt as a bubbletea model HOT 6
- selection widget fails silently on empty choice list
- request: add text area HOT 1
- Is README outdated on Windows support? HOT 2
- Allow to browse suggestions in textinput
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from promptkit.