How to use the inquirer/lib/prompts/base.apply function in inquirer

To help you get started, we’ve selected a few inquirer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mokkabonna / inquirer-autocomplete-prompt / index.js View on Github external
function Prompt() {
  Base.apply(this, arguments);

  if (!this.opt.source) {
    this.throwParamError('source');
  }

  this.currentChoices = [];

  this.firstRender = true;
  this.selected = 0;

  // Make sure no default is set (so it won't be printed)
  this.opt.default = null;

  this.paginator = new Paginator();
}
util.inherits(Prompt, Base);
github DerekTBrown / inquirer-datepicker-prompt / index.js View on Github external
function Prompt() {
  Base.apply(this, arguments);

  // Set Defaults
  this.opt = _.cloneDeep(this.opt);
  _.defaultsDeep(this.opt, {
    date: {
      max: null,
      min: null
    },
    time: {
      max: null,
      min: null,
      hours: {
        interval: 1
      },
      minutes: {
        interval: 1
github nicksrandall / inquirer-directory / index.js View on Github external
function Prompt() {
  Base.apply( this, arguments );

  if (!this.opt.basePath) {
    this.throwParamError("basePath");
  }

  this.depth = 0;
  this.currentPath = path.isAbsolute(this.opt.basePath) ? path.resolve(this.opt.basePath) : path.resolve(process.cwd(), this.opt.basePath);
  this.opt.choices = new Choices(this.createChoices(this.currentPath), this.answers);
  this.selected = 0;

  this.firstRender = true;

  // Make sure no default is set (so it won't be printed)
  this.opt.default = null;

  this.searchTerm = '';
github dylang / npm-check / lib / prompts / alt-checkbox.js View on Github external
function Prompt() {
  Base.apply( this, arguments );

  if (!this.opt.choices) {
    this.throwParamError("choices");
  }

  if ( _.isArray(this.opt.default) ) {
    this.opt.choices.forEach(function( choice ) {
      if ( this.opt.default.indexOf(choice.value) >= 0 ) {
        choice.checked = true;
      }
    }, this);
  }

  this.firstRender = true;
  this.pointer = 0;