@socketsecurity/cli-with-sentry 0.14.137 → 0.14.139
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,376 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* textarea.js - textarea 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 unicode = require('../unicode')
|
|
12
|
+
|
|
13
|
+
const nextTick = global.setImmediate || process.nextTick.bind(process)
|
|
14
|
+
|
|
15
|
+
const Node = require('./node')
|
|
16
|
+
const Input = require('./input')
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Textarea
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
function Textarea(options) {
|
|
23
|
+
const self = this
|
|
24
|
+
|
|
25
|
+
if (!(this instanceof Node)) {
|
|
26
|
+
return new Textarea(options)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
options = options || {}
|
|
30
|
+
|
|
31
|
+
options.scrollable = options.scrollable !== false
|
|
32
|
+
|
|
33
|
+
Input.call(this, options)
|
|
34
|
+
|
|
35
|
+
this.screen._listenKeys(this)
|
|
36
|
+
|
|
37
|
+
this.value = options.value || ''
|
|
38
|
+
|
|
39
|
+
this.__updateCursor = this._updateCursor.bind(this)
|
|
40
|
+
this.on('resize', this.__updateCursor)
|
|
41
|
+
this.on('move', this.__updateCursor)
|
|
42
|
+
|
|
43
|
+
if (options.inputOnFocus) {
|
|
44
|
+
this.on('focus', this.readInput.bind(this, null))
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (!options.inputOnFocus && options.keys) {
|
|
48
|
+
this.on('keypress', function (ch, key) {
|
|
49
|
+
if (self._reading) {
|
|
50
|
+
return
|
|
51
|
+
}
|
|
52
|
+
if (key.name === 'enter' || (options.vi && key.name === 'i')) {
|
|
53
|
+
return self.readInput()
|
|
54
|
+
}
|
|
55
|
+
if (key.name === 'e') {
|
|
56
|
+
return self.readEditor()
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (options.mouse) {
|
|
62
|
+
this.on('click', function (data) {
|
|
63
|
+
if (self._reading) {
|
|
64
|
+
return
|
|
65
|
+
}
|
|
66
|
+
if (data.button !== 'right') {
|
|
67
|
+
return
|
|
68
|
+
}
|
|
69
|
+
self.readEditor()
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
Object.setPrototypeOf(Textarea.prototype, Input.prototype)
|
|
75
|
+
|
|
76
|
+
Textarea.prototype.type = 'textarea'
|
|
77
|
+
|
|
78
|
+
Textarea.prototype._updateCursor = function (get) {
|
|
79
|
+
if (this.screen.focused !== this) {
|
|
80
|
+
return
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const lpos = get ? this.lpos : this._getCoords()
|
|
84
|
+
if (!lpos) {
|
|
85
|
+
return
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
let last = this._clines[this._clines.length - 1],
|
|
89
|
+
program = this.screen.program,
|
|
90
|
+
line,
|
|
91
|
+
cx,
|
|
92
|
+
cy
|
|
93
|
+
|
|
94
|
+
// Stop a situation where the textarea begins scrolling
|
|
95
|
+
// and the last cline appears to always be empty from the
|
|
96
|
+
// _typeScroll `+ '\n'` thing.
|
|
97
|
+
// Maybe not necessary anymore?
|
|
98
|
+
if (last === '' && this.value[this.value.length - 1] !== '\n') {
|
|
99
|
+
last = this._clines[this._clines.length - 2] || ''
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
line = Math.min(
|
|
103
|
+
this._clines.length - 1 - (this.childBase || 0),
|
|
104
|
+
lpos.yl - lpos.yi - this.iheight - 1
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
// When calling clearValue() on a full textarea with a border, the first
|
|
108
|
+
// argument in the above Math.min call ends up being -2. Make sure we stay
|
|
109
|
+
// positive.
|
|
110
|
+
line = Math.max(0, line)
|
|
111
|
+
|
|
112
|
+
cy = lpos.yi + this.itop + line
|
|
113
|
+
cx = lpos.xi + this.ileft + this.strWidth(last)
|
|
114
|
+
|
|
115
|
+
// XXX Not sure, but this may still sometimes
|
|
116
|
+
// cause problems when leaving editor.
|
|
117
|
+
if (cy === program.y && cx === program.x) {
|
|
118
|
+
return
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (cy === program.y) {
|
|
122
|
+
if (cx > program.x) {
|
|
123
|
+
program.cuf(cx - program.x)
|
|
124
|
+
} else if (cx < program.x) {
|
|
125
|
+
program.cub(program.x - cx)
|
|
126
|
+
}
|
|
127
|
+
} else if (cx === program.x) {
|
|
128
|
+
if (cy > program.y) {
|
|
129
|
+
program.cud(cy - program.y)
|
|
130
|
+
} else if (cy < program.y) {
|
|
131
|
+
program.cuu(program.y - cy)
|
|
132
|
+
}
|
|
133
|
+
} else {
|
|
134
|
+
program.cup(cy, cx)
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
Textarea.prototype.input =
|
|
139
|
+
Textarea.prototype.setInput =
|
|
140
|
+
Textarea.prototype.readInput =
|
|
141
|
+
function (callback) {
|
|
142
|
+
const self = this,
|
|
143
|
+
focused = this.screen.focused === this
|
|
144
|
+
|
|
145
|
+
if (this._reading) {
|
|
146
|
+
return
|
|
147
|
+
}
|
|
148
|
+
this._reading = true
|
|
149
|
+
|
|
150
|
+
this._callback = callback
|
|
151
|
+
|
|
152
|
+
if (!focused) {
|
|
153
|
+
this.screen.saveFocus()
|
|
154
|
+
this.focus()
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
this.screen.grabKeys = true
|
|
158
|
+
|
|
159
|
+
this._updateCursor()
|
|
160
|
+
this.screen.program.showCursor()
|
|
161
|
+
//this.screen.program.sgr('normal');
|
|
162
|
+
|
|
163
|
+
this._done = function fn(err, value) {
|
|
164
|
+
if (!self._reading) {
|
|
165
|
+
return
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (fn.done) {
|
|
169
|
+
return
|
|
170
|
+
}
|
|
171
|
+
fn.done = true
|
|
172
|
+
|
|
173
|
+
self._reading = false
|
|
174
|
+
|
|
175
|
+
delete self._callback
|
|
176
|
+
delete self._done
|
|
177
|
+
|
|
178
|
+
self.removeListener('keypress', self.__listener)
|
|
179
|
+
delete self.__listener
|
|
180
|
+
|
|
181
|
+
self.removeListener('blur', self.__done)
|
|
182
|
+
delete self.__done
|
|
183
|
+
|
|
184
|
+
self.screen.program.hideCursor()
|
|
185
|
+
self.screen.grabKeys = false
|
|
186
|
+
|
|
187
|
+
if (!focused) {
|
|
188
|
+
self.screen.restoreFocus()
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (self.options.inputOnFocus) {
|
|
192
|
+
self.screen.rewindFocus()
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// Ugly
|
|
196
|
+
if (err === 'stop') {
|
|
197
|
+
return
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (err) {
|
|
201
|
+
self.emit('error', err)
|
|
202
|
+
} else if (value != null) {
|
|
203
|
+
self.emit('submit', value)
|
|
204
|
+
} else {
|
|
205
|
+
self.emit('cancel', value)
|
|
206
|
+
}
|
|
207
|
+
self.emit('action', value)
|
|
208
|
+
|
|
209
|
+
if (!callback) {
|
|
210
|
+
return
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return err ? callback(err) : callback(null, value)
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// Put this in a nextTick so the current
|
|
217
|
+
// key event doesn't trigger any keys input.
|
|
218
|
+
nextTick(function () {
|
|
219
|
+
self.__listener = self._listener.bind(self)
|
|
220
|
+
self.on('keypress', self.__listener)
|
|
221
|
+
})
|
|
222
|
+
|
|
223
|
+
this.__done = this._done.bind(this, null, null)
|
|
224
|
+
this.on('blur', this.__done)
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
Textarea.prototype._listener = function (ch, key) {
|
|
228
|
+
const done = this._done,
|
|
229
|
+
value = this.value
|
|
230
|
+
|
|
231
|
+
if (key.name === 'return') {
|
|
232
|
+
return
|
|
233
|
+
}
|
|
234
|
+
if (key.name === 'enter') {
|
|
235
|
+
ch = '\n'
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// TODO: Handle directional keys.
|
|
239
|
+
if (
|
|
240
|
+
key.name === 'left' ||
|
|
241
|
+
key.name === 'right' ||
|
|
242
|
+
key.name === 'up' ||
|
|
243
|
+
key.name === 'down'
|
|
244
|
+
) {
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if (this.options.keys && key.ctrl && key.name === 'e') {
|
|
248
|
+
return this.readEditor()
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// TODO: Optimize typing by writing directly
|
|
252
|
+
// to the screen and screen buffer here.
|
|
253
|
+
if (key.name === 'escape') {
|
|
254
|
+
done(null, null)
|
|
255
|
+
} else if (key.name === 'backspace') {
|
|
256
|
+
if (this.value.length) {
|
|
257
|
+
if (this.screen.fullUnicode) {
|
|
258
|
+
if (unicode.isSurrogate(this.value, this.value.length - 2)) {
|
|
259
|
+
// || unicode.isCombining(this.value, this.value.length - 1)) {
|
|
260
|
+
this.value = this.value.slice(0, -2)
|
|
261
|
+
} else {
|
|
262
|
+
this.value = this.value.slice(0, -1)
|
|
263
|
+
}
|
|
264
|
+
} else {
|
|
265
|
+
this.value = this.value.slice(0, -1)
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
} else if (ch) {
|
|
269
|
+
if (!/^[\x00-\x08\x0b-\x0c\x0e-\x1f\x7f]$/.test(ch)) {
|
|
270
|
+
this.value += ch
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
if (this.value !== value) {
|
|
275
|
+
this.screen.render()
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
Textarea.prototype._typeScroll = function () {
|
|
280
|
+
// XXX Workaround
|
|
281
|
+
const height = this.height - this.iheight
|
|
282
|
+
if (this._clines.length - this.childBase > height) {
|
|
283
|
+
this.scroll(this._clines.length)
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
Textarea.prototype.getValue = function () {
|
|
288
|
+
return this.value
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
Textarea.prototype.setValue = function (value) {
|
|
292
|
+
if (value == null) {
|
|
293
|
+
value = this.value
|
|
294
|
+
}
|
|
295
|
+
if (this._value !== value) {
|
|
296
|
+
this.value = value
|
|
297
|
+
this._value = value
|
|
298
|
+
this.setContent(this.value)
|
|
299
|
+
this._typeScroll()
|
|
300
|
+
this._updateCursor()
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
Textarea.prototype.clearInput = Textarea.prototype.clearValue = function () {
|
|
305
|
+
return this.setValue('')
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
Textarea.prototype.submit = function () {
|
|
309
|
+
if (!this.__listener) {
|
|
310
|
+
return
|
|
311
|
+
}
|
|
312
|
+
return this.__listener('\x1b', { name: 'escape' })
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
Textarea.prototype.cancel = function () {
|
|
316
|
+
if (!this.__listener) {
|
|
317
|
+
return
|
|
318
|
+
}
|
|
319
|
+
return this.__listener('\x1b', { name: 'escape' })
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
Textarea.prototype.render = function () {
|
|
323
|
+
this.setValue()
|
|
324
|
+
return this._render()
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
Textarea.prototype.editor =
|
|
328
|
+
Textarea.prototype.setEditor =
|
|
329
|
+
Textarea.prototype.readEditor =
|
|
330
|
+
function (callback) {
|
|
331
|
+
const self = this
|
|
332
|
+
|
|
333
|
+
if (this._reading) {
|
|
334
|
+
const _cb = this._callback,
|
|
335
|
+
cb = callback
|
|
336
|
+
|
|
337
|
+
this._done('stop')
|
|
338
|
+
|
|
339
|
+
callback = function (err, value) {
|
|
340
|
+
if (_cb) {
|
|
341
|
+
_cb(err, value)
|
|
342
|
+
}
|
|
343
|
+
if (cb) {
|
|
344
|
+
cb(err, value)
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
if (!callback) {
|
|
350
|
+
callback = function () {}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
return this.screen.readEditor(
|
|
354
|
+
{ value: this.value },
|
|
355
|
+
function (err, value) {
|
|
356
|
+
if (err) {
|
|
357
|
+
if (err.message === 'Unsuccessful.') {
|
|
358
|
+
self.screen.render()
|
|
359
|
+
return self.readInput(callback)
|
|
360
|
+
}
|
|
361
|
+
self.screen.render()
|
|
362
|
+
self.readInput(callback)
|
|
363
|
+
return callback(err)
|
|
364
|
+
}
|
|
365
|
+
self.setValue(value)
|
|
366
|
+
self.screen.render()
|
|
367
|
+
return self.readInput(callback)
|
|
368
|
+
}
|
|
369
|
+
)
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Expose
|
|
374
|
+
*/
|
|
375
|
+
|
|
376
|
+
module.exports = Textarea
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* textbox.js - textbox 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 Textarea = require('./textarea')
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Textbox
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
function Textbox(options) {
|
|
19
|
+
if (!(this instanceof Node)) {
|
|
20
|
+
return new Textbox(options)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
options = options || {}
|
|
24
|
+
|
|
25
|
+
options.scrollable = false
|
|
26
|
+
|
|
27
|
+
Textarea.call(this, options)
|
|
28
|
+
|
|
29
|
+
this.secret = options.secret
|
|
30
|
+
this.censor = options.censor
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
Object.setPrototypeOf(Textbox.prototype, Textarea.prototype)
|
|
34
|
+
|
|
35
|
+
Textbox.prototype.type = 'textbox'
|
|
36
|
+
|
|
37
|
+
Textbox.prototype.__olistener = Textbox.prototype._listener
|
|
38
|
+
Textbox.prototype._listener = function (ch, key) {
|
|
39
|
+
if (key.name === 'enter') {
|
|
40
|
+
this._done(null, this.value)
|
|
41
|
+
return
|
|
42
|
+
}
|
|
43
|
+
return this.__olistener(ch, key)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
Textbox.prototype.setValue = function (value) {
|
|
47
|
+
let visible, val
|
|
48
|
+
if (value == null) {
|
|
49
|
+
value = this.value
|
|
50
|
+
}
|
|
51
|
+
if (this._value !== value) {
|
|
52
|
+
value = value.replace(/\n/g, '')
|
|
53
|
+
this.value = value
|
|
54
|
+
this._value = value
|
|
55
|
+
if (this.secret) {
|
|
56
|
+
this.setContent('')
|
|
57
|
+
} else if (this.censor) {
|
|
58
|
+
this.setContent(Array(this.value.length + 1).join('*'))
|
|
59
|
+
} else {
|
|
60
|
+
visible = -(this.width - this.iwidth - 1)
|
|
61
|
+
val = this.value.replace(/\t/g, this.screen.tabc)
|
|
62
|
+
this.setContent(val.slice(visible))
|
|
63
|
+
}
|
|
64
|
+
this._updateCursor()
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
Textbox.prototype.submit = function () {
|
|
69
|
+
if (!this.__listener) {
|
|
70
|
+
return
|
|
71
|
+
}
|
|
72
|
+
return this.__listener('\r', { name: 'enter' })
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Expose
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
module.exports = Textbox
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* video.js - video 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 cp = require('node:child_process')
|
|
12
|
+
|
|
13
|
+
const Node = require('./node')
|
|
14
|
+
const Box = require('./box')
|
|
15
|
+
const Terminal = require('./terminal')
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Video
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
function Video(options) {
|
|
22
|
+
let self = this,
|
|
23
|
+
shell,
|
|
24
|
+
args
|
|
25
|
+
|
|
26
|
+
if (!(this instanceof Node)) {
|
|
27
|
+
return new Video(options)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
options = options || {}
|
|
31
|
+
|
|
32
|
+
Box.call(this, options)
|
|
33
|
+
|
|
34
|
+
if (this.exists('mplayer')) {
|
|
35
|
+
shell = 'mplayer'
|
|
36
|
+
args = ['-vo', 'caca', '-quiet', options.file]
|
|
37
|
+
} else if (this.exists('mpv')) {
|
|
38
|
+
shell = 'mpv'
|
|
39
|
+
args = ['--vo', 'caca', '--really-quiet', options.file]
|
|
40
|
+
} else {
|
|
41
|
+
this.parseTags = true
|
|
42
|
+
this.setContent(
|
|
43
|
+
'{red-fg}{bold}Error:{/bold}' + ' mplayer or mpv not installed.{/red-fg}'
|
|
44
|
+
)
|
|
45
|
+
return this
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const opts = {
|
|
49
|
+
parent: this,
|
|
50
|
+
left: 0,
|
|
51
|
+
top: 0,
|
|
52
|
+
width: this.width - this.iwidth,
|
|
53
|
+
height: this.height - this.iheight,
|
|
54
|
+
shell: shell,
|
|
55
|
+
args: args.slice()
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
this.now = (Date.now() / 1000) | 0
|
|
59
|
+
this.start = opts.start || 0
|
|
60
|
+
if (this.start) {
|
|
61
|
+
if (shell === 'mplayer') {
|
|
62
|
+
opts.args.unshift('-ss', this.start + '')
|
|
63
|
+
} else if (shell === 'mpv') {
|
|
64
|
+
opts.args.unshift('--start', this.start + '')
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const DISPLAY = process.env.DISPLAY
|
|
69
|
+
delete process.env.DISPLAY
|
|
70
|
+
this.tty = new Terminal(opts)
|
|
71
|
+
process.env.DISPLAY = DISPLAY
|
|
72
|
+
|
|
73
|
+
this.on('click', function () {
|
|
74
|
+
self.tty.pty.write('p')
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
// mplayer/mpv cannot resize itself in the terminal, so we have
|
|
78
|
+
// to restart it at the correct start time.
|
|
79
|
+
this.on('resize', function () {
|
|
80
|
+
self.tty.destroy()
|
|
81
|
+
|
|
82
|
+
const opts = {
|
|
83
|
+
parent: self,
|
|
84
|
+
left: 0,
|
|
85
|
+
top: 0,
|
|
86
|
+
width: self.width - self.iwidth,
|
|
87
|
+
height: self.height - self.iheight,
|
|
88
|
+
shell: shell,
|
|
89
|
+
args: args.slice()
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const watched = ((Date.now() / 1000) | 0) - self.now
|
|
93
|
+
self.now = (Date.now() / 1000) | 0
|
|
94
|
+
self.start += watched
|
|
95
|
+
if (shell === 'mplayer') {
|
|
96
|
+
opts.args.unshift('-ss', self.start + '')
|
|
97
|
+
} else if (shell === 'mpv') {
|
|
98
|
+
opts.args.unshift('--start', self.start + '')
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const DISPLAY = process.env.DISPLAY
|
|
102
|
+
delete process.env.DISPLAY
|
|
103
|
+
self.tty = new Terminal(opts)
|
|
104
|
+
process.env.DISPLAY = DISPLAY
|
|
105
|
+
self.screen.render()
|
|
106
|
+
})
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
Object.setPrototypeOf(Video.prototype, Box.prototype)
|
|
110
|
+
|
|
111
|
+
Video.prototype.type = 'video'
|
|
112
|
+
|
|
113
|
+
Video.prototype.exists = function (program) {
|
|
114
|
+
try {
|
|
115
|
+
return !!+cp
|
|
116
|
+
.execSync(
|
|
117
|
+
'type ' + program + ' > /dev/null 2> /dev/null' + ' && echo 1',
|
|
118
|
+
{ encoding: 'utf8' }
|
|
119
|
+
)
|
|
120
|
+
.trim()
|
|
121
|
+
} catch (e) {
|
|
122
|
+
return false
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Expose
|
|
128
|
+
*/
|
|
129
|
+
|
|
130
|
+
module.exports = Video
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Dimitar Zhekov <dimitar.zhekov@gmail.com>
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
Copyright (c) 2014 Dimitar Toshkov Zhekov,
|
|
2
|
+
with Reserved Font Name "Terminus Font".
|
|
3
|
+
|
|
4
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
5
|
+
This license is copied below, and is also available with a FAQ at:
|
|
6
|
+
http://scripts.sil.org/OFL
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
-----------------------------------------------------------
|
|
10
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
11
|
+
-----------------------------------------------------------
|
|
12
|
+
|
|
13
|
+
PREAMBLE
|
|
14
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
15
|
+
development of collaborative font projects, to support the font creation
|
|
16
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
17
|
+
open framework in which fonts may be shared and improved in partnership
|
|
18
|
+
with others.
|
|
19
|
+
|
|
20
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
21
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
22
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
23
|
+
redistributed and/or sold with any software provided that any reserved
|
|
24
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
25
|
+
however, cannot be released under any other type of license. The
|
|
26
|
+
requirement for fonts to remain under this license does not apply
|
|
27
|
+
to any document created using the fonts or their derivatives.
|
|
28
|
+
|
|
29
|
+
DEFINITIONS
|
|
30
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
31
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
32
|
+
include source files, build scripts and documentation.
|
|
33
|
+
|
|
34
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
35
|
+
copyright statement(s).
|
|
36
|
+
|
|
37
|
+
"Original Version" refers to the collection of Font Software components as
|
|
38
|
+
distributed by the Copyright Holder(s).
|
|
39
|
+
|
|
40
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
41
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
42
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
43
|
+
new environment.
|
|
44
|
+
|
|
45
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
46
|
+
writer or other person who contributed to the Font Software.
|
|
47
|
+
|
|
48
|
+
PERMISSION & CONDITIONS
|
|
49
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
50
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
51
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
52
|
+
Software, subject to the following conditions:
|
|
53
|
+
|
|
54
|
+
1) Neither the Font Software nor any of its individual components,
|
|
55
|
+
in Original or Modified Versions, may be sold by itself.
|
|
56
|
+
|
|
57
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
58
|
+
redistributed and/or sold with any software, provided that each copy
|
|
59
|
+
contains the above copyright notice and this license. These can be
|
|
60
|
+
included either as stand-alone text files, human-readable headers or
|
|
61
|
+
in the appropriate machine-readable metadata fields within text or
|
|
62
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
63
|
+
|
|
64
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
65
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
66
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
67
|
+
presented to the users.
|
|
68
|
+
|
|
69
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
70
|
+
Software shall not be used to promote, endorse or advertise any
|
|
71
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
72
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
73
|
+
permission.
|
|
74
|
+
|
|
75
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
76
|
+
must be distributed entirely under this license, and must not be
|
|
77
|
+
distributed under any other license. The requirement for fonts to
|
|
78
|
+
remain under this license does not apply to any document created
|
|
79
|
+
using the Font Software.
|
|
80
|
+
|
|
81
|
+
TERMINATION
|
|
82
|
+
This license becomes null and void if any of the above conditions are
|
|
83
|
+
not met.
|
|
84
|
+
|
|
85
|
+
DISCLAIMER
|
|
86
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
87
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
88
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
89
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
90
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
91
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
92
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
93
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
94
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|