Make lists searchable and add key mapping to README.md#20
Conversation
Codecov Report
@@ Coverage Diff @@
## master #20 +/- ##
==========================================
- Coverage 32.40% 31.01% -1.39%
==========================================
Files 5 5
Lines 179 187 +8
==========================================
Hits 58 58
- Misses 109 117 +8
Partials 12 12
Continue to review full report at Codecov.
|
| srcs := toSlice(sources) | ||
| prompt := promptui.Select{Label: "Select Source", Items: append(srcs, Resource{"Finished", "no more resources to move"}), Templates: srcTempl} | ||
| srcSearcher := func(input string, index int) bool { | ||
| if index >= len(srcs) { |
There was a problem hiding this comment.
If I understand https://github.com/manifoldco/promptui/blob/master/list/list.go#L82 correctly, this check might be a bit defensive - what do you think?
If we need it here, should we also add a corresponding check in destSearcher below?
There was a problem hiding this comment.
We only need it because of the additional Resource{"Finished", "no more resources to move"} item that's added to the end of the list.
There was a problem hiding this comment.
I see, thanks for the explanation!
|
Great idea, thank you very much for the contribution! |
|
Has been released in 0.4.0. |
This PR enables the search functionality of promptui.Select.
strings.Contains(address, searchTerm).README.md.