我如何能够从上一个问题中得到答案并传递到下一个问题以供inquirerJS 选择?我知道它是异步的,但我不确定如何在这里创建承诺。任何进一步的见解和帮助都会很棒。
例子:
var questions = [{
name: 'menu',
type: 'checkbox',
message: 'Which food do you like eating?',
choices: ['pizza', 'hotdog', 'hamburger', 'sandwiches'],
}, {
name: 'favorite',
type: 'checkbox',
message: 'Which one do you like most?',
choices: answers.menu, <------- doesn't work because it is asynchronous
};