Socket
Socket
Sign inDemoInstall

inquirer-file-selector-prompt

Package Overview
Dependencies
34
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    inquirer-file-selector-prompt

File selector interface for inquirer


Version published
Weekly downloads
18
decreased by-58.14%
Maintainers
1
Install size
7.42 MB
Created
Weekly downloads
 

Readme

Source

Inquirer File Selector Prompt

A plugin for Inquirer, allowing users to navigate their file directories to select files.

npm npm

Demo

Installation

npm install --save inquirer-file-selector-prompt

Usage

Register the prompt under any alias you prefer then use the prompt as you would any other inquirer prompt.

inquirer.registerPrompt('file-selector', require('inquirer-file-selector-prompt'));

inquirer.prompt({
  type: 'file-selector',
  ...
})

Options

Takes type, name, message, [filter, validate, default, pageSize, path, extensions, selectionType, onlyShowMatchingExtensions] properties.

The extra options that this plugin provides are:

  • path
    Type: string
    Description: Starting directory for the prompt
    Default: process.cwd()
  • extensions
    Type: Array<string>
    Description: Array of valid extensions to pick from
    Default: [] (any extension)
  • selectionType
    Type: string
    Description: Choose whether to select a file or directory
    Valid options: ["file","folder","either"]
    Default: "file"
  • onlyShowMatchingExtensions
    Type: boolean
    Description: Select whether to hide files that do not match the specified valid extensions
    Default: false

Example

const inquirer = require('inquirer');
const fileSelector = require('./index.js');

inquirer.registerPrompt('file-tree-selection', fileSelector);

inquirer
	.prompt([
		{
			type: 'file-tree-selection',
			name: 'file',
			message: 'choose a file',
			extensions: ['js']
		}
	])
	.then(answers => {
		console.log(JSON.stringify(answers));
	});

License

This project is under the MIT license.

Keywords

FAQs

Last updated on 27 Sep 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc