1 | var Table = require('cli-table');
|
2 | var _ = require('lodash');
|
3 | var chalk = require('chalk');
|
4 |
|
5 |
|
6 | module.exports = function(program, done) {
|
7 |
|
8 |
|
9 |
|
10 | var profiles = program.globalConfig.profiles;
|
11 | if (_.isArray(profiles) === false || profiles.length === 0) {
|
12 | return console.log("No profiles configured. Add one by running '4front add-profile'");
|
13 | }
|
14 |
|
15 |
|
16 | var table = new Table({
|
17 | head: [chalk.cyan('name'), chalk.cyan('endpoint'), chalk.cyan('default')],
|
18 | colWidths: [25, 35, 10]
|
19 | });
|
20 |
|
21 | _.each(profiles, function(profile) {
|
22 | table.push([profile.name || '', profile.endpoint, profile.default ? 'true' : 'false'])
|
23 | });
|
24 |
|
25 | console.log(table.toString());
|
26 | done();
|
27 | };
|