Socket
Socket
Sign inDemoInstall

listr2

Package Overview
Dependencies
Maintainers
1
Versions
232
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

listr2 - npm Package Compare versions

Comparing version 1.2.14 to 1.2.15

8

dist/interfaces/listr.interface.d.ts

@@ -16,2 +16,3 @@ /// <reference types="node" />

export interface ListrTaskObject<Ctx> extends Observable<ListrEvent> {
id: string;
title?: string;

@@ -27,2 +28,3 @@ output?: string;

collapse?: boolean;
bottomBar: boolean | number;
hasSubtasks(): boolean;

@@ -34,2 +36,3 @@ isPending(): boolean;

isBottomBar(): boolean;
hasPersistentBottomBar(): boolean;
isPrompt(): boolean;

@@ -44,3 +47,4 @@ hasFailed(): boolean;

enabled?: boolean | ((ctx: Ctx) => boolean | Promise<boolean>);
bottomBar?: boolean;
bottomBar?: boolean | number;
persistentBottomBar?: boolean;
}

@@ -64,3 +68,3 @@ export interface ListrTaskWrapper<Ctx = ListrContext> {

collapse?: boolean;
bottomBarItems?: number;
clearOutput?: boolean;
ctx?: Ctx;

@@ -67,0 +71,0 @@ }

@@ -68,3 +68,3 @@ "use strict";

buffer += data;
const deleteMultiLineRegexp = new RegExp(/.*(\u001b\[.*G|\u0007).*/m);
const deleteMultiLineRegexp = new RegExp(/.*(\u001b\[.([0-9])G|\u0007).*/m);
if (deleteMultiLineRegexp.test(buffer.toString())) {

@@ -71,0 +71,0 @@ buffer = Buffer.alloc(64);

@@ -8,2 +8,3 @@ import { Subject } from 'rxjs';

options: ListrOptions;
id: ListrTaskObject<Ctx>['id'];
title: ListrTaskObject<Ctx>['title'];

@@ -18,4 +19,5 @@ output: ListrTaskObject<Ctx>['output'];

showSubtasks: boolean;
bottomBar: boolean | number;
private persistentBottomBar;
private enabled;
private bottomBar;
private enabledFn;

@@ -32,2 +34,3 @@ constructor(listr: Listr<Ctx>, tasks: ListrTask, options: ListrOptions);

isBottomBar(): boolean;
hasPersistentBottomBar(): boolean;
hasTitle(): boolean;

@@ -34,0 +37,0 @@ isPrompt(): boolean;

@@ -13,2 +13,3 @@ "use strict";

const stream_1 = require("stream");
const uuid_1 = require("uuid");
const state_constants_1 = require("../constants/state.constants");

@@ -20,3 +21,3 @@ const listr_interface_1 = require("../interfaces/listr.interface");

constructor(listr, tasks, options) {
var _a, _b, _c, _d;
var _a, _b, _c, _d, _e;
super();

@@ -26,2 +27,3 @@ this.listr = listr;

this.options = options;
this.id = uuid_1.v4();
this.title = (_a = this.tasks) === null || _a === void 0 ? void 0 : _a.title;

@@ -31,5 +33,6 @@ this.task = this.tasks.task;

this.showSubtasks = this.options.showSubtasks;
this.skip = ((_b = this.tasks) === null || _b === void 0 ? void 0 : _b.skip) || (() => false);
this.bottomBar = (_c = this.tasks) === null || _c === void 0 ? void 0 : _c.bottomBar;
this.enabledFn = ((_d = this.tasks) === null || _d === void 0 ? void 0 : _d.enabled) || (() => true);
this.persistentBottomBar = (_b = this.tasks) === null || _b === void 0 ? void 0 : _b.persistentBottomBar;
this.skip = ((_c = this.tasks) === null || _c === void 0 ? void 0 : _c.skip) || (() => false);
this.bottomBar = (_d = this.tasks) === null || _d === void 0 ? void 0 : _d.bottomBar;
this.enabledFn = ((_e = this.tasks) === null || _e === void 0 ? void 0 : _e.enabled) || (() => true);
}

@@ -77,4 +80,9 @@ set state$(state) {

isBottomBar() {
return this.bottomBar;
if (typeof (this === null || this === void 0 ? void 0 : this.bottomBar) === 'number' || typeof this.bottomBar === 'boolean') {
return true;
}
}
hasPersistentBottomBar() {
return this.persistentBottomBar;
}
hasTitle() {

@@ -81,0 +89,0 @@ return typeof (this === null || this === void 0 ? void 0 : this.title) === 'string';

@@ -24,2 +24,3 @@ "use strict";

collapse: true,
clearOutput: false
}, options);

@@ -26,0 +27,0 @@ this.concurrency = 1;

@@ -8,3 +8,2 @@ import { ListrOptions, ListrRenderer, ListrTaskObject } from '../interfaces/listr.interface';

private indentation;
private bottomBarItems;
private bottomBar;

@@ -11,0 +10,0 @@ private promptBar;

@@ -18,4 +18,3 @@ "use strict";

this.indentation = 2;
this.bottomBar = [];
this.bottomBarItems = this.options.bottomBarItems || 3;
this.bottomBar = {};
}

@@ -36,4 +35,9 @@ render() {

}
log_update_1.default(this.multiLineRenderer(this.tasks));
log_update_1.default.done();
log_update_1.default(this.multiLineRenderer(this.tasks), this.renderBottomBar());
if (this.options.clearOutput) {
log_update_1.default.clear();
}
else {
log_update_1.default.done();
}
cli_cursor_1.default.show();

@@ -55,5 +59,10 @@ }

const data = this.dumpData(task.output, -1);
if (!(data === null || data === void 0 ? void 0 : data.some((element) => this.bottomBar.includes(element)))) {
this.bottomBar = [...this.bottomBar, ...data];
if (!this.bottomBar[task.id]) {
this.bottomBar[task.id] = {};
this.bottomBar[task.id].data = [];
this.bottomBar[task.id].items = typeof task.bottomBar === 'boolean' ? 1 : task.bottomBar;
}
if (!(data === null || data === void 0 ? void 0 : data.some((element) => this.bottomBar[task.id].data.includes(element)))) {
this.bottomBar[task.id].data = [...this.bottomBar[task.id].data, ...data];
}
}

@@ -76,3 +85,5 @@ else {

this.promptBar = null;
this.bottomBar = [];
if (!task.hasPersistentBottomBar()) {
delete this.bottomBar[task.id];
}
}

@@ -84,5 +95,12 @@ }

renderBottomBar() {
if (this.bottomBar.length > 0) {
this.bottomBar = this.bottomBar.slice(-this.bottomBarItems);
return ['\n', ...this.bottomBar].join('\n');
if (Object.keys(this.bottomBar).length > 0) {
this.bottomBar = Object.keys(this.bottomBar).reduce((o, key) => {
if (!(o === null || o === void 0 ? void 0 : o[key])) {
o[key] = {};
}
o[key].data = this.bottomBar[key].data.slice(-this.bottomBar[key].items);
return o;
}, {});
const returnRender = Object.values(this.bottomBar).reduce((o, value) => o = [...o, ...value.data], []);
return ['\n', ...returnRender].join('\n');
}

@@ -89,0 +107,0 @@ }

{
"name": "listr2",
"version": "1.2.14",
"version": "1.2.15",
"description": "Terminal task list reborn!",

@@ -63,3 +63,4 @@ "license": "MIT",

"rxjs": "^6.3.3",
"through": "^2.3.8"
"through": "^2.3.8",
"uuid": "^7.0.2"
},

@@ -66,0 +67,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc