Package Exports
- inquirer-file-tree-selection-prompt
- inquirer-file-tree-selection-prompt/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (inquirer-file-tree-selection-prompt) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Inquirer File Tree Selection Prompt
QuickDemo
Install
npm install inquirer-file-tree-selection-prompt
Usage
inquirer.registerPrompt('file-tree-selection', inquirerFileTreeSelection)
inquirer.prompt({
type: 'file-tree-selection',
...
})
Options
Takes type
, name
, message
, [filter
, validate
, transformer
, default
, pageSize
, onlyShowDir
, onlyShowValid
, hideChildrenOfValid
, root
, hideRoot
, multiple
] properties.
The extra options that this plugin provides are:
onlyShowDir
: (Boolean) if true, will only show directory. Default: false.root
: (String) it is the root of file tree. Default: process.cwd().onlyShowValid
: (Boolean) if true, will only show valid files (ifvalidate
is provided). Default: false.hideChildrenOfValid
: (Boolean) if true, will hide children of valid directories (ifvalidate
is provided). Default: false.transformer
: (Function) a hook function to transform the display of directory or file name.multiple
: (Boolean) if true, will enable to select multiple files. Default: false.
When multiple
is enabled, default
should be string[]
type, otherwise it's string
type.
Typescript Support
version >= 1.0.16
Install
@types/inquirer
Ensure you have registered with
file-tree-selection
inquirer.registerPrompt('file-tree-selection', inquirerFileTreeSelection)
- And you will get type support when you code in IDE
Example
const inquirer = require('inquirer')
const inquirerFileTreeSelection = require('inquirer-file-tree-selection-prompt')
inquirer.registerPrompt('file-tree-selection', inquirerFileTreeSelection)
inquirer
.prompt([
{
type: 'file-tree-selection',
name: 'file'
}
])
.then(answers => {
console.log(JSON.stringify(answers))
});