file-prompt v1.2.2
File Prompt

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
.
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)
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago