refactor(Paginator): extract filtering of text input into Func#275
Draft
brianebeling wants to merge 1 commit intoshibayan:masterfrom
Draft
refactor(Paginator): extract filtering of text input into Func#275brianebeling wants to merge 1 commit intoshibayan:masterfrom
brianebeling wants to merge 1 commit intoshibayan:masterfrom
Conversation
Adds a new constructor parameter that accepts a function for filtering text input (i.e. how text is filtered when typing into a Select or MultiSelect Prompt). This allows developers to override the default behavior (.Contains(keyword)) with custom behavior such as fuzzy matching. This helps with long inputs, where you may have multiple items in your strings but are unsure about the order or exact input.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds a new constructor parameter that accepts a function for filtering text input (i.e. how text is filtered when typing into a Select or MultiSelect Prompt). This allows developers to override the default behavior (in this case
.Contains(keyword)) with custom behavior such as fuzzy matching. This helps with long inputs, where you may have multiple keywords or matches in your string but are unsure about the order or exact input.Motivation
I wanted to use Sharprompt to develop an internal tool, where I wanted to prompt the user to select one or multiple work items from a DevOps board. Sometimes it helps to filter with a text input such as "deliv closed" to match the row "Title: Delivery Menu, Type: User Story, State: Closed" or similar. For my own use case I would like a fuzzy match akin to
fzfbut was unable to implement that because the behavior is hardcoded into thepaginator.The PR may not be perfect, so I created it as a draft. What are your thoughts on this?