-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlitpro.js
62 lines (48 loc) · 1.3 KB
/
litpro.js
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env node
/*global process, require */
var mod = require('literate-programming-cli');
var args = mod.opts.parse();
args.build = args.build.map(function (el) {
if (el.slice(-1) === "/") {
return el.slice(0, -1);
} else {
return el;
}
});
var z = {};
args.other.forEach(function (arg) {
var pair = arg.split(":");
if (pair.length === 1) {
args[pair[0]] = true;
} else if (pair.length === 2) {
args[pair[0]] = pair[1];
} else {
args[pair[0]] = pair.slice(1);
}
z[pair[0]] = args[pair[0]];
});
//console.warn("!!", args);
var Folder = mod.Folder;
Folder.inputs = args;
Folder.z = z;
//plugin-to-folder
Folder.prototype.encoding = args.encoding;
Folder.prototype.displayScopes = (args.scopes ? function () {
var folder = this;
var str = '';
Object.keys(folder.scopes).forEach(function (el) {
str += el+ "::\n------\n";
var scope = folder.scopes[el];
Object.keys(scope).sort().forEach(
function (v) {
str+= v + ": '" + scope[v] + "'\n* * *\n";
});
str += "\n------\n";
});
str = str.replace(/\n\n/g, "\n");
console.log(str);
} :
function () {} );
Folder.lprc(args.lprc, args);
Folder.process(args);
process.on('exit', Folder.exit());