@@ -38,11 +38,13 @@ function parseCliInput() {
3838 . usage ( '([-d <output-dir>] [-s <source-file>]) || (-t <target-file> (-i | -o <output>) [-s <source-file>])' )
3939 . parse ( process . argv ) ;
4040
41- if ( ! program . targetFile ) {
41+ const sourceFile = program . opts ( ) . sourceFile ;
42+
43+ if ( ! program . targetFile ) {
4244 fs . readdirSync ( projectRoot ( LANGUAGE_FILES_LOCATION ) ) . forEach ( file => {
43- if ( ! program . sourceFile . toString ( ) . endsWith ( file ) ) {
45+ if ( ! sourceFile . toString ( ) . endsWith ( file ) ) {
4446 const targetFileLocation = projectRoot ( LANGUAGE_FILES_LOCATION + "/" + file ) ;
45- console . log ( 'Syncing file at: ' + targetFileLocation + ' with source file at: ' + program . sourceFile ) ;
47+ console . log ( 'Syncing file at: ' + targetFileLocation + ' with source file at: ' + sourceFile ) ;
4648 if ( program . outputDir ) {
4749 if ( ! fs . existsSync ( program . outputDir ) ) {
4850 fs . mkdirSync ( program . outputDir ) ;
@@ -67,7 +69,7 @@ function parseCliInput() {
6769 console . log ( program . outputHelp ( ) ) ;
6870 process . exit ( 1 ) ;
6971 }
70- if ( ! checkIfFileExists ( program . sourceFile ) ) {
72+ if ( ! checkIfFileExists ( sourceFile ) ) {
7173 console . error ( 'Path of source file is not valid.' ) ;
7274 console . log ( program . outputHelp ( ) ) ;
7375 process . exit ( 1 ) ;
@@ -101,7 +103,7 @@ function syncFileWithSource(pathToTargetFile, pathToOutputFile) {
101103 targetLines . push ( line . trim ( ) ) ;
102104 } ) ) ;
103105 progressBar . update ( 10 ) ;
104- const sourceFile = readFileIfExists ( program . sourceFile ) ;
106+ const sourceFile = readFileIfExists ( program . opts ( ) . sourceFile ) ;
105107 sourceFile . toString ( ) . split ( "\n" ) . forEach ( ( function ( line ) {
106108 sourceLines . push ( line . trim ( ) ) ;
107109 } ) ) ;
0 commit comments