corrade-nucleus-nucleons – Blame information for rev 20
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
20 | office | 1 | #!/usr/bin/env node |
2 | |||
3 | var path = require("path"); |
||
4 | var program = require("commander"); |
||
5 | var Promise = require("bluebird"); |
||
6 | |||
7 | var editorconfig = require("../editorconfig"); |
||
8 | var package = require("../package.json"); |
||
9 | |||
10 | program.version("EditorConfig Node.js Core Version " + package.version); |
||
11 | |||
12 | program |
||
13 | .usage([ |
||
14 | "[OPTIONS] FILEPATH1 [FILEPATH2 FILEPATH3 ...]", |
||
15 | program._version, |
||
16 | "FILEPATH can be a hyphen (-) if you want path(s) to be read from stdin." |
||
17 | ].join("\n\n ")) |
||
18 | .option("-f <path>", "Specify conf filename other than \".editorconfig\"") |
||
19 | .option("-b <version>", "Specify version (used by devs to test compatibility)") |
||
20 | .option("-v, --version", "Display version information") |
||
21 | .parse(process.argv); |
||
22 | |||
23 | // Throw away the native -V flag in lieu of the one we've manually specified |
||
24 | // to adhere to testing requirements |
||
25 | program.options.shift(); |
||
26 | |||
27 | var files = program.args; |
||
28 | |||
29 | if (!files.length) { |
||
30 | program.help(); |
||
31 | } |
||
32 | |||
33 | Promise.map(files, function(filePath) { |
||
34 | return editorconfig.parse(filePath, {config: program.F, version: program.B}); |
||
35 | }).each(function(parsed, i, length) { |
||
36 | if (length > 1) { |
||
37 | console.log("[%s]", files[i]); |
||
38 | } |
||
39 | Object.keys(parsed).forEach(function(key) { |
||
40 | console.log(key + "=" + parsed[key]); |
||
41 | }); |
||
42 | }); |