SQL: Clean up unused calls in CLI (elastic/x-pack-elasticsearch#2593)

Original commit: elastic/x-pack-elasticsearch@ba3c64b09c
This commit is contained in:
Igor Motov 2017-09-22 10:59:55 -04:00 committed by GitHub
parent 3b8d8487f2
commit 3ca00353c8
3 changed files with 1 additions and 54 deletions

View File

@ -1,5 +1,3 @@
import org.elasticsearch.gradle.test.RunTask
apply plugin: 'elasticsearch.build'
/* We don't use the 'application' plugin because it builds a zip and tgz which
* we don't want. */

View File

@ -6,10 +6,8 @@
package org.elasticsearch.xpack.sql.cli;
import org.elasticsearch.xpack.sql.cli.net.protocol.QueryResponse;
import org.elasticsearch.xpack.sql.net.client.SuppressForbidden;
import org.elasticsearch.xpack.sql.net.client.util.IOUtils;
import org.elasticsearch.xpack.sql.protocol.shared.AbstractQueryInitRequest;
import org.jline.keymap.BindingReader;
import org.jline.reader.EndOfFileException;
import org.jline.reader.LineReader;
import org.jline.reader.LineReaderBuilder;
@ -54,26 +52,13 @@ public class Cli {
}
}
@SuppressForbidden(reason = "CLI application")
private static void terminateWithError() {
System.exit(1);
}
private final Terminal term;
private final BindingReader bindingReader;
private final Keys keys;
private final CliConfiguration cfg;
private final CliHttpClient cliClient;
private int fetchSize = AbstractQueryInitRequest.DEFAULT_FETCH_SIZE;
private String fetchSeparator = "";
Cli(CliConfiguration cfg, Terminal terminal) {
term = terminal;
// NOCOMMIT figure out if we need to build these for side effects or not. We don't currently use them.
bindingReader = new BindingReader(term.reader());
keys = new Keys(term);
this.cfg = cfg;
cliClient = new CliHttpClient(cfg);
}
@ -85,13 +70,11 @@ public class Cli {
.completer(Completers.INSTANCE)
.build();
String prompt = null;
String DEFAULT_PROMPT = new AttributedString("sql> ", DEFAULT.foreground(YELLOW)).toAnsi(term);
String MULTI_LINE_PROMPT = new AttributedString(" | ", DEFAULT.foreground(YELLOW)).toAnsi(term);
StringBuilder multiLine = new StringBuilder();
prompt = DEFAULT_PROMPT;
String prompt = DEFAULT_PROMPT;
out.flush();
printLogo();

View File

@ -1,34 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.sql.cli;
import org.jline.keymap.KeyMap;
import org.jline.terminal.Terminal;
import org.jline.utils.InfoCmp.Capability;
import static org.jline.keymap.KeyMap.key;
class Keys {
enum Key {
UP,
DOWN,
LEFT,
RIGHT,
NONE
}
final KeyMap<Key> keys = new KeyMap<>();
Keys(Terminal terminal) {
keys.setNomatch(Key.NONE);
keys.setAmbiguousTimeout(400);
keys.bind(Key.UP, key(terminal, Capability.key_up));
keys.bind(Key.DOWN, key(terminal, Capability.key_down));
keys.bind(Key.RIGHT, key(terminal, Capability.key_right));
keys.bind(Key.LEFT, key(terminal, Capability.key_left));
}
}