tty-table
tty-table copied to clipboard
Footer align does not work
Problem Summary
I am trying to align a footer cell to right.
Expected Result (screen shot if possible)
Actual Result (screen shot if possible)

Environment Information
-
OS: latest public macOS
-
Terminal Emulator: iTerm2 with zsh and zprezto plugin
-
Node Version: LTS
Steps to Reproduce
const header = [
{
value: 'Test',
align: 'left',
headerAlign: 'left',
footerAlign: 'right',
},
{
value: 'Score',
align: 'left',
headerAlign: 'left',
footerAlign: 'left',
formatter: (cellValue) => {
return cellValue > 60 ? green(cellValue) : red(cellValue)
},
},
]
const rows = [
['Performance', 64],
['Accessibility', 70],
['Best Practices', 30],
['SEO', 60],
['PWA', 100],
]
const footer = [
'Total',
(cellValue, columnIndex, rowIndex, rowData) => {
const total = Math.round(rowData.map((i) => i[1]).reduce((p, c) => p + c) / 5)
return italic(total)
},
]
const renderedTable = Table(header, rows, footer).render()
console.log(renderedTable)
Thanks for reporting. Feel free to send me in a PR, otherwise it will be a little while before I get to this.