@@ -2,7 +2,8 @@ var path = require('path'),
22 vow = require ( 'vow' ) ,
33 vfs = require ( 'vow-fs' ) ,
44 HtmlDiffer = require ( './index' ) . HtmlDiffer ,
5- diffLogger = require ( './diff-logger' ) ;
5+ diffLogger = require ( './diff-logger' ) ,
6+ utils = require ( './utils' ) ;
67
78module . exports = require ( 'coa' ) . Cmd ( )
89 . name ( process . argv [ 1 ] )
@@ -26,6 +27,14 @@ module.exports = require('coa').Cmd()
2627 . title ( 'Path to configuration JSON-file' )
2728 . long ( 'config' )
2829 . end ( )
30+ . opt ( )
31+ . name ( 'charsAroundDiff' )
32+ . title ( 'Number of characters around diff' )
33+ . long ( 'chars-around-diff' )
34+ . val ( function ( val ) {
35+ return parseInt ( val ) ;
36+ } )
37+ . end ( )
2938 . arg ( )
3039 . name ( 'path1' )
3140 . title ( 'Path to the 1-st html-file' )
@@ -44,11 +53,13 @@ module.exports = require('coa').Cmd()
4453 ] ) . spread ( function ( html1 , html2 , config ) {
4554 config = config ? JSON . parse ( config ) : { } ;
4655
47- var diffOpts = { ignoreHtmlAttrs : config . ignoreHtmlAttrs || [ ] , compareHtmlAttrsAsJSON : config . compareHtmlAttrsAsJSON } ,
48- logOpts = { showCharacters : config . showCharacters || 20 } ;
56+ var options = utils . defaults ( config ) ,
57+ loggerOptions = {
58+ charsAroundDiff : opts . charsAroundDiff || 20
59+ } ;
4960
50- htmlDiffer = new HtmlDiffer ( diffOpts ) ,
51- diffLogger . log ( htmlDiffer . diffHtml ( html1 , html2 ) , logOpts ) ;
61+ htmlDiffer = new HtmlDiffer ( options ) ,
62+ diffLogger . log ( htmlDiffer . diffHtml ( html1 , html2 ) , loggerOptions ) ;
5263 } ) ;
5364 } )
5465 . run ( process . argv . slice ( 2 ) ) ;
0 commit comments