https://github.com/nicksrandall/inquirer-directory
a directory (relative to given path) selector for Inquirer.js
https://github.com/nicksrandall/inquirer-directory
inquirer
Last synced: 3 months ago
JSON representation
a directory (relative to given path) selector for Inquirer.js
- Host: GitHub
- URL: https://github.com/nicksrandall/inquirer-directory
- Owner: nicksrandall
- Created: 2015-12-10T17:26:14.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-05-10T02:52:06.000Z (about 4 years ago)
- Last Synced: 2024-09-18T01:17:39.400Z (9 months ago)
- Topics: inquirer
- Language: JavaScript
- Size: 2.92 MB
- Stars: 42
- Watchers: 2
- Forks: 20
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# inquirer-directory
Relative Directory prompt for [inquirer](https://github.com/SBoudrias/Inquirer.js)
[](https://travis-ci.org/nicksrandall/inquirer-directory)
## Installation
```
npm install --save inquirer-directory
```## Features
- Support for symlinked files
- Vim style navigation
- Search for file with "/" key### Key Maps
- Press "/" key to enter search mode.
- Press "-" key to go up (back) a directory.## Usage
This prompt is anonymous, meaning you can register this prompt with the type name you please:
```javascript
inquirer.registerPrompt('directory', require('inquirer-directory'));
inquirer.prompt({
type: 'directory',
...
})
```Change `directory` to whatever you might prefer.
### Options
Takes `type`, `name`, `message`, `basePath` properties.
See [inquirer](https://github.com/SBoudrias/Inquirer.js) readme for meaning of all except **basePath**.
**basePath** is the relative path from your current working directory
#### Example
```javascript
inquirer.registerPrompt('directory', require('inquirer-directory'));
inquirer.prompt([{
type: 'directory',
name: 'from',
message: 'Where you like to put this component?',
basePath: './src'
}]).then(function(answers) {
// (answers.from is the path chosen)
});
```[](https://asciinema.org/a/31651)
See also [example.js](https://github.com/nicksrandall/inquierer-directory/blob/master/example.js) for a working example
## License
MIT