MXS-2607: Remove trailing spaces in MaxCtrl --tvs mode

As the TSV format uses tabs as delimiters, the trailing spaces would
acutally be interpreted as data.
This commit is contained in:
Markus Mäkelä 2019-07-18 23:40:11 +03:00
parent 146b940245
commit 8e23a6cdb9
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -142,6 +142,9 @@ module.exports = function() {
if (this.argv.tsv) {
// Based on the regex found in: https://github.com/jonschlinkert/strip-color
str = str.replace( /\x1B\[[(?);]{0,2}(;?\d)*./g, '')
// Trim trailing whitespace that cli-table generates
str = str.split(os.EOL).map(s => s.split('\t').map(s => s.trimEnd()).join('\t')).join(os.EOL)
}
return str
}