Currently my code looks like this:
var vorpal = require('vorpal')();
console.log("Are you sure you wish to investigate the murder?")
vorpal
.delimiter('grey9nr$')
.show();
vorpal.command('Yes')
.action(function(args, cb){
const self = this;
this.prompt({
type: 'confirm',
name: 'continue',
default: false,
message: 'That sounds like a really bad idea. Continue?',
}, function(result){
if (result.continue) {
self.log('Good move.');
cb();
} else {
self.log('Your life is in danger. We will contact you with more information in due course.');
app.destroyDatabase(cb);
}
});
});
Which results in the following:
I would like to be able to define what yes means so the player knows what answering 'yes' will do, or require them to do.
You can either pass the description as the second parameter of the command()
function, or explicitly set it with description()
.
Either
vorpal.command('Yes', `These words will show up in the help')
.action(function(args, cb){
...
or
vorpal.command('Yes')
.description('`These words will show up in the help'')
.action(function(args, cb){
...