https://github.com/adelsz/inquirer-fuzzy-path
Fuzzy file/directory search and select prompt for Inquirer.js
https://github.com/adelsz/inquirer-fuzzy-path
directory-tree file-tree fuzzy-search inquirer prompt
Last synced: 2 months ago
JSON representation
Fuzzy file/directory search and select prompt for Inquirer.js
- Host: GitHub
- URL: https://github.com/adelsz/inquirer-fuzzy-path
- Owner: adelsz
- License: mit
- Created: 2018-05-20T16:54:00.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-07-31T03:37:14.000Z (10 months ago)
- Last Synced: 2024-11-24T17:34:14.001Z (7 months ago)
- Topics: directory-tree, file-tree, fuzzy-search, inquirer, prompt
- Language: JavaScript
- Size: 166 KB
- Stars: 89
- Watchers: 2
- Forks: 20
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# inquirer-fuzzy-path
[](https://www.npmjs.com/package/inquirer-fuzzy-path)
[](https://www.npmjs.com/package/inquirer-fuzzy-path)Fuzzy file/directory search and select prompt for Inquirer.js

## Usage
Register the prompt with inquirer:
```javascript
inquirer.registerPrompt('fuzzypath', require('inquirer-fuzzy-path'))
```Call the prompt:
```javascript
return inquirer.prompt([
{
type: 'fuzzypath',
name: 'path',
excludePath: nodePath => nodePath.startsWith('node_modules'),
// excludePath :: (String) -> Bool
// excludePath to exclude some paths from the file-system scan
excludeFilter: nodePath => nodePath == '.',
// excludeFilter :: (String) -> Bool
// excludeFilter to exclude some paths from the final list, e.g. '.'
itemType: 'any',
// itemType :: 'any' | 'directory' | 'file'
// specify the type of nodes to display
// default value: 'any'
// example: itemType: 'file' - hides directories from the item list
rootPath: 'app',
// rootPath :: String
// Root search directory
message: 'Select a target directory for your component:',
default: 'components/',
suggestOnly: false,
// suggestOnly :: Bool
// Restrict prompt answer to available choices or use them as suggestions
depthLimit: 5,
// depthLimit :: integer >= 0
// Limit the depth of sub-folders to scan
// Defaults to infinite depth if undefined
}
]);
```## Change log
* In version 2.2.0 new option `excludeFilter` was added.
* In version 2.1.0 new option `depthLimit` was added.
* In version 2.0.0 option `filterPath` was deprecated. Please use `excludePath` and `itemType` instead.## Related
- [inquirer](https://github.com/SBoudrias/Inquirer.js) - A collection of common interactive command line user interfaces
## License
MIT © [adelsz](https://github.com/adelsz)