-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathpoeditor-status.js
More file actions
32 lines (27 loc) · 931 Bytes
/
poeditor-status.js
File metadata and controls
32 lines (27 loc) · 931 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 program = require('commander'),
Table = require('cli-table'),
configure = require('./configure'),
POEditorStaging = require('./staging');
program.version("1.0.0")
.description("Displays the current staging are, e.g. Terms that still have to be pushed to the POEditor server");
configure(program).then(function(config) {
var poeditorStaging = new POEditorStaging(config.defaultLanguage);
var stagingData = poeditorStaging.getStagingData();
var table = new Table({
head: ['context', 'term', 'defaultTranslation', 'tags'],
colWidths: [20, 20, 40, 20]
});
Object.keys(stagingData).forEach(term => {
if (stagingData.hasOwnProperty(term)) {
var entry = stagingData[term];
table.push([
entry.context,
entry.term,
entry.defaultTranslation,
entry.tags.join(', ')
]);
}
});
console.log("\n The following data is currently in the staging area:");
console.log(table.toString());
});