Fuzzy file/directory search and select prompt for Inquirer.js
Register the prompt with inquirer:
inquirer.registerPrompt('fuzzypath', require('inquirer-fuzzy-path'))
Call the prompt:
return inquirer.prompt([
{
type: 'fuzzypath',
name: 'path',
pathFilter: (isDirectory, nodePath) => isDirectory,
// pathFilter :: (Bool, String) -> Bool
// pathFilter allows to filter FS nodes by type and path
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
}
]);
- inquirer - A collection of common interactive command line user interfaces
MIT © adelsz