-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
40 lines (33 loc) · 862 Bytes
/
index.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
34
35
36
37
38
39
40
const term = require('terminal-kit').terminal;
const setupSend = require('./send.js');
const setupReceive = require('./receive.js');
// Handle CTRL_C
function terminate() {
term.grabInput(false);
setTimeout(() => process.exit(), 100);
}
term.on('key', (name, matches, data) => {
if (name === 'CTRL_C') {
terminate();
}
});
term.fullscreen();
term.cyan(`do you want to send or receive midi?\n`);
term.singleColumnMenu(['send', 'receive'], {
cancelable: true,
}, (error, response) => {
term.clear();
// term('\n').eraseLineAfter.green(
// "#%s selected: %s (%s,%s)\n",
// response.selectedIndex,
// response.selectedText,
// response.x,
// response.y
// );
if (response.selectedIndex === 0) {
setupSend();
}
if (response.selectedIndex === 1) {
setupReceive();
}
});