Skip to content

Commit

Permalink
CLI: minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
xnbox committed Sep 11, 2021
1 parent 2c05cd0 commit 55b6ee8
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/org/tommy/main/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class Main {
private static final String ARGS_HELP_OPTION = "--help";
private static final String ARGS_PORT_OPTION = "--port";
private static final String ARGS_PORT_SSL_OPTION = "--port-ssl";
private static final String ARGS_REDIRECT_OPTION = "--redirect";
private static final String ARGS_NO_REDIRECT_OPTION = "--no-redirect";
private static final String ARGS_CONTEXT_PATH_OPTION = "--context-path";

public static void main(String[] args) throws Throwable {
Expand All @@ -85,7 +85,7 @@ public static void main(String[] args) throws Throwable {
Integer sslPort = null;
String contextPath = "/";
boolean help = false;
boolean redirect = false;
boolean noRedirect = false;

for (int i = 1; i < args.length; i++) {
if (args[i].equals(ARGS_APP_OPTION)) {
Expand Down Expand Up @@ -117,8 +117,8 @@ public static void main(String[] args) throws Throwable {
} catch (Throwable e) {
// ignore exception
}
} else if (args[i].equals(ARGS_REDIRECT_OPTION))
redirect = true;
} else if (args[i].equals(ARGS_NO_REDIRECT_OPTION))
noRedirect = true;
else if (args[i].equals(ARGS_HELP_OPTION))
help = true;
}
Expand All @@ -140,18 +140,18 @@ else if (args[i].equals(ARGS_HELP_OPTION))
sb.append("\n");
sb.append(" OS: " + SystemProperties.OS_NAME + " (" + SystemProperties.OS_ARCH + ")" + '\n');
sb.append(" JVM: " + SystemProperties.JAVA_JAVA_VM_NAME + " (" + SystemProperties.JAVA_JAVA_VERSION + ")\n");
sb.append("\n");
sb.append(" Usage:\n");
sb.append("\n");
sb.append(" java -jar tommy.jar [options] [custom arg]...\n");
sb.append("\n");
sb.append(" Options:\n");
sb.append(" --help print help message\n");
sb.append(" \n");
sb.append(" Usage: \n");
sb.append(" \n");
sb.append(" java -jar tommy.jar [options] [custom arg]... \n");
sb.append(" \n");
sb.append(" Options: \n");
sb.append(" --help print help message \n");
sb.append(" --app <file|dir|URL> run app from ZIP or WAR archive, directory or URL\n");
sb.append(" --port <number> HTTP TCP port number, default: 8080\n");
sb.append(" --port-ssl <number> HTTPS TCP port number, default: 8443\n");
sb.append(" --redirect redirect HTTP to HTTPS\n");
sb.append(" --context-path <string> context path, default: /\n");
sb.append(" --port <number> HTTP TCP port number, default: 8080 \n");
sb.append(" --port-ssl <number> HTTPS TCP port number, default: 8443 \n");
sb.append(" --no-redirect disable redirect HTTP to HTTPS \n");
sb.append(" --context-path <string> context path, default: / \n");
sb.append(" --password <string> provide password for encrypted ZIP or WAR archive\n");
System.out.println(sb);
System.exit(0);
Expand Down Expand Up @@ -213,7 +213,7 @@ else if (args[i].equals(ARGS_HELP_OPTION))
*/
contextPath = CommonUtils.getContextPath(contextPath);

CommonUtils.prepareTomcatConf(confPath, keystorePath, port, sslPort, redirect);
CommonUtils.prepareTomcatConf(confPath, keystorePath, port, sslPort, !noRedirect);

Tomcat tomcat = CommonUtils.prepareTomcat(logger, catalinaHome, app, argz);
org.apache.catalina.Context ctx = tomcat.addWebapp(contextPath, warPath.toString());
Expand Down

0 comments on commit 55b6ee8

Please sign in to comment.