1 | #!/bin/env node
|
2 |
|
3 | var repl = require('repl');
|
4 | var ctx = repl.start('>> ').context;
|
5 |
|
6 | var htmllint = require('./');
|
7 |
|
8 |
|
9 | ctx.htmllint = htmllint;
|
10 |
|
11 | ctx.lint = function () {
|
12 | var promise = ctx.htmllint.apply(ctx.htmllint, arguments);
|
13 |
|
14 | function handler(result) {
|
15 | ctx['_'] = result;
|
16 |
|
17 | console.log(result);
|
18 | console.log('You can access the results in the "_" obj');
|
19 | }
|
20 |
|
21 | promise.then(handler, handler);
|
22 | };
|
23 |
|
24 |
|
25 | var parser = ctx.htmllint.defaultLinter.parser;
|
26 | ctx.parse = parser.parse.bind(parser);
|