speajus-inquirer-directory-fork

2.3.1 • Public • Published

inquirer-directory

Relative Directory prompt for inquirer

Build Status

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:

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 readme for meaning of all except basePath.

basePath is the relative path from your current working directory

Example

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)
});

asciicast

See also example.js for a working example

To select files and directories.

//registering it as type file allows files to be selected.
inquirer.registerPrompt('file', require('inquirer-directory'));
inquirer.prompt([{
  type: 'file',
  name: 'from',
  message: 'Where you like to put this component?',
  basePath: './src'
}]).then(function(answers) {
  // (answers.from is the path chosen)
});

License

MIT

Package Sidebar

Install

npm i speajus-inquirer-directory-fork

Weekly Downloads

2

Version

2.3.1

License

MIT

Unpacked Size

349 kB

Total Files

16

Last publish

Collaborators

  • speajus