@@ -49,11 +49,16 @@ export class PassTroughService {
49
49
50
50
}
51
51
52
- public passTrough = ( args : string [ ] = [ ] ) => spawn ( this . cmd ( ) , args , {
52
+ public passTrough = ( args : string [ ] = [ ] ) => spawn ( this . cmd ( this . processCustomJarParam ( args ) ) , args , {
53
53
stdio : 'inherit' ,
54
54
shell : true
55
55
} ) . on ( 'exit' , process . exit ) ;
56
56
57
+ private processCustomJarParam = ( args : string [ ] ) : string => {
58
+ const jarOptionIndex = args . findIndex ( e => e . startsWith ( '-custom-generator' ) ) ;
59
+ return jarOptionIndex < 0 ? '' : args . splice ( jarOptionIndex , 1 ) [ 0 ] . split ( '=' ) [ 1 ] ;
60
+ }
61
+
57
62
private getCommands = async ( ) : Promise < [ string , string | undefined ] [ ] > => {
58
63
59
64
const [ help , completion ] = ( await Promise . all ( [
@@ -85,8 +90,13 @@ export class PassTroughService {
85
90
} ) ;
86
91
} ) ;
87
92
88
- private cmd ( ) {
89
- return [ 'java' , process . env [ 'JAVA_OPTS' ] , `-jar "${ this . versionManager . filePath ( ) } "` ] . filter ( isString ) . join ( ' ' ) ;
93
+ private cmd ( customJarPath : string = '' ) {
94
+ const cliPath = this . versionManager . filePath ( ) ;
95
+ const cpDelimiter = process . platform === "win32" ? ';' : ':' ;
96
+ const subCmd = customJarPath
97
+ ? `-cp "${ [ customJarPath , cliPath ] . join ( cpDelimiter ) } " org.openapitools.codegen.OpenAPIGenerator`
98
+ : `-jar "${ cliPath } "` ;
99
+ return [ 'java' , process . env [ 'JAVA_OPTS' ] , subCmd ] . filter ( isString ) . join ( ' ' ) ;
90
100
}
91
101
92
102
}
0 commit comments