forked from workshopper/workshopper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
exerciseMenu.js
33 lines (26 loc) · 925 Bytes
/
exerciseMenu.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const chalk = require('chalk')
const menu = require('./menu')
function showMenu (opts, i18n) {
var __ = i18n.__
opts.entries = [
opts.exercises.map(function (exercise) {
return {
name: chalk.bold('»') + ' ' + __('exercise.' + exercise)
, marker: (opts.completed.indexOf(exercise) >= 0) ? '[' + __('menu.completed') + ']' : ''
, event: 'select'
, payload: exercise
}
})
, { separator: true }
, { name: chalk.bold(__('menu.help')), event: 'help' }
, (opts.languages && opts.languages.length > 1)
? { name: chalk.bold(__('menu.language')), event: 'language'}
: null
, (opts.extras || []).map(function (extra) {
return { name: chalk.bold(__('menu.' + extra)), event: 'extra-' + extra }
})
, { name: chalk.bold(__('menu.exit')), event: 'exit' }
]
return menu(opts, i18n)
}
module.exports = showMenu