zeddemore-logger 2.1.2 → 2.2.2

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.
@@ -1,776 +0,0 @@
1
- // Copyright (c) 2025 by Beardon Services, Inc.
2
-
3
- const _ = require('lodash');
4
- const { MultiBar } = require('cli-progress');
5
-
6
- const { chalkTarget } = require('./color');
7
- const defaults = require('./defaults');
8
- const enums = require('./enums');
9
- require('./typedef');
10
- const ZeddemoreBase = require('./ZeddemoreBase');
11
-
12
- const { chalkFormats: cf, doesEnumInclude, progressBarAlignments: pba } = enums;
13
-
14
- class ZeddemoreProgressMultibar extends ZeddemoreBase {
15
-
16
- #alignment = pba.LEFT;
17
- #autoPadding = false;
18
- #autoPaddingCharacter = ' ';
19
- #barColorBack = null;
20
- #barColorFore = null;
21
- #barColorFormat = cf.HEX;
22
- #barFormat = defaults.progressBarBarFormat;
23
- #clearOnComplete = false;
24
- #completeCharacter = defaults.progressBarCompleteCharacter;
25
- #durationColorBack = null;
26
- #durationColorFore = null;
27
- #durationColorFormat = cf.HEX;
28
- #durationFormat = defaults.progressBarDurationFormat;
29
- #durationFormatted = false;
30
- #durationFormattedFormat = defaults.progressBarDurationFormattedFormat;
31
- #emptyOnZero = false;
32
- #etaBuffer = 10;
33
- #etaColorBack = null;
34
- #etaColorFore = null;
35
- #etaColorFormat = cf.HEX;
36
- #etaFormat = defaults.progressBarEtaFormat;
37
- #etaFormatted = false;
38
- #etaFormattedFormat = defaults.progressBarEtaFormattedFormat;
39
- #forceRedraw = false;
40
- #format = null;
41
- #formatBarFunction = null;
42
- #formatDelimiter = defaults.progressBarDelimiter;
43
- #formatTimeFunction = null;
44
- #formatValueFunction = null;
45
- #fps = 10;
46
- #glue = '';
47
- #hideCursor = true;
48
- #incompleteCharacter = defaults.progressBarIncompleteCharacter;
49
- #info = null;
50
- #label = null;
51
- #lineWrap = false;
52
- /** @type {Metadata} */
53
- #metadata = null;
54
- /** @type {MultiBar} */
55
- #multiBar = null;
56
- #percentageColorBack = null;
57
- #percentageColorFore = null;
58
- #percentageColorFormat = cf.HEX;
59
- #percentageFormat = defaults.progressBarPercentageFormat;
60
- #postfixFormat = defaults.progressBarPostfixFormat;
61
- #prefix = null;
62
- #progressCalculationRelative = false;
63
- #showBar = true;
64
- #showDuration = false;
65
- #showEta = false;
66
- #showPercentage = true;
67
- #showPostfix = true;
68
- #showPrefix = true;
69
- #showTotal = true;
70
- #showValue = true;
71
- #size = 40;
72
- #stream = process.stderr;
73
- #stopOnComplete = true;
74
- #totalFormat = defaults.progressBarTotalFormat;
75
- #valueColorBack = null;
76
- #valueColorFore = null;
77
- #valueColorFormat = cf.HEX;
78
- #valueFormat = defaults.progressBarValueFormat;
79
-
80
- constructor(options) {
81
- super(options);
82
- this.#processOptions(options);
83
- }
84
-
85
- get alignment() {
86
- return this.#alignment;
87
- }
88
-
89
- set alignment(value) {
90
- if (this.#isAlignment(value)) this.#alignment = value;
91
- }
92
-
93
- get autoPadding() {
94
- return this.#autoPadding;
95
- }
96
-
97
- set autoPadding(value) {
98
- if (_.isBoolean(value)) this.#autoPadding = value;
99
- }
100
-
101
- get autoPaddingCharacter() {
102
- return this.#autoPaddingCharacter;
103
- }
104
-
105
- set autoPaddingCharacter(value) {
106
- if (_.isString(value) && (value.length === 1)) this.#autoPaddingCharacter = value;
107
- }
108
-
109
- get barColorBack() {
110
- return this.#barColorBack;
111
- }
112
-
113
- set barColorBack(value) {
114
- if (_.isString(value) && !!value.length) this.#barColorBack = value.trim();
115
- }
116
-
117
- get barColorFore() {
118
- return this.#barColorFore;
119
- }
120
-
121
- set barColorFore(value) {
122
- if (_.isString(value) && !!value.length) this.#barColorFore = value.trim();
123
- }
124
-
125
- get barColorStyle() {
126
- return this.#buildColorStyle(this.#barColorFormat, this.barColorFore, this.barColorBack);
127
- }
128
-
129
- get barFormat() {
130
- return this.#barFormat;
131
- }
132
-
133
- set barFormat(value) {
134
- if (_.isString(value) && !!value.length) this.#barFormat = value;
135
- }
136
-
137
- get clearOnComplete() {
138
- return this.#clearOnComplete;
139
- }
140
-
141
- set clearOnComplete(value) {
142
- if (_.isBoolean(value)) this.#clearOnComplete = value;
143
- }
144
-
145
- get completeCharacter() {
146
- return this.#completeCharacter;
147
- }
148
-
149
- set completeCharacter(value) {
150
- if (_.isString(value) && (value.length === 1)) this.#completeCharacter = value;
151
- }
152
-
153
- get durationColorBack() {
154
- return this.#durationColorBack;
155
- }
156
-
157
- set durationColorBack(value) {
158
- if (_.isString(value) && !!value.length) this.#durationColorBack = value.trim();
159
- }
160
-
161
- get durationColorFore() {
162
- return this.#durationColorFore;
163
- }
164
-
165
- set durationColorFore(value) {
166
- if (_.isString(value) && !!value.length) this.#durationColorFore = value.trim();
167
- }
168
-
169
- get durationColorStyle() {
170
- return this.#buildColorStyle(this.#durationColorFormat, this.durationColorFore, this.durationColorBack);
171
- }
172
-
173
- get durationFormat() {
174
- return this.#durationFormat;
175
- }
176
-
177
- set durationFormat(value) {
178
- if (_.isString(value) && !!value.length) this.#durationFormat = value;
179
- }
180
-
181
- get durationFormatted() {
182
- return this.#durationFormatted;
183
- }
184
-
185
- set durationFormatted(value) {
186
- if (_.isBoolean(value)) this.#durationFormatted = value;
187
- }
188
-
189
- get durationFormattedFormat() {
190
- return this.#durationFormattedFormat;
191
- }
192
-
193
- set durationFormattedFormat(value) {
194
- if (_.isString(value) && !!value.length) this.#durationFormattedFormat = value;
195
- }
196
-
197
- get emptyOnZero() {
198
- return this.#emptyOnZero;
199
- }
200
-
201
- set emptyOnZero(value) {
202
- if (_.isBoolean(value)) this.#emptyOnZero = value;
203
- }
204
-
205
- get etaBuffer() {
206
- return this.#etaBuffer;
207
- }
208
-
209
- set etaBuffer(value) {
210
- if (_.isInteger(value) && (value >= 0)) this.#etaBuffer = value;
211
- }
212
-
213
- get etaColorBack() {
214
- return this.#etaColorBack;
215
- }
216
-
217
- set etaColorBack(value) {
218
- if (_.isString(value) && !!value.length) this.#etaColorBack = value.trim();
219
- }
220
-
221
- get etaColorFore() {
222
- return this.#etaColorFore;
223
- }
224
-
225
- set etaColorFore(value) {
226
- if (_.isString(value) && !!value.length) this.#etaColorFore = value.trim();
227
- }
228
-
229
- get etaColorStyle() {
230
- return this.#buildColorStyle(this.#etaColorFormat, this.etaColorFore, this.etaColorBack);
231
- }
232
-
233
- get etaFormat() {
234
- return this.#etaFormat;
235
- }
236
-
237
- set etaFormat(value) {
238
- if (_.isString(value) && !!value.length) this.#etaFormat = value;
239
- }
240
-
241
- get etaFormatted() {
242
- return this.#etaFormatted;
243
- }
244
-
245
- set etaFormatted(value) {
246
- if (_.isBoolean(value)) this.#etaFormatted = value;
247
- }
248
-
249
- get etaFormattedFormat() {
250
- return this.#etaFormattedFormat;
251
- }
252
-
253
- set etaFormattedFormat(value) {
254
- if (_.isString(value) && !!value.length) this.#etaFormattedFormat = value;
255
- }
256
-
257
- get forceRedraw() {
258
- return this.#forceRedraw;
259
- }
260
-
261
- set forceRedraw(value) {
262
- if (_.isBoolean(value)) this.#forceRedraw = value;
263
- }
264
-
265
- get format() {
266
- if (!!this.#format) return this.#format;
267
- return this.#buildFormat();
268
- }
269
-
270
- set format(value) {
271
- if (_.isString(value)) this.#format = value.trim();
272
- }
273
-
274
- get formatBarFunction() {
275
- return this.#formatBarFunction;
276
- }
277
-
278
- set formatBarFunction(value) {
279
- if (_.isFunction(value)) this.#formatBarFunction = value;
280
- }
281
-
282
- get formatDelimiter() {
283
- return this.#formatDelimiter;
284
- }
285
-
286
- set formatDelimiter(value) {
287
- if (_.isString(value)) this.#formatDelimiter = value;
288
- }
289
-
290
- get formatTimeFunction() {
291
- return this.#formatTimeFunction;
292
- }
293
-
294
- set formatTimeFunction(value) {
295
- if (_.isFunction(value)) this.#formatTimeFunction = value;
296
- }
297
-
298
- get formatValueFunction() {
299
- return this.#formatValueFunction;
300
- }
301
-
302
- set formatValueFunction(value) {
303
- if (_.isFunction(value)) this.#formatValueFunction = value;
304
- }
305
-
306
- get fps() {
307
- return this.#fps;
308
- }
309
-
310
- set fps(value) {
311
- if (_.isInteger(value) && (value > 0)) this.#fps = value;
312
- }
313
-
314
- get glue() {
315
- return this.#glue;
316
- }
317
-
318
- set glue(value) {
319
- if (_.isString(value)) this.#glue = value;
320
- }
321
-
322
- get hasBarColor() {
323
- return !!this.#barColorFore || !!this.#barColorBack;
324
- }
325
-
326
- get hasDurationColor() {
327
- return !!this.#durationColorFore || !!this.#durationColorBack;
328
- }
329
-
330
- get hasEtaColor() {
331
- return !!this.#etaColorFore || !!this.#etaColorBack;
332
- }
333
-
334
- get hasFormatBar() {
335
- return _.isFunction(this.#formatBarFunction);
336
- }
337
-
338
- get hasFormatTime() {
339
- return _.isFunction(this.#formatTimeFunction);
340
- }
341
-
342
- get hasFormatValue() {
343
- return _.isFunction(this.#formatValueFunction);
344
- }
345
-
346
- get hasMultiBar() {
347
- return (this.#multiBar instanceof MultiBar);
348
- }
349
-
350
- get hasPercentageColor() {
351
- return !!this.#percentageColorFore || !!this.#percentageColorBack;
352
- }
353
-
354
- get hasValueColor() {
355
- return !!this.#valueColorFore || !!this.#valueColorBack;
356
- }
357
-
358
- get hideCursor() {
359
- return this.#hideCursor;
360
- }
361
-
362
- set hideCursor(value) {
363
- if (_.isBoolean(value)) this.#hideCursor = value;
364
- }
365
-
366
- get incompleteCharacter() {
367
- return this.#incompleteCharacter;
368
- }
369
-
370
- set incompleteCharacter(value) {
371
- if (_.isString(value) && (value.length === 1)) this.#incompleteCharacter = value;
372
- }
373
-
374
- get info() {
375
- return this.#info;
376
- }
377
-
378
- set info(value) {
379
- if (_.isObject(value)) this.#info = value;
380
- }
381
-
382
- get label() {
383
- return this.#label;
384
- }
385
-
386
- set label(value) {
387
- if (_.isString(value) && !!value.length) this.#label = value.trim();
388
- }
389
-
390
- get lineWrap() {
391
- return this.#lineWrap;
392
- }
393
-
394
- set lineWrap(value) {
395
- if (_.isBoolean(value)) this.#lineWrap = value;
396
- }
397
-
398
- get metadata() {
399
- return this.info ? this.info.metadata : { };
400
- }
401
-
402
- set metadata(value) {
403
- if (_.isObject(value)) this.#metadata = this._structureMetadata(value);
404
- }
405
-
406
- get multiBar() {
407
- return this.#multiBar;
408
- }
409
-
410
- get percentageColorBack() {
411
- return this.#percentageColorBack;
412
- }
413
-
414
- set percentageColorBack(value) {
415
- if (_.isString(value) && !!value.length) this.#percentageColorBack = value.trim();
416
- }
417
-
418
- get percentageColorFore() {
419
- return this.#percentageColorFore;
420
- }
421
-
422
- set percentageColorFore(value) {
423
- if (_.isString(value) && !!value.length) this.#percentageColorFore = value.trim();
424
- }
425
-
426
- get percentageColorStyle() {
427
- return this.#buildColorStyle(this.#percentageColorFormat, this.percentageColorFore, this.percentageColorBack);
428
- }
429
-
430
- get percentageFormat() {
431
- return this.#percentageFormat;
432
- }
433
-
434
- set percentageFormat(value) {
435
- if (_.isString(value) && !!value.length) this.#percentageFormat = value;
436
- }
437
-
438
- get postfixFormat() {
439
- return this.#postfixFormat;
440
- }
441
-
442
- set postfixFormat(value) {
443
- if (_.isString(value) && !!value.length) this.#postfixFormat = value;
444
- }
445
-
446
- get prefix() {
447
- if (_.isString(this.#prefix) && !!this.#prefix.length) return this.#prefix;
448
- this.#prefix = this._buildLogMessagePrefix(null, this.metadata, this.colorize);
449
- return this.#prefix;
450
- }
451
-
452
- set prefix(value) {
453
- if (_.isString(value)) this.#prefix = value.trim();
454
- }
455
-
456
- get progressCalculationRelative() {
457
- return this.#progressCalculationRelative;
458
- }
459
-
460
- set progressCalculationRelative(value) {
461
- if (_.isBoolean(value)) this.#progressCalculationRelative = value;
462
- }
463
-
464
- get showBar() {
465
- return this.#showBar;
466
- }
467
-
468
- set showBar(value) {
469
- if (_.isBoolean(value)) this.#showBar = value;
470
- }
471
-
472
- get showDuration() {
473
- return this.#showDuration;
474
- }
475
-
476
- set showDuration(value) {
477
- if (_.isBoolean(value)) this.#showDuration = value;
478
- }
479
-
480
- get showEta() {
481
- return this.#showEta;
482
- }
483
-
484
- set showEta(value) {
485
- if (_.isBoolean(value)) this.#showEta = value;
486
- }
487
-
488
- get showPercentage() {
489
- return this.#showPercentage;
490
- }
491
-
492
- set showPercentage(value) {
493
- if (_.isBoolean(value)) this.#showPercentage = value;
494
- }
495
-
496
- get showPostfix() {
497
- return this.#showPostfix;
498
- }
499
-
500
- set showPostfix(value) {
501
- if (_.isBoolean(value)) this.#showPostfix = value;
502
- }
503
-
504
- get showPrefix() {
505
- return this.#showPrefix;
506
- }
507
-
508
- set showPrefix(value) {
509
- if (_.isBoolean(value)) this.#showPrefix = value;
510
- }
511
-
512
- get showTotal() {
513
- return this.#showTotal;
514
- }
515
-
516
- set showTotal(value) {
517
- if (_.isBoolean(value)) this.#showTotal = value;
518
- }
519
-
520
- get showValue() {
521
- return this.#showValue;
522
- }
523
-
524
- set showValue(value) {
525
- if (_.isBoolean(value)) this.#showValue = value;
526
- }
527
-
528
- get size() {
529
- return this.#size;
530
- }
531
-
532
- set size(value) {
533
- if (_.isInteger(value) && (value > 0)) this.#size = value;
534
- }
535
-
536
- get stream() {
537
- return this.#stream;
538
- }
539
-
540
- set stream(value) {
541
- if (_.isObject(value) && (value.write || value.writable)) this.#stream = value;
542
- }
543
-
544
- get stopOnComplete() {
545
- return this.#stopOnComplete;
546
- }
547
-
548
- set stopOnComplete(value) {
549
- if (_.isBoolean(value)) this.#stopOnComplete = value;
550
- }
551
-
552
- get totalFormat() {
553
- return this.#totalFormat;
554
- }
555
-
556
- set totalFormat(value) {
557
- if (_.isString(value) && !!value.length) this.#totalFormat = value;
558
- }
559
-
560
- get valueColorBack() {
561
- return this.#valueColorBack;
562
- }
563
-
564
- set valueColorBack(value) {
565
- if (_.isString(value) && !!value.length) this.#valueColorBack = value.trim();
566
- }
567
-
568
- get valueColorFore() {
569
- return this.#valueColorFore;
570
- }
571
-
572
- set valueColorFore(value) {
573
- if (_.isString(value) && !!value.length) this.#valueColorFore = value.trim();
574
- }
575
-
576
- get valueColorStyle() {
577
- return this.#buildColorStyle(this.#valueColorFormat, this.valueColorFore, this.valueColorBack);
578
- }
579
-
580
- get valueFormat() {
581
- return this.#valueFormat;
582
- }
583
-
584
- set valueFormat(value) {
585
- if (_.isString(value) && !!value.length) this.#valueFormat = value;
586
- }
587
-
588
- add(total, startValue = 0, payload = { }, barOptions = { }) {
589
- barOptions = barOptions || { };
590
- if (!this.hasMultiBar) {
591
- this.#multiBar = this.#createMultiBar(barOptions);
592
- }
593
- return this.multiBar.create(total, startValue, payload, barOptions);
594
- }
595
-
596
- #buildColorStyle(format, fore, back) {
597
- if (!doesEnumInclude(enums.chalkFormats, format) || ((!_.isString(fore) || !fore.length) && (!_.isString(back) || !back.length))) return null;
598
- return { format, fore, back };
599
- }
600
-
601
- #buildFormat() {
602
- const parts = [ ];
603
- if (this.showPrefix && !!this.prefix) parts.push(this.prefix);
604
- if (this.showBar) {
605
- const bar = this.hasBarColor ? chalkTarget(this.barFormat, this.barColorStyle) : this.barFormat;
606
- parts.push(bar);
607
- }
608
- if (this.showPercentage) {
609
- const percentage = this.hasPercentageColor ? chalkTarget(this.percentageFormat, this.percentageColorStyle) : this.percentageFormat;
610
- parts.push(percentage);
611
- }
612
- if (this.showDuration) {
613
- const tag = this.durationFormatted ? this.durationFormattedFormat : this.durationFormat;
614
- const duration = 'Elapsed: ' + (this.hasDurationColor ? chalkTarget(tag, this.durationColorStyle) : tag);
615
- parts.push(`${ this.formatDelimiter } ${ duration }`);
616
- }
617
- if (this.showEta) {
618
- const tag = this.etaFormatted ? this.etaFormattedFormat : this.etaFormat;
619
- const eta = 'ETA: ' + (this.hasEtaColor ? chalkTarget(tag, this.etaColorStyle) : tag);
620
- parts.push(`${ this.formatDelimiter } ${ eta }`);
621
- }
622
- if (this.showValue) {
623
- const valueParts = [ ];
624
- const value = this.hasValueColor ? chalkTarget(this.valueFormat, this.valueColorStyle) : this.valueFormat;
625
- valueParts.push(`${ this.formatDelimiter } ${ value }`);
626
- if (this.showTotal) {
627
- const total = '/' + (this.hasValueColor ? chalkTarget(this.totalFormat, this.valueColorStyle) : this.totalFormat);
628
- valueParts.push(total);
629
- }
630
- parts.push(valueParts.join(''));
631
- }
632
- if (this.showPostfix) parts.push(`${ this.formatDelimiter } ${ this.postfixFormat }`);
633
- return parts.join(' ').trim();
634
- }
635
-
636
- #buildMultiBarOptions(options) {
637
- options = options || { };
638
- const defaultOptions = {
639
- fps: this.fps,
640
- stream: this.stream,
641
- stopOnComplete: this.stopOnComplete,
642
- clearOnComplete: this.clearOnComplete,
643
- barsize: this.size,
644
- align: this.alignment,
645
- hideCursor: this.hideCursor,
646
- linewrap: this.lineWrap,
647
- gracefulExit: this.gracefulExit,
648
- etaBuffer: this.etaBuffer,
649
- progressCalculationRelative: this.progressCalculationRelative,
650
- emptyOnZero: this.emptyOnZero,
651
- forceRedraw: this.forceRedraw,
652
- barGlue: this.glue,
653
- autopadding: this.autoPadding,
654
- autopaddingCharacter: this.autoPaddingCharacter,
655
- };
656
- if (this.hasFormatBar) defaultOptions.formatBar = this.formatBarFunction;
657
- if (this.hasFormatTime) defaultOptions.formatTime = this.formatTimeFunction;
658
- if (this.hasFormatValue) defaultOptions.formatValue = this.formatValueFunction;
659
- return _.defaults(defaultOptions, options);
660
- }
661
-
662
- #buildPreset(options) {
663
- options = options || { };
664
- const defaultOptions = {
665
- format: this.format,
666
- barCompleteChar: this.completeCharacter,
667
- barIncompleteChar: this.incompleteCharacter,
668
- };
669
- return _.defaults(defaultOptions, options);
670
- }
671
-
672
- #createMultiBar(barOptions) {
673
- const _barOptions = this.#buildMultiBarOptions(barOptions);
674
- const _barPreset = this.#buildPreset(barOptions);
675
- return new MultiBar(_barOptions, _barPreset);
676
- }
677
-
678
- #isAlignment(value) {
679
- return doesEnumInclude(enums.progressBarAlignments, value);
680
- }
681
-
682
- log(...args) {
683
- if (!this.hasMultiBar) return;
684
- return this.multiBar.log(...args);
685
- }
686
-
687
- #processOptions(options) {
688
- options = options || { };
689
- this.alignment = options.alignment || options.align;
690
- this.autoPadding = options.autoPadding;
691
- this.autoPaddingCharacter = options.autoPaddingCharacter;
692
- this.barColorBack = options.barColorBack;
693
- this.barColorFore = options.barColorFore;
694
- this.barFormat = options.barFormat;
695
- this.clearOnComplete = options.clearOnComplete;
696
- this.completeCharacter = options.completeCharacter || options.barCompleteChar;
697
- this.durationColorBack = options.durationColorBack;
698
- this.durationColorFore = options.durationColorFore;
699
- this.durationFormat = options.durationFormat;
700
- this.durationFormatted = options.durationFormatted;
701
- this.durationFormattedFormat = options.durationFormattedFormat;
702
- this.emptyOnZero = options.emptyOnZero;
703
- this.etaBuffer = options.etaBuffer;
704
- this.etaColorBack = options.etaColorBack;
705
- this.etaColorFore = options.etaColorFore;
706
- this.etaFormat = options.etaFormat;
707
- this.etaFormatted = options.etaFormatted;
708
- this.etaFormattedFormat = options.etaFormattedFormat;
709
- this.forceRedraw = options.forceRedraw;
710
- this.format = options.format;
711
- this.formatBarFunction = options.formatBarFunction || options.formatBar;
712
- this.formatDelimiter = options.formatDelimiter;
713
- this.formatTimeFunction = options.formatTimeFunction || options.formatTime;
714
- this.formatValueFunction = options.formatValueFunction || options.formatValue;
715
- this.fps = options.fps;
716
- this.glue = options.glue || options.barGlue;
717
- this.hideCursor = options.hideCursor;
718
- this.incompleteCharacter = options.incompleteCharacter || options.barIncompleteChar;
719
- this.lineWrap = options.lineWrap || options.linewrap;
720
- this.metadata = options.metadata;
721
- this.percentageColorBack = options.percentageColorBack;
722
- this.percentageColorFore = options.percentageColorFore;
723
- this.percentageFormat = options.percentageFormat;
724
- this.postfixFormat = options.postfixFormat;
725
- this.prefix = options.prefix;
726
- this.progressCalculationRelative = options.progressCalculationRelative;
727
- this.showBar = options.showBar;
728
- this.showDuration = options.showDuration;
729
- this.showEta = options.showEta;
730
- this.showPercentage = options.showPercentage;
731
- this.showPostfix = options.showPostfix;
732
- this.showPrefix = options.showPrefix;
733
- this.showTotal = options.showTotal;
734
- this.showValue = options.showValue;
735
- this.size = options.size;
736
- this.stream = options.stream;
737
- this.stopOnComplete = options.stopOnComplete;
738
- this.totalFormat = options.totalFormat;
739
- this.valueColorBack = options.valueColorBack;
740
- this.valueColorFore = options.valueColorFore;
741
- this.valueFormat = options.valueFormat;
742
- this.#setInfo(options);
743
- }
744
-
745
- remove(bar) {
746
- if (!this.hasMultiBar) return;
747
- return this.multiBar.remove(bar);
748
- }
749
-
750
- #setInfo(options) {
751
- options = options || { };
752
- const label = _.isString(options.label) ? options.label.trim() : this.defaultLabel;
753
- this.colorize = options.colorize || this.colorize;
754
- this.label = label;
755
- this.timestampFormat = options.timestampFormat;
756
- const id = options.id || null;
757
- const ip = options.ip || null;
758
- const user = options.user || null;
759
- const metadata = { ...options, label };
760
- this.info = {
761
- id,
762
- ip,
763
- label,
764
- metadata,
765
- user,
766
- };
767
- }
768
-
769
- stop() {
770
- if (!this.hasMultiBar) return;
771
- return this.multiBar.stop();
772
- }
773
-
774
- }
775
-
776
- module.exports = ZeddemoreProgressMultibar;