提交 da4eb6a9 编写于 作者: S Serge Rider

Command line processing refactored (process params in right order)

上级 8959b3da
......@@ -16,10 +16,7 @@
*/
package org.jkiss.dbeaver.ui.app.standalone;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.*;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
......@@ -270,8 +267,15 @@ public class DBeaverCommandLine
return false;
}
boolean exit = false;
for (ParameterDescriptor param : customParameters.values()) {
if (commandLine.hasOption(param.name)) {
for (Option cliOption : commandLine.getOptions()) {
ParameterDescriptor param = customParameters.get(cliOption.getOpt());
if (param == null) {
param = customParameters.get(cliOption.getLongOpt());
}
if (param == null) {
log.error("Wrong command line parameter " + cliOption);
continue;
}
try {
if (param.hasArg) {
for (String optValue : commandLine.getOptionValues(param.name)) {
......@@ -291,7 +295,6 @@ public class DBeaverCommandLine
exit = true;
}
}
}
return exit;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册