A package for creating smart CLI interactions with customizable questions and answers.
Go to file
2020-02-02 13:46:49 +00:00
dist update to support dots as usual 2017-08-09 16:30:30 +02:00
docs fix(core): update 2020-02-02 13:46:49 +00:00
test fix(core): update 2020-02-02 13:45:59 +00:00
ts fix(core): update 2020-02-02 13:46:49 +00:00
.gitignore initial 2016-11-20 01:11:22 +01:00
.gitlab-ci.yml BREAKING CHANGE(package): change scope and update dependencies 2018-07-25 16:58:18 +02:00
npmextra.json fix(ci): build with right access level for npm 2018-07-25 17:39:31 +02:00
package-lock.json 2.0.6 2020-02-02 13:46:49 +00:00
package.json 2.0.6 2020-02-02 13:46:49 +00:00
readme.md fix(core): update 2020-02-02 13:46:49 +00:00
tslint.json fix(package): update tslint 2018-07-25 16:58:51 +02:00

smartinteract

smart cli interaction

Availabililty

npm git git docs

Status for master

build status coverage report npm downloads per month Dependency Status bitHound Dependencies bitHound Code TypeScript node JavaScript Style Guide

Usage

Use TypeScript for best in class instellisense.

import { SmartInteract } from 'smartinteract'

let myInteract = new SmartInteract([{ // note: its an array. You can specify multiple questions
    name: 'question1',
    type: 'input',
    message: 'Who are you?',
    default: 'Somebody',
    validate: (inputString) => { return true } // implement your own validation
}])
myInteract.addQuestions([ ... ]) // add more questions
myInteract.runQueue()
    .then(answerBucket => { // the bucket has all the answers of the completed queue
        let answerQuestion1 = answerBucket.getAnswerFor('question1')
        // do something with the answers
    })

// alternatively use .askQuestion() for more direct control
myInteract.askQuestion{ // note: its an array. You can specify multiple questions
    name: 'question2',
    type: 'confirm',
    message: 'Do you speak English?',
    default: true,
    validate: (inputString) => { return true } // implement your own validation
}().then(answerObject => {
    // answerObject looks like { name: 'question2', value: true }
})

For further information read the linked docs at the top of this readme.

MIT licensed | © Lossless GmbH | By using this npm module you agree to our privacy policy

repo-footer