[jOOQ/jOOQ#9144] ParserCLI "-f" flag does not work as shortcut for

"--from-dialect"
This commit is contained in:
Knut Wannheden 2019-09-05 21:34:08 +02:00
parent 495baed1ee
commit 0e1515cd6d

View File

@ -73,7 +73,7 @@ public final class ParserCLI {
}
else if (a.done) {}
else if (a.toDialect == null || a.sql == null) {
System.out.println("Mandatory arguments: -t and -s. Use -h for help");
System.out.println("Mandatory arguments: -T and -s. Use -h for help");
throw new RuntimeException();
}
else {
@ -149,7 +149,7 @@ public final class ParserCLI {
invalid(arg, RenderNameCase.class);
}
}
else if ("f".equals(flag) || "from-dialect".equals(flag)) {
else if ("F".equals(flag) || "from-dialect".equals(flag)) {
try {
a.fromDialect = SQLDialect.valueOf(arg.toUpperCase());
displayFromDialect(a);
@ -158,7 +158,9 @@ public final class ParserCLI {
invalid(arg, SQLDialect.class);
}
}
else if ("t".equals(flag) || "to-dialect".equals(flag)) {
// [#9144] /t maintained for backwards compatibility
else if ("t".equals(flag) || "T".equals(flag) || "to-dialect".equals(flag)) {
try {
a.toDialect = SQLDialect.valueOf(arg.toUpperCase());
displayToDialect(a);
@ -290,7 +292,7 @@ public final class ParserCLI {
throw e;
}
}
else if ("-f".equals(args[i]) || "--from-dialect".equals(args[i])) {
else if ("-F".equals(args[i]) || "--from-dialect".equals(args[i])) {
try {
result.fromDialect = SQLDialect.valueOf(args[++i].toUpperCase());
continue argsLoop;
@ -300,11 +302,13 @@ public final class ParserCLI {
throw e;
}
catch (ArrayIndexOutOfBoundsException e) {
System.out.println("Flag -f / --from-dialect requires <SQLDialect> argument");
System.out.println("Flag -F / --from-dialect requires <SQLDialect> argument");
throw e;
}
}
else if ("-t".equals(args[i]) || "--to-dialect".equals(args[i])) {
// [#9144] -t maintained for backwards compatibility
else if ("-t".equals(args[i]) || "-T".equals(args[i]) || "--to-dialect".equals(args[i])) {
try {
result.toDialect = SQLDialect.valueOf(args[++i].toUpperCase());
continue argsLoop;
@ -314,7 +318,7 @@ public final class ParserCLI {
throw e;
}
catch (ArrayIndexOutOfBoundsException e) {
System.out.println("Flag -t / --to-dialect requires <SQLDialect> argument");
System.out.println("Flag -T / --to-dialect requires <SQLDialect> argument");
throw e;
}
}
@ -358,8 +362,8 @@ public final class ParserCLI {
System.out.println(" -h / --help Display this help");
System.out.println(" -k / --keyword <RenderKeywordCase> Specify the output keyword case (org.jooq.conf.RenderKeywordCase)");
System.out.println(" -i / --identifier <RenderNameCase> Specify the output identifier case (org.jooq.conf.RenderNameCase)");
System.out.println(" -f / --from-dialect <SQLDialect> Specify the input dialect (org.jooq.SQLDialect)");
System.out.println(" -t / --to-dialect <SQLDialect> Specify the output dialect (org.jooq.SQLDialect)");
System.out.println(" -F / --from-dialect <SQLDialect> Specify the input dialect (org.jooq.SQLDialect)");
System.out.println(" -T / --to-dialect <SQLDialect> Specify the output dialect (org.jooq.SQLDialect)");
System.out.println(" -s / --sql <String> Specify the input SQL string");
System.out.println("");
System.out.println(" -I / --interactive Start interactive mode");
@ -372,8 +376,8 @@ public final class ParserCLI {
System.out.println(" /h or /help Display this help");
System.out.println(" /k or /keyword <RenderKeywordCase> Specify the output keyword case (org.jooq.conf.RenderKeywordCase)");
System.out.println(" /i or /identifier <RenderNameCase> Specify the output identifier case (org.jooq.conf.RenderNameCase)");
System.out.println(" /f or /from-dialect <SQLDialect> Specify the input dialect (org.jooq.SQLDialect)");
System.out.println(" /t or /to-dialect <SQLDialect> Specify the output dialect (org.jooq.SQLDialect)");
System.out.println(" /F or /from-dialect <SQLDialect> Specify the input dialect (org.jooq.SQLDialect)");
System.out.println(" /T or /to-dialect <SQLDialect> Specify the output dialect (org.jooq.SQLDialect)");
System.out.println(" <String> Specify the input SQL string");
System.out.println("");
System.out.println(" /q or /quit Quit");