@@ -30,13 +30,13 @@ const fs = require('fs');
3030const args = process . argv . slice ( 2 ) ;
3131let format = 'json' ;
3232let template = null ;
33- let inputFile = null ;
33+ let filename = null ;
3434let nodeVersion = null ;
3535let analytics = null ;
3636
3737args . forEach ( function ( arg ) {
3838 if ( ! arg . startsWith ( '--' ) ) {
39- inputFile = arg ;
39+ filename = arg ;
4040 } else if ( arg . startsWith ( '--format=' ) ) {
4141 format = arg . replace ( / ^ - - f o r m a t = / , '' ) ;
4242 } else if ( arg . startsWith ( '--template=' ) ) {
@@ -50,41 +50,32 @@ args.forEach(function(arg) {
5050
5151nodeVersion = nodeVersion || process . version ;
5252
53- if ( ! inputFile ) {
53+ if ( ! filename ) {
5454 throw new Error ( 'No input file specified' ) ;
5555}
5656
57- fs . readFile ( inputFile , 'utf8' , function ( er , input ) {
57+ fs . readFile ( filename , 'utf8' , ( er , input ) => {
5858 if ( er ) throw er ;
5959 // process the input for @include lines
60- processIncludes ( inputFile , input , next ) ;
60+ processIncludes ( filename , input , next ) ;
6161} ) ;
6262
6363function next ( er , input ) {
6464 if ( er ) throw er ;
6565 switch ( format ) {
6666 case 'json' :
67- require ( './json.js' ) ( input , inputFile , function ( er , obj ) {
67+ require ( './json.js' ) ( input , filename , ( er , obj ) => {
6868 console . log ( JSON . stringify ( obj , null , 2 ) ) ;
6969 if ( er ) throw er ;
7070 } ) ;
7171 break ;
7272
7373 case 'html' :
74- require ( './html.js' ) (
75- {
76- input : input ,
77- filename : inputFile ,
78- template : template ,
79- nodeVersion : nodeVersion ,
80- analytics : analytics ,
81- } ,
82-
83- function ( er , html ) {
84- if ( er ) throw er ;
85- console . log ( html ) ;
86- }
87- ) ;
74+ require ( './html' ) ( { input, filename, template, nodeVersion, analytics } ,
75+ ( err , html ) => {
76+ if ( err ) throw err ;
77+ console . log ( html ) ;
78+ } ) ;
8879 break ;
8980
9081 default :
0 commit comments