1 | var util = require('util');
|
2 |
|
3 | var result = {};
|
4 | var metedataArm = require('../lib/plugins.arm.json');
|
5 | parse(metedataArm, '');
|
6 | var cmdsArm = Object.keys(result);
|
7 | console.log(util.inspect(cmdsArm));
|
8 |
|
9 | console.log('********************************');
|
10 | console.log('Done with ARM');
|
11 | console.log('********************************');
|
12 |
|
13 | result = {};
|
14 | var metedataAsm = require('../lib/plugins.asm.json');
|
15 | parse(metedataAsm, '');
|
16 | var cmdsAsm = Object.keys(result);
|
17 | console.log(util.inspect(cmdsAsm));
|
18 |
|
19 | console.log('********************************');
|
20 | console.log('The total number of commands for xplat-cli in ARM mode is: ' + cmdsArm.length);
|
21 | console.log('The total number of commands for xplat-cli in ASM mode is: ' + cmdsAsm.length);
|
22 | console.log('********************************');
|
23 |
|
24 | function parse(cmdObj, category) {
|
25 | if (cmdObj !== null && typeof cmdObj === 'object') {
|
26 | Object.keys(cmdObj).forEach(function (key) {
|
27 | if (key === 'commands') {
|
28 | cmdObj[key].forEach(function (element) {
|
29 | var fullname = element.filePath + ': ' + category + ' ' + element.name;
|
30 | result[fullname] = fullname;
|
31 | });
|
32 | } else if (key === 'categories') {
|
33 | Object.keys(cmdObj[key]).forEach(function (subCategory) {
|
34 | parse(cmdObj[key][subCategory], category + ' ' + subCategory);
|
35 | });
|
36 | }
|
37 | });
|
38 | }
|
39 | } |
\ | No newline at end of file |