snuyanzin commented on code in PR #22063:
URL: https://github.com/apache/flink/pull/22063#discussion_r1144959118
##########
flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/cli/CliClient.java:
##########
@@ -307,6 +314,26 @@ private LineReader createLineReader(Terminal terminal,
ExecutionMode mode) {
terminal.writer().println(msg);
LOG.warn(msg);
}
+ if (mode == ExecutionMode.INTERACTIVE_EXECUTION) {
+ lineReader.setVariable(
+ COLOR_SCHEMA_VAR,
+ executor.getSessionConfig()
+ .get(SqlClientOptions.DISPLAY_DEFAULT_COLOR_SCHEMA)
+ .ordinal());
+ final Widget widget =
+ () -> {
+ final Object colorSchemeOrdinal =
lineReader.getVariable(COLOR_SCHEMA_VAR);
+ int ord = colorSchemeOrdinal == null ? 0 : (Integer)
colorSchemeOrdinal;
+ lineReader.setVariable(
+ COLOR_SCHEMA_VAR,
+ (ord + 1) %
SyntaxHighlightStyle.BuiltInStyle.values().length);
+ return false;
+ };
+ lineReader.getWidgets().put(COLOR_SCHEMA_VAR, widget);
+ final CharSequence keySeq = alt('h');
+ lineReader.getKeyMaps().get(LineReader.EMACS).bind(widget, keySeq);
+ lineReader.getKeyMaps().get(LineReader.VIINS).bind(widget, keySeq);
+ }
Review Comment:
The initial schema could be set via table config option.
Another way (without widgets and shortcuts) is usage of table config option
only.
I will change it in that way
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]