forked from loafle/openapi-generator-original
defaulted sources to go to src/gen/main and added possibility to set impl folder via system property at command-line
This commit is contained in:
@@ -54,10 +54,16 @@ public class Generate implements Runnable {
|
||||
"Pass in a URL-encoded string of name:header with a comma separating multiple values")
|
||||
private String auth;
|
||||
|
||||
@Option( name= {"-D"}, title = "system properties", description = "sets specified system properties in " +
|
||||
"the format of name=value,name=value")
|
||||
private String systemProperties;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
verbosed(verbose);
|
||||
|
||||
setSystemProperties();
|
||||
|
||||
ClientOptInput input = new ClientOptInput();
|
||||
|
||||
if (isNotEmpty(auth)) {
|
||||
@@ -77,6 +83,17 @@ public class Generate implements Runnable {
|
||||
new DefaultGenerator().opts(input.opts(new ClientOpts()).swagger(swagger)).generate();
|
||||
}
|
||||
|
||||
private void setSystemProperties() {
|
||||
if( systemProperties != null && systemProperties.length() > 0 ){
|
||||
for( String property : systemProperties.split(",")) {
|
||||
int ix = property.indexOf('=');
|
||||
if( ix > 0 && ix < property.length()-1 ){
|
||||
System.setProperty( property.substring(0, ix), property.substring(ix+1) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If true parameter, adds system properties which enables debug mode in generator
|
||||
* @param verbose - if true, enables debug mode
|
||||
|
||||
Reference in New Issue
Block a user