forked from segmentfault/HyperDown.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.js
52 lines (38 loc) · 796 Bytes
/
cli.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
// Generated by CoffeeScript 1.12.7
(function() {
var Fs, Parser, buff, file, html, line, parser, read;
Fs = require('fs');
Parser = require('./Parser');
read = false;
html = false;
line = false;
file = null;
process.argv.forEach(function(val) {
if (val === '-h') {
return html = true;
}
if (val === '-l') {
return line = true;
}
if (read) {
file = val;
return read = false;
} else {
if (val === '-f') {
return read = true;
}
}
});
if (file == null) {
process.exit(1);
}
parser = new Parser;
if (html) {
parser.enableHtml(true);
}
if (line) {
parser.enableLine(true);
}
buff = Fs.readFileSync(file);
console.log(parser.makeHtml(buff.toString()));
}).call(this);