-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathpoeditor-projects.js
More file actions
32 lines (27 loc) · 957 Bytes
/
poeditor-projects.js
File metadata and controls
32 lines (27 loc) · 957 Bytes
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
var fs = require('fs'),
clc = require('cli-color'),
program = require('commander'),
CLI = require('clui'),
configure = require('./configure'),
utils = require('./utils'),
api = require('./api'),
Table = require('cli-table'),
POEditorStaging = require('./staging');
program.version("1.0.1")
.description("Displays the available projects for the given API-Token");
configure(program).then(function(config) {
api.getProjects(config.apiToken).then(function(response, list){
var table = new Table({
head: ['ID', 'Name', 'Public', 'Open', 'Created'],
colWidths: [15, 50, 10, 10, 40]
});
for(var i=0; i<list.length; i++){
var item = list[i];
table.push([item.id, item.name, item.public, item.open, item.created]);
}
console.log("\n The following projects where retrieved from POEditor:");
console.log(table.toString());
}, function(){
console.log(clc.red("[ERROR] No projects could be retrieved."));
});
});