matchmaker-lib 0.0.3

A fuzzy finder for the terminal, powered by nucleo
Documentation

m&m Crates.io License

Matchmaker is a fuzzy searcher, powered by nucleo and written in rust.

screen1

Features

  • Matching with nucleo.
  • Declarative configuration which can be sourced from a toml file, or overridden using an intuitive syntax for specifying command line options.
  • Interactive preview supports color, scrolling, wrapping, multiple layouts, and even entering into an interactive view.
  • FZF-inspired actions.
  • Column support: Split input lines into multiple columns, that you can dynamically search, filter, highlight, return etc.
  • Available as a rust library to use in your own code.

Library

Matchmaker can also be used as a library.

cargo add matchmaker

Example

Here is how to use Matchmaker to select from a list of strings.

use matchmaker::nucleo::{Indexed, Worker};
use matchmaker::{MatchError, Matchmaker, Result, Selector};

#[tokio::main]
async fn main() -> Result<()> {
    let items = vec!["item1", "item2", "item3"];

    let worker = Worker::new_single_column();
    worker.append(items);
    let selector = Selector::new(Indexed::identifier);
    let mm = Matchmaker::new(worker, selector);

    match mm.pick_default().await {
        Ok(v) => {
            println!("{}", v[0]);
        }
        Err(err) => match err {
            MatchError::Abort(1) => {
                eprintln!("cancelled");
            }
            _ => {
                eprintln!("Error: {err}");
            }
        },
    }

    Ok(())
}

For more information, check out the examples and Architecture.md