Skip to content

Instantly share code, notes, and snippets.

@Freyert
Created May 25, 2015 19:19
Show Gist options
  • Select an option

  • Save Freyert/c120b0b6fc527ebf1375 to your computer and use it in GitHub Desktop.

Select an option

Save Freyert/c120b0b6fc527ebf1375 to your computer and use it in GitHub Desktop.
ReactiveJS Prompt Interface for Inquirer inside of a Yeoman Generator.
prompting: function () {
var done = this.async();
var log = function(answers) { this.log(answers); }.bind(this);
var complete = function() {
this.log('complete');
done();
}.bind(this);
var prompts = Rx.Observable.create(function(obs) {
this.log(obs);
obs.onNext({ type: 'input',
name: 'howdy',
message:'howdy'
});
obs.onNext({ type: 'input',
name: 'okee',
message:'okee'
});
obs.onCompleted();
}.bind(this));
inquirer.prompt(prompts).process.subscribe(log, log, complete);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment