首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使Vorpal输出为命令的描述

如何使Vorpal输出为命令的描述
EN

Stack Overflow用户
提问于 2015-10-17 13:17:06
回答 1查看 214关注 0票数 0

目前,我的代码如下所示:

代码语言:javascript
复制
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);
}
});
});

其结果如下:

我希望能够定义“是”的含义,这样玩家就可以知道回答“是”会做什么,或者要求他们做什么。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-10-17 19:52:00

您可以将描述作为command()函数的第二个参数传递,也可以使用description()显式设置它。

任一

代码语言:javascript
复制
vorpal.command('Yes', `These words will show up in the help')
.action(function(args, cb){
...

代码语言:javascript
复制
vorpal.command('Yes')
.description('`These words will show up in the help'')
.action(function(args, cb){
...
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33187083

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档