Comparing version 0.3.0 to 0.4.0
@@ -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 ) |
{ | ||
"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 | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
29916
5
729
2
104
2
3
1