Swift Terminal Fuzzy Finder
tui-fuzzy-finder is a fzf style text UI fuzzy finder library in Swift. It lists the contents
of an asynchronous stream in the terminal, one item per line. The user can select one or multiple
items from the list and use fuzzy search to filter the list, and when they press return,
tui-fuzzy-finder returns the list of the selected items.
Demo
Why
fzf is a fantastic tool, but if you're not into shell scripting, it can be be a drag. This library
aims to provide the core functionality of fzf in a Swift library, so you can write your tools
in Swift.
Because tui-fuzzy-finder is in Swift and runs inside your code, you can use use any normal Swift values
for the list, as long as they conform to CustomStringConvertible. You can even make them display
ANSI escape sequences.
What is included
tui-fuzzy-finder consists of a Swift library and an executable, sfzf, that uses it. The purpose
of sfzf is to make it easy to excercise the tui-fuzzy-finder features that are difficult to test
automatically. It does not try to compete with fzf.
Documentation
Documentation is available at the Swift Package Index.
Command line usage
To build and install the executable run swift build -c release, then copy .build/release/sfzf
somewhere on your path.
Run sfzf --help to get information about command line arguments.
While the program is running:
- Move up and down with arrows
- Edit the filter line with normal line-editing commands
- Toggle selection with tab
- Press return to exit and write the selected lines to stdout
Goals
- Sufficient coverage of
fzffeatures. - Fast enough.
Stretch goals
- Good platform coverage. PRs are welcome where it falls short.
Non-goals
- Replacing
fzfas a shell tool. - Supporting the
fzffeatures that only make sense in the shell scripting context.