@@ -3,14 +3,15 @@ const fs = require('fs-extra')
33const path = require ( 'path' )
44const helpers = require ( './../parser/lufile/helpers' )
55const luObject = require ( './../parser/lufile/classes/luObject' )
6+
67/* tslint:disable:prefer-for-of no-unused*/
78
8- export async function getLuObjects ( stdin : string , input : string | undefined , recurse = false ) {
9+ export async function getLuObjects ( stdin : string , input : string | undefined , recurse = false , extType : string | undefined ) {
910 let luObjects : any = [ ]
1011 if ( stdin ) {
1112 luObjects . push ( new luObject ( 'stdin' , stdin ) )
1213 } else {
13- let luFiles = await getLuFiles ( input , recurse )
14+ let luFiles = await getLuFiles ( input , recurse , extType )
1415 for ( let i = 0 ; i < luFiles . length ; i ++ ) {
1516 let luContent = await getContentFromFile ( luFiles [ i ] )
1617 luObjects . push ( new luObject ( path . resolve ( luFiles [ i ] ) , luContent ) )
@@ -20,7 +21,7 @@ export async function getLuObjects(stdin: string, input: string | undefined, rec
2021 return luObjects
2122}
2223
23- async function getLuFiles ( input : string | undefined , recurse = false ) : Promise < Array < any > > {
24+ async function getLuFiles ( input : string | undefined , recurse = false , extType : string | undefined ) : Promise < Array < any > > {
2425 let filesToParse = [ ]
2526 let fileStat = await fs . stat ( input )
2627 if ( fileStat . isFile ( ) ) {
@@ -32,10 +33,10 @@ async function getLuFiles(input: string | undefined, recurse = false): Promise<A
3233 throw new CLIError ( 'Sorry, ' + input + ' is not a folder or does not exist' )
3334 }
3435
35- filesToParse = helpers . findLUFiles ( input , recurse )
36+ filesToParse = helpers . findLUFiles ( input , recurse , extType )
3637
3738 if ( filesToParse . length === 0 ) {
38- throw new CLIError ( ' Sorry, no .lu files found in the specified folder.' )
39+ throw new CLIError ( ` Sorry, no ${ extType } files found in the specified folder.` )
3940 }
4041 return filesToParse
4142}
@@ -133,7 +134,7 @@ export async function detectLuContent(stdin: string, input: string) {
133134 }
134135
135136 let inputStat = await fs . stat ( input )
136- return ! inputStat . isFile ( ) ? true : path . extname ( input ) === '.lu'
137+ return ! inputStat . isFile ( ) ? true : ( path . extname ( input ) === '.lu' || path . extname ( input ) === '.qna' )
137138 }
138139
139140 try {
0 commit comments