@@ -9,13 +9,13 @@ const fs = require('fs');
99const args = process . argv . slice ( 2 ) ;
1010let format = 'json' ;
1111let template = null ;
12- let inputFile = null ;
12+ let filename = null ;
1313let nodeVersion = null ;
1414let analytics = null ;
1515
1616args . forEach ( function ( arg ) {
1717 if ( ! arg . startsWith ( '--' ) ) {
18- inputFile = arg ;
18+ filename = arg ;
1919 } else if ( arg . startsWith ( '--format=' ) ) {
2020 format = arg . replace ( / ^ - - f o r m a t = / , '' ) ;
2121 } else if ( arg . startsWith ( '--template=' ) ) {
@@ -29,42 +29,33 @@ args.forEach(function(arg) {
2929
3030nodeVersion = nodeVersion || process . version ;
3131
32- if ( ! inputFile ) {
32+ if ( ! filename ) {
3333 throw new Error ( 'No input file specified' ) ;
3434}
3535
36- console . error ( 'Input file = %s' , inputFile ) ;
37- fs . readFile ( inputFile , 'utf8' , function ( er , input ) {
36+ console . error ( 'Input file = %s' , filename ) ;
37+ fs . readFile ( filename , 'utf8' , ( er , input ) => {
3838 if ( er ) throw er ;
3939 // process the input for @include lines
40- processIncludes ( inputFile , input , next ) ;
40+ processIncludes ( filename , input , next ) ;
4141} ) ;
4242
4343function next ( er , input ) {
4444 if ( er ) throw er ;
4545 switch ( format ) {
4646 case 'json' :
47- require ( './json.js' ) ( input , inputFile , function ( er , obj ) {
47+ require ( './json.js' ) ( input , filename , ( er , obj ) => {
4848 console . log ( JSON . stringify ( obj , null , 2 ) ) ;
4949 if ( er ) throw er ;
5050 } ) ;
5151 break ;
5252
5353 case 'html' :
54- require ( './html.js' ) (
55- {
56- input : input ,
57- filename : inputFile ,
58- template : template ,
59- nodeVersion : nodeVersion ,
60- analytics : analytics ,
61- } ,
62-
63- function ( er , html ) {
64- if ( er ) throw er ;
65- console . log ( html ) ;
66- }
67- ) ;
54+ require ( './html' ) ( { input, filename, template, nodeVersion, analytics } ,
55+ ( err , html ) => {
56+ if ( err ) throw err ;
57+ console . log ( html ) ;
58+ } ) ;
6859 break ;
6960
7061 default :
0 commit comments