gulp-autocomplete-prompt

0.1.0 • Public • Published

gulp-autocomplete-prompt NPM version NPM downloads

Autocomplete prompt for choosing a file to write.

Install

Install with npm:

$ npm install --save gulp-autocomplete-prompt

Usage

var autocomplete = require('gulp-autocomplete-prompt');
 
gulp.src('*.js')
  .pipe(autocomplete())
  .pipe(dest('dist/'));

Example

This is used in generate-gitignore if you want to see a live example.

app.task('gitignore-global', function() {
  return app.src('templates/*.gitignore', { cwd: __dirname })
    .pipe(autocomplete({key: 'stem', basename: '.gitignore'}))
    .pipe(app.dest(app.cwd));
});

Options

key

Type: String

Default: relative

The vinyl file path property to use when displaying the list of files in the terminal.

Example

autocomplete({key: 'stem'})

choice

Type: String

Default: undefined

Programmatically choose the file to render to avoid prompts. The provide name should match the file property based on the specified key.

Example

autocomplete({choice: 'foo'})

skip

Type: Boolean

Default: undefined

Skip a file from being displayed in the list of choices.

Example

autocomplete({skip: 'foo'})
 
// or in another plugin
through.obj(function(file, enc, next) {
  if (file.stem === 'foo') file.skip = true;
  next(null, file);
});

rename

Type: Object

Default: undefined

Rename the destination file using the string values on options.rename. If you need something more sophisticated there are other gulp plugins dedicated to this.

Example

autocomplete({skip: 'foo', rename: '.gitignore'})

Filter

Type: Function

Default:

function filter(str, name) {
  return new RegExp(str, 'i').test(name);
}

Description

Filter function that takes the current search string, top search result, and array of file names as arguments.

Example

autocomplete({
  filter: function(str, name) {
    return new RegExp(str, 'i').test(name);
  }
});

About

Related projects

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Building docs

(This document was generated by verb-generate-readme (a verb generator), please don't edit the readme directly. Any changes to the readme must be made in .verb.md.)

To generate the readme and API documentation with verb:

$ npm install -g verb verb-generate-readme && verb

Running tests

Install dev dependencies:

$ npm install -d && npm test

Author

Jon Schlinkert

License

Copyright © 2016, Jon Schlinkert. Released under the MIT license.


This file was generated by verb-generate-readme, v0.1.30, on August 11, 2016.

Package Sidebar

Install

npm i gulp-autocomplete-prompt

Weekly Downloads

9

Version

0.1.0

License

MIT

Last publish

Collaborators

  • jonschlinkert