Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-fzf

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-fzf - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

src/main.js

32

bin/cli.js

@@ -9,6 +9,21 @@ #!/usr/bin/env node

const nfzf = require( path.join( __dirname, '../src/index.js' ) )
const nfzf = require( path.join( __dirname, '../src/main.js' ) )
const argv = require( 'minimist' )( process.argv.slice( 2 ) )
const pkgJSON = require( path.join( __dirname, '../package.json' ) )
if ( argv.version || argv.V || argv.v ) {
console.log( 'nfzf version: ' + pkgJSON.version )
process.exit()
}
if ( argv.h || argv.help ) {
const text = fs.readFileSync( path.join( __dirname, '../usage.txt' ), 'utf8' )
console.log( text )
process.exit()
}
const normalMode = ( argv.n || argv.normal || argv.norm )
return run()

@@ -22,3 +37,8 @@

nfzf( files, function ( result ) {
const opts = {
mode: normalMode ? 'normal' : 'fzf',
list: files
}
nfzf( opts, function ( result ) {
if ( result.selected ) {

@@ -34,5 +54,9 @@ console.log( files[ result.selected.index ] )

} else {
// stream piped input to the list
// update list later with input piped from stdin
const opts = {
mode: normalMode ? 'normal' : 'fzf',
list: [] // stdin will update it later
}
const api = nfzf( [], function ( result ) {
const api = nfzf( opts, function ( result ) {
if ( result.selected ) {

@@ -39,0 +63,0 @@ console.log( result.selected.value )

12

package.json
{
"name": "node-fzf",
"version": "0.3.0",
"version": "0.4.0",
"description": "fzf ( junegunn/fzf ) inspired cli utility for node",

@@ -11,6 +11,7 @@ "main": "src/index.js",

"bin/cli.js",
"src/index.js"
"src/main.js",
"usage.txt"
],
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "tape test/test.js"
},

@@ -44,3 +45,6 @@ "keywords": [

},
"devDependencies": {}
"devDependencies": {
"mock-stdin": "~1.0.0",
"tape": "~4.13.0"
}
}

@@ -49,2 +49,6 @@ [![npm](https://img.shields.io/npm/v/node-fzf.svg?maxAge=3600&style=flat-square)](https://www.npmjs.com/package/node-fzf)

}, 1000 )
// if you don't need the api returned by nfzf you can use
// promises to await for the result only
const result = await nfzf( list )
```

@@ -57,12 +61,20 @@

<ctrl-d> scroll down by 10
<ctrl-u> scroll up by 10
<ctrl-d> scroll down by page size
<ctrl-u> scroll up by page size
<ctrl-a> jump to start of input
<ctrl-e> jump to end of input
<esc>,<ctrl-q>,<ctrl-c> cancel
<return>,<ctrl-m> trigger callback with current selection and exit
<return>,<ctrl-m> trigger callback/promise with current selection and exit
<ctrl-w> clear last word (whitespace delimited) from fuzzy search
<ctrl-w> delte last word from input
<backspace> delete last fuzzy search character
<ctrl-b> jump back a word
<ctrl-f> jump forward a word
<backspace> delete last input character
<ctrl-s> switch between modes (fuzzy, normal)
```

@@ -91,2 +103,4 @@

## Test
No tests..
```bash
npm test
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc