Skip to content

hankchanocd/npm-fzf

Repository files navigation

npm-fzf    npm Build Status Commitizen friendly Known Vulnerabilities Github issues

Fuzzy search npm modules with fzf

npm-fzf, also called npf, fuzzy search npm modules with fzf, creating a more fulfilling search experience at terminal.

Requirements

(Must): npf requires Node 8 for runtime or above.

(Highly Recommended): fzf is used heavily by npf. If fzf is not installed, npf will default to a much less capable sibling, node-fzf - fzf's implementation in Node.

CLI

$ npm install -g npm-fzf

Usage

Usage: npf [option] [name]

Fuzzy search npm modules with fzf

Options:
  -v, --version     output the version number

# Feature flags
  -l, --local       list local dependencies, which is also the default feature
  -g, --global      list global modules
  -t, --time        show the latest global installs
  -s, --scripts     list/execute npm scripts

# Flavor flags
  -d, --details     include details to each dependency, but disable the default fuzzy mode
  -a, --all         a flavor flag that shows all available information on any feature flag
  -P, --no-preview  disable the default fzf preview mode
  -F, --no-fuzzy    disable the default fuzzy mode and resort to stdout

  -h, --help        output usage information

Examples

Global modules

$ npf -g

Recent global installs

A quick refresher on what the heck it's installed/upgraded globally in the recent past

$ npf -t

Execute module's npm scripts

$ npf -s

Fetch from NPM registry

Fetch the module's latest version by default, unless a version is specified

$ npf express

Turn off preview mode

Preview mode uses fzf --preview underneath and is turned on in most cases by default. You can also opt for --no-preview to turn off the default preview mode.

$ npf -t --no-preview
$ npf -g --no-preview
$ npf -l --no-preview
$ npf express --no-preview

Turn off fuzzy mode

Fuzzy mode is by default on. You can also opt for --no-fuzzy to turn it off.

$ npf -t --no-fuzzy
$ npf -g --no-fuzzy

Details flag

Applied to both local dependencies and global installs

$ npf --details
$ npf -g --details

Tests

To perform unit tests and integration tests, simply run npm test. (Need Help)

Changelog

2018-Nov-15: v1 published.

Contribution

If you have a suggestion, leave it in Issues for discussion first. I will reply in no more than 3 days. See here on how to contribute.

fzf empowers many features that would otherwise be hard to imagine. If you haven't of fzf, check out junegunn's fzf. Check out my Dotfiles to see more use cases of fzf.

License

MIT