-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.js
33 lines (30 loc) · 865 Bytes
/
utils.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const Table = require('cli-table')
const chalk = require('chalk')
const table = new Table({
head: ['Template Name', 'Owner/Name', 'Branch'],
style: {
head: ['green']
}
})
function listTable(tplList, lyric) {
const list = Object.keys(tplList)
if (list.length) {
list.forEach((key) => {
table.push([key, tplList[key]['owner/name'], tplList[key]['branch']])
if (table.length === list.length) {
console.log(table.toString())
if (lyric) {
console.log(chalk.green(`\u2714 ${lyric}`))
}
process.exit()
}
})
} else {
console.log(table.toString())
if (lyric) {
console.log(chalk.green(`\u2714 ${lyric}`))
}
process.exit()
}
}
exports.listTable = listTable