Socket
Socket
Sign inDemoInstall

file-prompt

Package Overview
Dependencies
259
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

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
19
increased by533.33%
Maintainers
1
Install size
23.2 MB
Created
Weekly downloads
 

Readme

Source

File Prompt Travis 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({ base: process.cwd(), glob: '*.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({ base: process.cwd(), glob: '*.js' })
  .then((files) => {
    // Array of absolute path files
  })
  .catch((e) => {
    // e is an instance of an Error Object that happened along the way.
  })

Config Properties

  • config.base - Absolute path to a base directory to look for files in
  • config.glob - Glob string to filter files from the basedirectory

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.

Credits

This tool was lovingly made for use at VenueBook.

License

BSD-3-Clause (c) 2015 VenueBook, Inc. (https://venuebook.com)

Keywords

FAQs

Last updated on 23 Feb 2016

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