Comparing version 0.12.0 to 0.13.1
@@ -24,3 +24,3 @@ #!/usr/bin/env node | ||
const normalMode = ( argv.n || argv.normal || argv.norm || argv.exact) | ||
const normalMode = ( argv.n || argv.normal || argv.norm || argv.e || argv.exact) | ||
@@ -41,2 +41,4 @@ return run() | ||
query: argv.query || argv.q, | ||
selectOne: argv['1'] || argv['select-1'] || argv['select-one'], | ||
height: argv.height, | ||
@@ -64,2 +66,4 @@ keepRight: !!argv['keep-right'], | ||
query: argv.query || argv.q, | ||
selectOne: argv['1'] || argv['select-1'] || argv['select-one'], | ||
height: argv.height, | ||
@@ -69,3 +73,3 @@ keepRight: !!argv['keep-right'], | ||
opts._selectOneActive = false | ||
const api = nfzf( opts, function ( result ) { | ||
@@ -117,2 +121,3 @@ if ( result.selected ) { | ||
api._selectOneActive = true | ||
api.update( list ) | ||
@@ -119,0 +124,0 @@ } ) |
{ | ||
"name": "node-fzf", | ||
"version": "0.12.0", | ||
"version": "0.13.1", | ||
"description": "fzf ( junegunn/fzf ) inspired cli utility for node", | ||
@@ -5,0 +5,0 @@ "main": "src/main.js", |
[![npm](https://img.shields.io/npm/v/node-fzf.svg?maxAge=3600&style=flat-square)](https://www.npmjs.com/package/node-fzf) | ||
[![npm](https://img.shields.io/npm/dm/node-fzf.svg?maxAge=3600)](https://www.npmjs.com/package/node-fzf) | ||
[![npm](https://img.shields.io/npm/l/node-fzf.svg?maxAge=3600&style=flat-square)](https://github.com/talmobi/node-fzf/blob/master/LICENSE) | ||
![mac](https://github.com/talmobi/node-fzf/actions/workflows/macos-node.js.yml/badge.svg?branch=master) | ||
![ubuntu](https://github.com/talmobi/node-fzf/actions/workflows/ubuntu-node.js.yml/badge.svg?branch=master) | ||
![windows](https://img.shields.io/badge/windows-unable%20to%20test%20automatically-yellow?style=flat) | ||
# node-fzf | ||
@@ -45,5 +50,10 @@ [fzf](https://github.com/junegunn/fzf) inspired fuzzy CLI list selection 🎀 | ||
// prefill user input | ||
prefill: '', | ||
query: '', | ||
/* (optional) */ | ||
// If there is only one match for the initial query (--query), do not | ||
// start interactive finder and automatically select the only match | ||
selectOne: false, | ||
/* (optional) */ | ||
// % of screen to use to display results (minimum/defaults to 6 rows) | ||
@@ -50,0 +60,0 @@ height: 0, // ex: 40 for 40%, 100 for 100% |
@@ -852,2 +852,4 @@ // Gracefully restore the CLI cursor on exit | ||
cleanDirtyScreen() | ||
if (_opts._selectOneActive === undefined) _opts._selectOneActive = true | ||
} | ||
@@ -985,2 +987,12 @@ render.init = true | ||
if (_opts._selectOneActive && _matches.length === 1 && _opts.selectOne ) { | ||
// console.log(' === attempting to select one === ') | ||
_selectedItem = _matches[ 0 ] | ||
cleanDirtyScreen() | ||
process.nextTick(function () { | ||
handleKeypress( '', { name: 'return' } ) | ||
}) | ||
} | ||
_opts._selectOneActive = false | ||
// print the matches | ||
@@ -987,0 +999,0 @@ _printedMatches = 0 |
@@ -7,2 +7,5 @@ Usage: nfzf [options] | ||
-q, --query Start search with the given query prefilled. | ||
-1, --select-1 If there is only one match for the initial query | ||
(--query), do not start interactive finder and | ||
automatically select the only match | ||
--keep-right Fit to show end of result text (toggled with ctrl-e) | ||
@@ -9,0 +12,0 @@ --height % of screen space to use to for results (default 6 rows) |
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
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
43805
1003
184