Skip to content

Commit

Permalink
feat(fancy): move right to the left if length is <= 80
Browse files Browse the repository at this point in the history
  • Loading branch information
pooya parsa committed Feb 23, 2019
1 parent 5821099 commit 34738c7
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/reporters/fancy.js
Expand Up @@ -64,16 +64,18 @@ export default class FancyReporter extends BasicReporter {

const tag = logObj.tag ? secondaryColor(logObj.tag) : ''

let line
let left = this.filterAndJoin([type, message])
let right = this.filterAndJoin([tag, date])

const space = width - stringWidth(left) - stringWidth(right) - 2

let line = space > 0 ? (left + ' '.repeat(space) + right) : left
if (width > 80) {
const space = width - stringWidth(left) - stringWidth(right) - 2
line = space > 0 ? (left + ' '.repeat(space) + right) : left
} else {
line = right + ' ' + left
}

line += additional.length
? '\n' + additional.join('\n')
: ''
line += additional.length ? '\n' + additional.join('\n') : ''

return isBadge ? '\n' + line + '\n' : line
}
Expand Down

0 comments on commit 34738c7

Please sign in to comment.