private static void parseInclude ( String line , Pipeline pipeline , String parentFilePath , List < String > cliArgs ) throws ParseException { LOG . info ( "+-parsing include line '{}'" , line ) ; String includeName = line . replaceFirst ( "include: " , "" ) . trim ( ) ; File includeFile = null ; if ( includeName . startsWith ( "/" ) ) { includeFile = new File ( includeName ) ; } else { includeFile = new File ( parentFilePath , includeName ) ; } if ( ! includeFile . exists ( ) ) { String didYouMean = "" ; if ( new File ( parentFilePath , "../" + includeName ) . exists ( ) ) { didYouMean = "\ndid you mean: '../" + includeName + "'" ; } else if ( new File ( parentFilePath , includeName . replaceFirst ( "\\.\\./" , "" ) ) . exists ( ) ) { didYouMean = "\ndid you mean: '" + includeName . replaceFirst ( "\\.\\./" , "" ) + "'" ; } throw new ParseException ( "include file does not exist (" + includeFile . getAbsolutePath ( ) + ") " + didYouMean , - 1 ) ; } try { List < String > includeStr = FileUtils . readLines ( includeFile ) ; includeStr . add ( "" ) ; includeStr . add ( "" ) ; parseAndDispatch ( includeStr , pipeline , includeFile . getParentFile ( ) . getAbsolutePath ( ) , cliArgs ) ; } catch ( IOException e ) { throw new ParseException ( "cannot read include file (" + includeFile . getAbsolutePath ( ) + ")" , - 1 ) ; } }
parse include commands