String globalSettings = cmd.getOptionValue("g");
String shutdownPort = cmd.getOptionValue("s");
String env = cmd.getOptionValue("e");
if (config == null && globalSettings == null) {
throw new ParseArgException("config or global setting is required");
}
if (config != null && globalSettings != null) {
throw new ParseArgException("config and global settings can not be set at the same time");
}
if (globalSettings == null && env != null) {
throw new ParseArgException("environment must be configured with global settings");
}
if (cmd.getArgs().length != 1) {
throw new ParseArgException("only one args allowed");
}
return httpArgs().withPort(getPort(port)).withShutdownPort(getPort(shutdownPort)).withConfigurationFile(config).withSettings(globalSettings).withEnv(env).build();
}