inquiry-traverser

0.4.0 • Public • Published

inquiry-traverser

npm version dependencies dev dependencies peer dependencies

A Promise based wrapper for prompting branched questions with Inquirer.js and alternatives using the same API, such as inquirer-shortcuts

Documentation

Installation

$ npm install inquiry-traverser
var inquirer = require('inquirer');
var traverser = require('inquiry-traverser');
 
var traverse = traverser(inquirer);
 
traverse({ /* Put your branched questions object here */ })
  .then(function onResolve (value) {
    // Handle a successfull resolution ...
  })
  .catch(function onReject (reason) {
    // Handle a rejection ...
  });

Examples

Check the examples folder, run the scripts, e.g.

$ node examples/basic-usage.js

The basic-usage example shows the use of prompts of type confirm, the module's redirection feature and provokes a rejection on the second prompt due to a missing resolution of one of its results.
The advanced-usage example uses prompts of type list, rawlist and expand, as well as the redirection feature.

Differences to default Inquirer.js Behaviour

Contrary to the default behaviour of Inquirer.js, which resolves the returned promise with user's responses to all prompted questions, the Promise returned by inquiry-traverser receives only a particular value (see the basic usage example).

Todos

Currently inquiry-traverser lacks a proper documentation and tests. At the moment, even only prompts of type confirm are tested.
This will change and be more complete soon, hopefully. Until then, feel free to file bug reports or make suggestions. Pull requests welcome :)

Package Sidebar

Install

npm i inquiry-traverser

Weekly Downloads

0

Version

0.4.0

License

MIT

Last publish

Collaborators

  • ta2edchimp