[CLI] #5147: make -D work like system properties (#5191)

* Issue #5147: allow empty values for properties.

* Issue #5147: Allow multiple `-D` options.

* Issue #5147: take advantage (and demonstrate) the new usage of -D.

* Issue #5147: also update windows script and security ones.
This commit is contained in:
Paŭlo Ebermann
2017-06-16 11:29:44 +02:00
committed by wing328
parent 1f1e92d964
commit ec448a6167
18 changed files with 127 additions and 73 deletions

View File

@@ -12,6 +12,9 @@ import org.slf4j.LoggerFactory;
import static io.swagger.codegen.config.CodegenConfiguratorUtils.*;
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
import java.util.ArrayList;
import java.util.List;
/**
* User: lanwen
* Date: 24.03.15
@@ -48,8 +51,8 @@ public class Generate implements Runnable {
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;
"the format of name=value,name=value (or multiple options, each with name=value)")
private List<String> systemProperties = new ArrayList<>();
@Option(name = {"-c", "--config"}, title = "configuration file", description = "Path to json configuration file. " +
"File content should be in a json format {\"optionKey\":\"optionValue\", \"optionKey1\":\"optionValue1\"...} " +
@@ -229,7 +232,7 @@ public class Generate implements Runnable {
configurator.setRemoveOperationIdPrefix(removeOperationIdPrefix);
}
applySystemPropertiesKvp(systemProperties, configurator);
applySystemPropertiesKvpList(systemProperties, configurator);
applyInstantiationTypesKvp(instantiationTypes, configurator);
applyImportMappingsKvp(importMappings, configurator);
applyTypeMappingsKvp(typeMappings, configurator);