Skip to content

Commit f76d3cd

Browse files
committed
changed table size according to current terminal size
1 parent e39e632 commit f76d3cd

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

bin/helpers/sync/syncSpecsLogs.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,15 @@ let getOptions = (auth, build_id) => {
3131
}
3232

3333
let getTableConfig = () => {
34+
let terminalWidth = (process.stdout.columns)*0.9;
3435
return {
3536
border: getBorderConfig(),
3637
columns: {
3738
1: {alignment: 'center', width: 1},
38-
2: {alignment: 'left', width: 100}
39+
2: {alignment: 'left', width: Math.floor(terminalWidth*0.8)}
3940
},
4041
columnDefault: {
41-
width: 30,
42+
width: Math.floor(terminalWidth*0.2),
4243
},
4344
columnCount: 3,
4445
};

test/unit/bin/helpers/sync/syncSpecsLogs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@ describe("syncSpecsLogs", () => {
9292
syncSpecsLogs.__set__('getBorderConfig', getBorderConfigStub);
9393

9494
let options = getTableConfig();
95-
expect(options.columnDefault.width).to.equal(30);
95+
expect(options.columnDefault.width).to.equal(Math.floor(((process.stdout.columns)*0.9)*0.2));
9696
expect(options.columns[1].alignment).to.equal('center');
9797
expect(options.columns[2].alignment).to.equal('left');
9898
expect(options.columns[1].width).to.equal(1);
99-
expect(options.columns[2].width).to.equal(100);
99+
expect(options.columns[2].width).to.equal(Math.floor(((process.stdout.columns)*0.9)*0.8));
100100
expect(options.columnCount).to.equal(3);
101101
expect(getBorderConfigStub.calledOnce).to.be.true;
102102
});

0 commit comments

Comments
 (0)