@socketsecurity/cli-with-sentry 0.14.137 → 0.14.138
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blessed/LICENSE +20 -0
- package/dist/blessed/lib/alias.js +519 -0
- package/dist/blessed/lib/blessed.js +32 -0
- package/dist/blessed/lib/colors.js +490 -0
- package/dist/blessed/lib/events.js +195 -0
- package/dist/blessed/lib/gpmclient.js +245 -0
- package/dist/blessed/lib/helpers.js +170 -0
- package/dist/blessed/lib/keys.js +512 -0
- package/dist/blessed/lib/program.js +4530 -0
- package/dist/blessed/lib/tput.js +3111 -0
- package/dist/blessed/lib/unicode.js +912 -0
- package/dist/blessed/lib/widget.js +60 -0
- package/dist/blessed/lib/widgets/ansiimage.js +173 -0
- package/dist/blessed/lib/widgets/bigtext.js +170 -0
- package/dist/blessed/lib/widgets/box.js +34 -0
- package/dist/blessed/lib/widgets/button.js +62 -0
- package/dist/blessed/lib/widgets/checkbox.js +95 -0
- package/dist/blessed/lib/widgets/element.js +2871 -0
- package/dist/blessed/lib/widgets/filemanager.js +223 -0
- package/dist/blessed/lib/widgets/form.js +301 -0
- package/dist/blessed/lib/widgets/image.js +71 -0
- package/dist/blessed/lib/widgets/input.js +34 -0
- package/dist/blessed/lib/widgets/layout.js +249 -0
- package/dist/blessed/lib/widgets/line.js +59 -0
- package/dist/blessed/lib/widgets/list.js +652 -0
- package/dist/blessed/lib/widgets/listbar.js +452 -0
- package/dist/blessed/lib/widgets/listtable.js +265 -0
- package/dist/blessed/lib/widgets/loading.js +88 -0
- package/dist/blessed/lib/widgets/log.js +82 -0
- package/dist/blessed/lib/widgets/message.js +145 -0
- package/dist/blessed/lib/widgets/node.js +314 -0
- package/dist/blessed/lib/widgets/overlayimage.js +794 -0
- package/dist/blessed/lib/widgets/progressbar.js +166 -0
- package/dist/blessed/lib/widgets/prompt.js +127 -0
- package/dist/blessed/lib/widgets/question.js +129 -0
- package/dist/blessed/lib/widgets/radiobutton.js +62 -0
- package/dist/blessed/lib/widgets/radioset.js +36 -0
- package/dist/blessed/lib/widgets/screen.js +2485 -0
- package/dist/blessed/lib/widgets/scrollablebox.js +415 -0
- package/dist/blessed/lib/widgets/scrollabletext.js +35 -0
- package/dist/blessed/lib/widgets/table.js +383 -0
- package/dist/blessed/lib/widgets/terminal.js +452 -0
- package/dist/blessed/lib/widgets/text.js +35 -0
- package/dist/blessed/lib/widgets/textarea.js +376 -0
- package/dist/blessed/lib/widgets/textbox.js +79 -0
- package/dist/blessed/lib/widgets/video.js +130 -0
- package/dist/blessed/usr/fonts/AUTHORS +1 -0
- package/dist/blessed/usr/fonts/LICENSE +94 -0
- package/dist/blessed/usr/fonts/README +340 -0
- package/dist/blessed/usr/fonts/ter-u14b.json +17826 -0
- package/dist/blessed/usr/fonts/ter-u14n.json +17826 -0
- package/dist/blessed/usr/linux +0 -0
- package/dist/blessed/usr/windows-ansi +0 -0
- package/dist/blessed/usr/xterm +0 -0
- package/dist/blessed/usr/xterm-256color +0 -0
- package/dist/blessed/usr/xterm.termcap +243 -0
- package/dist/blessed/usr/xterm.terminfo +1977 -0
- package/dist/blessed/vendor/tng.js +1876 -0
- package/dist/blessed-contrib/LICENSE.md +21 -0
- package/dist/blessed-contrib/lib/layout/carousel.js +82 -0
- package/dist/blessed-contrib/lib/layout/grid.js +46 -0
- package/dist/blessed-contrib/lib/server-utils.js +83 -0
- package/dist/blessed-contrib/lib/utils.js +73 -0
- package/dist/blessed-contrib/lib/widget/canvas.js +52 -0
- package/dist/blessed-contrib/lib/widget/charts/bar.js +99 -0
- package/dist/blessed-contrib/lib/widget/charts/line.js +311 -0
- package/dist/blessed-contrib/lib/widget/charts/stacked-bar.js +245 -0
- package/dist/blessed-contrib/lib/widget/donut.js +183 -0
- package/dist/blessed-contrib/lib/widget/gauge-list.js +111 -0
- package/dist/blessed-contrib/lib/widget/gauge.js +127 -0
- package/dist/blessed-contrib/lib/widget/lcd.js +497 -0
- package/dist/blessed-contrib/lib/widget/log.js +32 -0
- package/dist/blessed-contrib/lib/widget/map.js +97 -0
- package/dist/blessed-contrib/lib/widget/markdown.js +68 -0
- package/dist/blessed-contrib/lib/widget/picture.js +61 -0
- package/dist/blessed-contrib/lib/widget/sparkline.js +66 -0
- package/dist/blessed-contrib/lib/widget/table.js +141 -0
- package/dist/blessed-contrib/lib/widget/tree.js +179 -0
- package/dist/blessed-contrib/node_modules/ansi-regex/index.js +6 -0
- package/dist/blessed-contrib/node_modules/ansi-regex/license +21 -0
- package/dist/blessed-contrib/node_modules/ansi-regex/package.json +64 -0
- package/dist/blessed-contrib/node_modules/ansi-regex/readme.md +39 -0
- package/dist/blessed-contrib/node_modules/ansi-styles/index.js +67 -0
- package/dist/blessed-contrib/node_modules/ansi-styles/license +21 -0
- package/dist/blessed-contrib/node_modules/ansi-styles/package.json +50 -0
- package/dist/blessed-contrib/node_modules/ansi-styles/readme.md +86 -0
- package/dist/blessed-contrib/node_modules/chalk/index.js +118 -0
- package/dist/blessed-contrib/node_modules/chalk/license +21 -0
- package/dist/blessed-contrib/node_modules/chalk/package.json +70 -0
- package/dist/blessed-contrib/node_modules/chalk/readme.md +213 -0
- package/dist/blessed-contrib/node_modules/escape-string-regexp/index.js +13 -0
- package/dist/blessed-contrib/node_modules/escape-string-regexp/license +21 -0
- package/dist/blessed-contrib/node_modules/escape-string-regexp/package.json +41 -0
- package/dist/blessed-contrib/node_modules/escape-string-regexp/readme.md +27 -0
- package/dist/blessed-contrib/node_modules/strip-ansi/index.js +8 -0
- package/dist/blessed-contrib/node_modules/strip-ansi/license +21 -0
- package/dist/blessed-contrib/node_modules/strip-ansi/package.json +57 -0
- package/dist/blessed-contrib/node_modules/strip-ansi/readme.md +33 -0
- package/dist/blessed-contrib/node_modules/supports-color/index.js +52 -0
- package/dist/blessed-contrib/node_modules/supports-color/license +21 -0
- package/dist/blessed-contrib/node_modules/supports-color/package.json +49 -0
- package/dist/blessed-contrib/node_modules/supports-color/readme.md +36 -0
- package/dist/cli.js +9 -8
- package/dist/cli.js.map +1 -1
- package/dist/instrument-with-sentry.js +2 -2
- package/dist/instrument-with-sentry.js.map +1 -1
- package/dist/shadow-npm-inject.js +2 -2
- package/dist/shadow-npm-inject.js.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* progressbar.js - progress bar element for blessed
|
|
3
|
+
* Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License).
|
|
4
|
+
* https://github.com/chjj/blessed
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Modules
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const Node = require('./node')
|
|
12
|
+
const Input = require('./input')
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* ProgressBar
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
function ProgressBar(options) {
|
|
19
|
+
const self = this
|
|
20
|
+
|
|
21
|
+
if (!(this instanceof Node)) {
|
|
22
|
+
return new ProgressBar(options)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
options = options || {}
|
|
26
|
+
|
|
27
|
+
Input.call(this, options)
|
|
28
|
+
|
|
29
|
+
this.filled = options.filled || 0
|
|
30
|
+
if (typeof this.filled === 'string') {
|
|
31
|
+
this.filled = +this.filled.slice(0, -1)
|
|
32
|
+
}
|
|
33
|
+
this.value = this.filled
|
|
34
|
+
|
|
35
|
+
this.pch = options.pch || ' '
|
|
36
|
+
|
|
37
|
+
// XXX Workaround that predates the usage of `el.ch`.
|
|
38
|
+
if (options.ch) {
|
|
39
|
+
this.pch = options.ch
|
|
40
|
+
this.ch = ' '
|
|
41
|
+
}
|
|
42
|
+
if (options.bch) {
|
|
43
|
+
this.ch = options.bch
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (!this.style.bar) {
|
|
47
|
+
this.style.bar = {}
|
|
48
|
+
this.style.bar.fg = options.barFg
|
|
49
|
+
this.style.bar.bg = options.barBg
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
this.orientation = options.orientation || 'horizontal'
|
|
53
|
+
|
|
54
|
+
if (options.keys) {
|
|
55
|
+
this.on('keypress', function (ch, key) {
|
|
56
|
+
let back, forward
|
|
57
|
+
if (self.orientation === 'horizontal') {
|
|
58
|
+
back = ['left', 'h']
|
|
59
|
+
forward = ['right', 'l']
|
|
60
|
+
} else if (self.orientation === 'vertical') {
|
|
61
|
+
back = ['down', 'j']
|
|
62
|
+
forward = ['up', 'k']
|
|
63
|
+
}
|
|
64
|
+
if (key.name === back[0] || (options.vi && key.name === back[1])) {
|
|
65
|
+
self.progress(-5)
|
|
66
|
+
self.screen.render()
|
|
67
|
+
return
|
|
68
|
+
}
|
|
69
|
+
if (key.name === forward[0] || (options.vi && key.name === forward[1])) {
|
|
70
|
+
self.progress(5)
|
|
71
|
+
self.screen.render()
|
|
72
|
+
return
|
|
73
|
+
}
|
|
74
|
+
})
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (options.mouse) {
|
|
78
|
+
this.on('click', function (data) {
|
|
79
|
+
let x, y, m, p
|
|
80
|
+
if (!self.lpos) {
|
|
81
|
+
return
|
|
82
|
+
}
|
|
83
|
+
if (self.orientation === 'horizontal') {
|
|
84
|
+
x = data.x - self.lpos.xi
|
|
85
|
+
m = self.lpos.xl - self.lpos.xi - self.iwidth
|
|
86
|
+
p = ((x / m) * 100) | 0
|
|
87
|
+
} else if (self.orientation === 'vertical') {
|
|
88
|
+
y = data.y - self.lpos.yi
|
|
89
|
+
m = self.lpos.yl - self.lpos.yi - self.iheight
|
|
90
|
+
p = ((y / m) * 100) | 0
|
|
91
|
+
}
|
|
92
|
+
self.setProgress(p)
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
Object.setPrototypeOf(ProgressBar.prototype, Input.prototype)
|
|
98
|
+
|
|
99
|
+
ProgressBar.prototype.type = 'progress-bar'
|
|
100
|
+
|
|
101
|
+
ProgressBar.prototype.render = function () {
|
|
102
|
+
const ret = this._render()
|
|
103
|
+
if (!ret) {
|
|
104
|
+
return
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
let xi = ret.xi,
|
|
108
|
+
xl = ret.xl,
|
|
109
|
+
yi = ret.yi,
|
|
110
|
+
yl = ret.yl,
|
|
111
|
+
dattr
|
|
112
|
+
|
|
113
|
+
if (this.border) {
|
|
114
|
+
xi++, yi++, xl--, yl--
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (this.orientation === 'horizontal') {
|
|
118
|
+
xl = (xi + (xl - xi) * (this.filled / 100)) | 0
|
|
119
|
+
} else if (this.orientation === 'vertical') {
|
|
120
|
+
yi = yi + (yl - yi - (((yl - yi) * (this.filled / 100)) | 0))
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
dattr = this.sattr(this.style.bar)
|
|
124
|
+
|
|
125
|
+
this.screen.fillRegion(dattr, this.pch, xi, xl, yi, yl)
|
|
126
|
+
|
|
127
|
+
if (this.content) {
|
|
128
|
+
const line = this.screen.lines[yi]
|
|
129
|
+
for (let i = 0; i < this.content.length; i++) {
|
|
130
|
+
line[xi + i][1] = this.content[i]
|
|
131
|
+
}
|
|
132
|
+
line.dirty = true
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return ret
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
ProgressBar.prototype.progress = function (filled) {
|
|
139
|
+
this.filled += filled
|
|
140
|
+
if (this.filled < 0) {
|
|
141
|
+
this.filled = 0
|
|
142
|
+
} else if (this.filled > 100) {
|
|
143
|
+
this.filled = 100
|
|
144
|
+
}
|
|
145
|
+
if (this.filled === 100) {
|
|
146
|
+
this.emit('complete')
|
|
147
|
+
}
|
|
148
|
+
this.value = this.filled
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
ProgressBar.prototype.setProgress = function (filled) {
|
|
152
|
+
this.filled = 0
|
|
153
|
+
this.progress(filled)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
ProgressBar.prototype.reset = function () {
|
|
157
|
+
this.emit('reset')
|
|
158
|
+
this.filled = 0
|
|
159
|
+
this.value = this.filled
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Expose
|
|
164
|
+
*/
|
|
165
|
+
|
|
166
|
+
module.exports = ProgressBar
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* prompt.js - prompt element for blessed
|
|
3
|
+
* Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License).
|
|
4
|
+
* https://github.com/chjj/blessed
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Modules
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const Node = require('./node')
|
|
12
|
+
const Box = require('./box')
|
|
13
|
+
const Button = require('./button')
|
|
14
|
+
const Textbox = require('./textbox')
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Prompt
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
function Prompt(options) {
|
|
21
|
+
if (!(this instanceof Node)) {
|
|
22
|
+
return new Prompt(options)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
options = options || {}
|
|
26
|
+
|
|
27
|
+
options.hidden = true
|
|
28
|
+
|
|
29
|
+
Box.call(this, options)
|
|
30
|
+
|
|
31
|
+
this._.input = new Textbox({
|
|
32
|
+
parent: this,
|
|
33
|
+
top: 3,
|
|
34
|
+
height: 1,
|
|
35
|
+
left: 2,
|
|
36
|
+
right: 2,
|
|
37
|
+
bg: 'black'
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
this._.okay = new Button({
|
|
41
|
+
parent: this,
|
|
42
|
+
top: 5,
|
|
43
|
+
height: 1,
|
|
44
|
+
left: 2,
|
|
45
|
+
width: 6,
|
|
46
|
+
content: 'Okay',
|
|
47
|
+
align: 'center',
|
|
48
|
+
bg: 'black',
|
|
49
|
+
hoverBg: 'blue',
|
|
50
|
+
autoFocus: false,
|
|
51
|
+
mouse: true
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
this._.cancel = new Button({
|
|
55
|
+
parent: this,
|
|
56
|
+
top: 5,
|
|
57
|
+
height: 1,
|
|
58
|
+
shrink: true,
|
|
59
|
+
left: 10,
|
|
60
|
+
width: 8,
|
|
61
|
+
content: 'Cancel',
|
|
62
|
+
align: 'center',
|
|
63
|
+
bg: 'black',
|
|
64
|
+
hoverBg: 'blue',
|
|
65
|
+
autoFocus: false,
|
|
66
|
+
mouse: true
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
Object.setPrototypeOf(Prompt.prototype, Box.prototype)
|
|
71
|
+
|
|
72
|
+
Prompt.prototype.type = 'prompt'
|
|
73
|
+
|
|
74
|
+
Prompt.prototype.input =
|
|
75
|
+
Prompt.prototype.setInput =
|
|
76
|
+
Prompt.prototype.readInput =
|
|
77
|
+
function (text, value, callback) {
|
|
78
|
+
const self = this
|
|
79
|
+
let okay, cancel
|
|
80
|
+
|
|
81
|
+
if (!callback) {
|
|
82
|
+
callback = value
|
|
83
|
+
value = ''
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Keep above:
|
|
87
|
+
// var parent = this.parent;
|
|
88
|
+
// this.detach();
|
|
89
|
+
// parent.append(this);
|
|
90
|
+
|
|
91
|
+
this.show()
|
|
92
|
+
this.setContent(' ' + text)
|
|
93
|
+
|
|
94
|
+
this._.input.value = value
|
|
95
|
+
|
|
96
|
+
this.screen.saveFocus()
|
|
97
|
+
|
|
98
|
+
this._.okay.on(
|
|
99
|
+
'press',
|
|
100
|
+
(okay = function () {
|
|
101
|
+
self._.input.submit()
|
|
102
|
+
})
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
this._.cancel.on(
|
|
106
|
+
'press',
|
|
107
|
+
(cancel = function () {
|
|
108
|
+
self._.input.cancel()
|
|
109
|
+
})
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
this._.input.readInput(function (err, data) {
|
|
113
|
+
self.hide()
|
|
114
|
+
self.screen.restoreFocus()
|
|
115
|
+
self._.okay.removeListener('press', okay)
|
|
116
|
+
self._.cancel.removeListener('press', cancel)
|
|
117
|
+
return callback(err, data)
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
this.screen.render()
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Expose
|
|
125
|
+
*/
|
|
126
|
+
|
|
127
|
+
module.exports = Prompt
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* question.js - question element for blessed
|
|
3
|
+
* Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License).
|
|
4
|
+
* https://github.com/chjj/blessed
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Modules
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const Node = require('./node')
|
|
12
|
+
const Box = require('./box')
|
|
13
|
+
const Button = require('./button')
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Question
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
function Question(options) {
|
|
20
|
+
if (!(this instanceof Node)) {
|
|
21
|
+
return new Question(options)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
options = options || {}
|
|
25
|
+
options.hidden = true
|
|
26
|
+
|
|
27
|
+
Box.call(this, options)
|
|
28
|
+
|
|
29
|
+
this._.okay = new Button({
|
|
30
|
+
screen: this.screen,
|
|
31
|
+
parent: this,
|
|
32
|
+
top: 2,
|
|
33
|
+
height: 1,
|
|
34
|
+
left: 2,
|
|
35
|
+
width: 6,
|
|
36
|
+
content: 'Okay',
|
|
37
|
+
align: 'center',
|
|
38
|
+
bg: 'black',
|
|
39
|
+
hoverBg: 'blue',
|
|
40
|
+
autoFocus: false,
|
|
41
|
+
mouse: true
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
this._.cancel = new Button({
|
|
45
|
+
screen: this.screen,
|
|
46
|
+
parent: this,
|
|
47
|
+
top: 2,
|
|
48
|
+
height: 1,
|
|
49
|
+
shrink: true,
|
|
50
|
+
left: 10,
|
|
51
|
+
width: 8,
|
|
52
|
+
content: 'Cancel',
|
|
53
|
+
align: 'center',
|
|
54
|
+
bg: 'black',
|
|
55
|
+
hoverBg: 'blue',
|
|
56
|
+
autoFocus: false,
|
|
57
|
+
mouse: true
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
Object.setPrototypeOf(Question.prototype, Box.prototype)
|
|
62
|
+
|
|
63
|
+
Question.prototype.type = 'question'
|
|
64
|
+
|
|
65
|
+
Question.prototype.ask = function (text, callback) {
|
|
66
|
+
const self = this
|
|
67
|
+
let press, okay, cancel
|
|
68
|
+
|
|
69
|
+
// Keep above:
|
|
70
|
+
// var parent = this.parent;
|
|
71
|
+
// this.detach();
|
|
72
|
+
// parent.append(this);
|
|
73
|
+
|
|
74
|
+
this.show()
|
|
75
|
+
this.setContent(' ' + text)
|
|
76
|
+
|
|
77
|
+
this.onScreenEvent(
|
|
78
|
+
'keypress',
|
|
79
|
+
(press = function (ch, key) {
|
|
80
|
+
if (key.name === 'mouse') {
|
|
81
|
+
return
|
|
82
|
+
}
|
|
83
|
+
if (
|
|
84
|
+
key.name !== 'enter' &&
|
|
85
|
+
key.name !== 'escape' &&
|
|
86
|
+
key.name !== 'q' &&
|
|
87
|
+
key.name !== 'y' &&
|
|
88
|
+
key.name !== 'n'
|
|
89
|
+
) {
|
|
90
|
+
return
|
|
91
|
+
}
|
|
92
|
+
done(null, key.name === 'enter' || key.name === 'y')
|
|
93
|
+
})
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
this._.okay.on(
|
|
97
|
+
'press',
|
|
98
|
+
(okay = function () {
|
|
99
|
+
done(null, true)
|
|
100
|
+
})
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
this._.cancel.on(
|
|
104
|
+
'press',
|
|
105
|
+
(cancel = function () {
|
|
106
|
+
done(null, false)
|
|
107
|
+
})
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
this.screen.saveFocus()
|
|
111
|
+
this.focus()
|
|
112
|
+
|
|
113
|
+
function done(err, data) {
|
|
114
|
+
self.hide()
|
|
115
|
+
self.screen.restoreFocus()
|
|
116
|
+
self.removeScreenEvent('keypress', press)
|
|
117
|
+
self._.okay.removeListener('press', okay)
|
|
118
|
+
self._.cancel.removeListener('press', cancel)
|
|
119
|
+
return callback(err, data)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
this.screen.render()
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Expose
|
|
127
|
+
*/
|
|
128
|
+
|
|
129
|
+
module.exports = Question
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* radiobutton.js - radio button element for blessed
|
|
3
|
+
* Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License).
|
|
4
|
+
* https://github.com/chjj/blessed
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Modules
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const Node = require('./node')
|
|
12
|
+
const Checkbox = require('./checkbox')
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* RadioButton
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
function RadioButton(options) {
|
|
19
|
+
const self = this
|
|
20
|
+
|
|
21
|
+
if (!(this instanceof Node)) {
|
|
22
|
+
return new RadioButton(options)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
options = options || {}
|
|
26
|
+
|
|
27
|
+
Checkbox.call(this, options)
|
|
28
|
+
|
|
29
|
+
this.on('check', function () {
|
|
30
|
+
let el = self
|
|
31
|
+
while ((el = el.parent)) {
|
|
32
|
+
if (el.type === 'radio-set' || el.type === 'form') {
|
|
33
|
+
break
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
el = el || self.parent
|
|
37
|
+
el.forDescendants(function (el) {
|
|
38
|
+
if (el.type !== 'radio-button' || el === self) {
|
|
39
|
+
return
|
|
40
|
+
}
|
|
41
|
+
el.uncheck()
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
Object.setPrototypeOf(RadioButton.prototype, Checkbox.prototype)
|
|
47
|
+
|
|
48
|
+
RadioButton.prototype.type = 'radio-button'
|
|
49
|
+
|
|
50
|
+
RadioButton.prototype.render = function () {
|
|
51
|
+
this.clearPos(true)
|
|
52
|
+
this.setContent('(' + (this.checked ? '*' : ' ') + ') ' + this.text, true)
|
|
53
|
+
return this._render()
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
RadioButton.prototype.toggle = RadioButton.prototype.check
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Expose
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
module.exports = RadioButton
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* radioset.js - radio set element for blessed
|
|
3
|
+
* Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License).
|
|
4
|
+
* https://github.com/chjj/blessed
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Modules
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const Node = require('./node')
|
|
12
|
+
const Box = require('./box')
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* RadioSet
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
function RadioSet(options) {
|
|
19
|
+
if (!(this instanceof Node)) {
|
|
20
|
+
return new RadioSet(options)
|
|
21
|
+
}
|
|
22
|
+
options = options || {}
|
|
23
|
+
// Possibly inherit parent's style.
|
|
24
|
+
// options.style = this.parent.style;
|
|
25
|
+
Box.call(this, options)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
Object.setPrototypeOf(RadioSet.prototype, Box.prototype)
|
|
29
|
+
|
|
30
|
+
RadioSet.prototype.type = 'radio-set'
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Expose
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
module.exports = RadioSet
|