fzf-node
v0.1.3
Published
Node.js bindings for the golang fzf fuzzy finder
Downloads
11
Maintainers
Readme
fzf-node
Node.js bindings for the golang fzf fuzzy finder.
Installation
pnpm add fzf-node
# or
npm install fzf-node
# or
yarn add fzf-node
Usage
import { fzf } from 'fzf-node'
// Run `man fzf` in your shell to see all available fzf options
const fzfOptions = ['--multi', '--preview-window=up', '--preview', 'echo {}']
const selections = ['Pen ✒️', 'Pineapple 🍍', 'Apple 🍎', 'Pen ✒️']
const selection = await fzf(selections, fzfOptions)
// Do something with selection
console.log(selection)
API
fzf(selections: string[], options?: OptionType[])
Runs fzf as a child process with the specified options and returns the selected item(s).
Return type
Promise<T extends '--multi' ? string[] : string>
If the --multi
fzf option is provided to options?: OptionType[]
then fzf
will return Promise<string[]>
otherwise it will return Promise<string>
.