UNPKG

mk-paas-cli

Version:

MK PAAS CLI TOOL

34 lines (30 loc) 850 B
const Table = require('cli-table') const chalk = require('chalk') const table = new Table({ head: ['Template Name', 'Owner/Name', 'Branch', 'Type'], style: { head: ['green'], }, }) function tplListTable (tplList, supplementary) { const list = Object.keys(tplList) if (list.length) { list.forEach((value) => { table.push([value, tplList[value]['owner/name'], tplList[value]['branch'], tplList[value]['type']]) if (table.length === list.length) { console.log(table.toString()) if (supplementary) { console.log(chalk.green(`\u2714 ${supplementary}`)) } process.exit() } }) } else { console.log(table.toString()) if (supplementary) { console.log(chalk.green(`\u2714 ${supplementary}`)) } process.exit() } } exports.tplListTable = tplListTable