node-peco
v0.1.6
Published
Peco (Simplistic interactive filtering tool) NodeJS Binding
Maintainers
Readme
Node Peco
peco nodejs binding library
NOTE: external command
pecois required. see peco installation
Installation
yarn add node-pecoUsage
This package exports only one function named peco.
import { peco } from 'node-peco'; // or require('node-peco');
peco(['foo', 'bar', 'baz']).then(selected => console.log(selected));You can pass option as a second argument
import { peco, PecoOption } from 'node-peco';
const pecoOption: PecoOption = {
onCancel: 'reject',
layout: 'bottom-up',
selectionPrefix: '*',
prompt: "Choose ->",
};
peco(['foo', 'bar', 'baz'], pecoOption).then(selected => console.log(selected));for more examples, see examples
Option
There are two categories of option. One is js dependent:
key | type | description | default
--- | ---- | ----------- | -------
bin | string | peco binary command(or location path) | "peco"
onCancel | "reject" \| "skip" | specify behavior when received SIGINT | "skip"
onError | "reject" \| "exit" | specify behavior when peco exited with non-zero code | "exit"
The other is peco command line option. See peco#command-line-options
