Skip to content
This repository has been archived by the owner on Nov 4, 2022. It is now read-only.

Commit

Permalink
feat(pull-request): use percentage to calculate colSpan
Browse files Browse the repository at this point in the history
  • Loading branch information
hamxabaig authored and Ryan Garant committed Feb 5, 2019
1 parent 92ffac7 commit 9f6fefc
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/cmds/pull-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,19 +475,28 @@ PullRequest.prototype.printPullsInfoTable_ = function(pulls) {

function generateOneColumnTable() {
const table = new Table()
const colSpan = parseInt(((terminalCols * 0.25) * (terminalCols - 20) / 100) + '');

let tableHead = [
{ content: '#', hAlign: 'center' }, 'Author', 'Opened', { content: 'Status', hAlign: 'center' },
{ content: '#', hAlign: 'center', colSpan },
{ content: 'Author', colSpan },
{ content: 'Opened', colSpan },
{ content: 'Status', hAlign: 'center', colSpan },
]

table.push(tableHead)

pulls.forEach(pull => {
const {createdTime, number, prInfo, user, status} = getColorizedFields(pull, terminalCols - 20)
const {createdTime, number, prInfo, user, status} = getColorizedFields(pull, terminalCols - 10)

table.push(
[{ content: number, hAlign: 'center' }, user, createdTime, { content: status, hAlign: 'center' }],
[ { content: prInfo, colSpan: 4 } ],
[
{ content: number, hAlign: 'center', colSpan },
{ content: user, colSpan },
{ content: createdTime, colSpan },
{ content: status, hAlign: 'center' , colSpan }
],
[ { content: prInfo, colSpan: colSpan * 4 } ],
)

})
Expand Down

0 comments on commit 9f6fefc

Please sign in to comment.