Socket
Socket
Sign inDemoInstall

file-prompt

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

file-prompt

An interactive prompt for selecting files from a directory.


Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

File Prompt [Travis][build] npm package

An interactive prompt for files inspired by git add -i. By supplying a filter and a base directory and calling the fileprompt function you can interactively select from a list of matching files in a number of ways intended to speed up typing time trying to guess and remember paths. This tool can be used with Gulp to send a list of files to gulp.src.

Screencast of file prompt in action

Installation

Using npm:

$ npm install expect

Usage

In ES6:

import fileprompt from 'fileprompt'

fileprompt({ basedir: process.cwd(), filter: '*.js' })
  .then((files) => {
    // Array of absolute path files
  })
  .catch((e) => {
    // e is an instance of an Error Object that happened along the way.
  })

In ES5:

var fileprompt = require('fileprompt');

fileprompt({ basedir: process.cwd(), filter: '*.js' })
  .then((files) => {
    // Array of absolute path files
  })
  .catch((e) => {
    // e is an instance of an Error Object that happened along the way.
  })

Input

The following methods of input are currently supposed:

Main Menu

  • {int} id - Number of the menu item to access
  • {string} name - Must uniquely identify the beginning of a menu item

Files

  • {string} * - Adds all files from the current page
  • {string} -* - Removes all files from the current page
  • {int} id - Number of the menu item to access
  • {string} name - Must uniquely identify the beginning of a file name
  • {string} n-n - Supports numeric ranges like 1-5
  • {string} -n-n - Supports removing files within the given range

You can also supply multiple arguments like 4 5-10 -8 and it will do the following:

  • Selected item # 4
  • Select items # 5 through 10
  • Unselect file # 8

Supported Features

Currently the following features are supported

Browing Directories

Lets you add files by entering directories and selecting files. Pressing <enter> will return to the main menu.

Files

Lists all levels of files matching the supplied filter. Pressing <enter> will return to the main menu.

Glob

Asks for a glob string such as **/*.js. If matches are found it will allow you to select from the list of matching files. Pressing <enter> will return to the main menu.

Changed Files

Executes git diff --name-only to get a list of files changed since the last git commit. Pressing <enter> will return to the main menu.

[build]: https://travis-ci.org/jayzawrotny/file-prompt)

Credits

This tool was lovingly made for use at VenueBook.

Keywords

FAQs

Package last updated on 25 Nov 2015

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc