@@ -37,12 +37,11 @@ function parseCliInput() {
3737 . option ( '-o, --output-file <output>' , 'where output of script ends up; mutually exclusive with -i' )
3838 . usage ( '([-d <output-dir>] [-s <source-file>]) || (-t <target-file> (-i | -o <output>) [-s <source-file>])' )
3939 . parse ( process . argv ) ;
40-
4140 if ( ! program . targetFile ) {
4241 fs . readdirSync ( projectRoot ( LANGUAGE_FILES_LOCATION ) ) . forEach ( file => {
43- if ( ! program . sourceFile . toString ( ) . endsWith ( file ) ) {
42+ if ( program . opts ( ) . sourceFile && ! program . opts ( ) . sourceFile . toString ( ) . endsWith ( file ) ) {
4443 const targetFileLocation = projectRoot ( LANGUAGE_FILES_LOCATION + "/" + file ) ;
45- console . log ( 'Syncing file at: ' + targetFileLocation + ' with source file at: ' + program . sourceFile ) ;
44+ console . log ( 'Syncing file at: ' + targetFileLocation + ' with source file at: ' + program . opts ( ) . sourceFile ) ;
4645 if ( program . outputDir ) {
4746 if ( ! fs . existsSync ( program . outputDir ) ) {
4847 fs . mkdirSync ( program . outputDir ) ;
@@ -67,7 +66,7 @@ function parseCliInput() {
6766 console . log ( program . outputHelp ( ) ) ;
6867 process . exit ( 1 ) ;
6968 }
70- if ( ! checkIfFileExists ( program . sourceFile ) ) {
69+ if ( ! checkIfFileExists ( program . opts ( ) . sourceFile ) ) {
7170 console . error ( 'Path of source file is not valid.' ) ;
7271 console . log ( program . outputHelp ( ) ) ;
7372 process . exit ( 1 ) ;
@@ -101,7 +100,7 @@ function syncFileWithSource(pathToTargetFile, pathToOutputFile) {
101100 targetLines . push ( line . trim ( ) ) ;
102101 } ) ) ;
103102 progressBar . update ( 10 ) ;
104- const sourceFile = readFileIfExists ( program . sourceFile ) ;
103+ const sourceFile = readFileIfExists ( program . opts ( ) . sourceFile ) ;
105104 sourceFile . toString ( ) . split ( "\n" ) . forEach ( ( function ( line ) {
106105 sourceLines . push ( line . trim ( ) ) ;
107106 } ) ) ;
0 commit comments