Java Code Examples for org.jline.utils.InfoCmp.Capability

The following examples show how to use org.jline.utils.InfoCmp.Capability. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: Flink-CEPplus   Source File: CliView.java    License: Apache License 2.0 5 votes vote down vote up
private void unsetTerminalFullScreen() {
	final Terminal terminal = client.getTerminal();

	terminal.puts(Capability.exit_ca_mode);
	terminal.puts(Capability.keypad_local);
	terminal.puts(Capability.cursor_visible);
}
 
Example 2
Source Project: Flink-CEPplus   Source File: CliTableResultView.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected KeyMap<ResultTableOperation> getKeys() {
	final KeyMap<ResultTableOperation> keys = new KeyMap<>();
	keys.setAmbiguousTimeout(200); // make ESC quicker
	keys.bind(ResultTableOperation.QUIT, "q", "Q", esc(), ctrl('c'));
	keys.bind(ResultTableOperation.REFRESH, "r", "R", key(client.getTerminal(), Capability.key_f5));
	keys.bind(ResultTableOperation.UP, "w", "W", key(client.getTerminal(), Capability.key_up));
	keys.bind(ResultTableOperation.DOWN, "s", "S", key(client.getTerminal(), Capability.key_down));
	keys.bind(ResultTableOperation.LEFT, "a", "A", key(client.getTerminal(), Capability.key_left));
	keys.bind(ResultTableOperation.RIGHT, "d", "D", key(client.getTerminal(), Capability.key_right));
	keys.bind(ResultTableOperation.OPEN, "o", "O", "\r");
	keys.bind(ResultTableOperation.GOTO, "g", "G");
	keys.bind(ResultTableOperation.NEXT, "n", "N");
	keys.bind(ResultTableOperation.PREV, "p", "P");
	keys.bind(ResultTableOperation.LAST, "l", "L", key(client.getTerminal(), Capability.key_end));
	keys.bind(ResultTableOperation.INC_REFRESH, "+");
	keys.bind(ResultTableOperation.DEC_REFRESH, "-");
	return keys;
}
 
Example 3
Source Project: Flink-CEPplus   Source File: CliInputView.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected KeyMap<InputOperation> getKeys() {
	final KeyMap<InputOperation> keys = new KeyMap<>();
	keys.setUnicode(INSERT);
	keys.setAmbiguousTimeout(200); // make ESC quicker
	for (char i = 32; i < 256; i++) {
		keys.bind(INSERT, Character.toString(i));
	}
	keys.bind(LEFT, key(client.getTerminal(), Capability.key_left));
	keys.bind(RIGHT, key(client.getTerminal(), Capability.key_right));
	keys.bind(BACKSPACE, del());

	if (client.isPlainTerminal()) {
		keys.bind(ENTER, "\r", "$");
		keys.bind(QUIT, key(client.getTerminal(), Capability.key_exit), "!");
	} else {
		keys.bind(ENTER, "\r");
		keys.bind(QUIT, esc());
	}
	return keys;
}
 
Example 4
Source Project: flink   Source File: CliView.java    License: Apache License 2.0 5 votes vote down vote up
private void unsetTerminalFullScreen() {
	final Terminal terminal = client.getTerminal();

	terminal.puts(Capability.exit_ca_mode);
	terminal.puts(Capability.keypad_local);
	terminal.puts(Capability.cursor_visible);
}
 
Example 5
Source Project: flink   Source File: CliTableResultView.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected KeyMap<ResultTableOperation> getKeys() {
	final KeyMap<ResultTableOperation> keys = new KeyMap<>();
	keys.setAmbiguousTimeout(200); // make ESC quicker
	keys.bind(ResultTableOperation.QUIT, "q", "Q", esc(), ctrl('c'));
	keys.bind(ResultTableOperation.REFRESH, "r", "R", key(client.getTerminal(), Capability.key_f5));
	keys.bind(ResultTableOperation.UP, "w", "W", key(client.getTerminal(), Capability.key_up));
	keys.bind(ResultTableOperation.DOWN, "s", "S", key(client.getTerminal(), Capability.key_down));
	keys.bind(ResultTableOperation.LEFT, "a", "A", key(client.getTerminal(), Capability.key_left));
	keys.bind(ResultTableOperation.RIGHT, "d", "D", key(client.getTerminal(), Capability.key_right));
	keys.bind(ResultTableOperation.OPEN, "o", "O", "\r");
	keys.bind(ResultTableOperation.GOTO, "g", "G");
	keys.bind(ResultTableOperation.NEXT, "n", "N");
	keys.bind(ResultTableOperation.PREV, "p", "P");
	keys.bind(ResultTableOperation.LAST, "l", "L", key(client.getTerminal(), Capability.key_end));
	keys.bind(ResultTableOperation.INC_REFRESH, "+");
	keys.bind(ResultTableOperation.DEC_REFRESH, "-");
	return keys;
}
 
Example 6
Source Project: flink   Source File: CliInputView.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected KeyMap<InputOperation> getKeys() {
	final KeyMap<InputOperation> keys = new KeyMap<>();
	keys.setUnicode(INSERT);
	keys.setAmbiguousTimeout(200); // make ESC quicker
	for (char i = 32; i < 256; i++) {
		keys.bind(INSERT, Character.toString(i));
	}
	keys.bind(LEFT, key(client.getTerminal(), Capability.key_left));
	keys.bind(RIGHT, key(client.getTerminal(), Capability.key_right));
	keys.bind(BACKSPACE, del());

	if (client.isPlainTerminal()) {
		keys.bind(ENTER, "\r", "$");
		keys.bind(QUIT, key(client.getTerminal(), Capability.key_exit), "!");
	} else {
		keys.bind(ENTER, "\r");
		keys.bind(QUIT, esc());
	}
	return keys;
}
 
Example 7
Source Project: super-cloudops   Source File: DefaultBuiltInCommand.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * See:<a href=
 * "https://github.com/jline/jline3/issues/183">https://github.com/jline/jline3/issues/183</a>
 */
@ShellMethod(keys = { INTERNAL_CLEAR, INTERNAL_CLS }, group = DEFAULT_GROUP, help = "Clean up console history")
public void clear() {
	Terminal terminal = runner.getLineReader().getTerminal();
	terminal.puts(Capability.clear_screen);
	terminal.flush();
}
 
Example 8
Source Project: flink   Source File: CliView.java    License: Apache License 2.0 5 votes vote down vote up
private void unsetTerminalFullScreen() {
	final Terminal terminal = client.getTerminal();

	terminal.puts(Capability.exit_ca_mode);
	terminal.puts(Capability.keypad_local);
	terminal.puts(Capability.cursor_visible);
}
 
Example 9
Source Project: flink   Source File: CliTableResultView.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected KeyMap<ResultTableOperation> getKeys() {
	final KeyMap<ResultTableOperation> keys = new KeyMap<>();
	keys.setAmbiguousTimeout(200); // make ESC quicker
	keys.bind(ResultTableOperation.QUIT, "q", "Q", esc(), ctrl('c'));
	keys.bind(ResultTableOperation.REFRESH, "r", "R", key(client.getTerminal(), Capability.key_f5));
	keys.bind(ResultTableOperation.UP, "w", "W", key(client.getTerminal(), Capability.key_up));
	keys.bind(ResultTableOperation.DOWN, "s", "S", key(client.getTerminal(), Capability.key_down));
	keys.bind(ResultTableOperation.LEFT, "a", "A", key(client.getTerminal(), Capability.key_left));
	keys.bind(ResultTableOperation.RIGHT, "d", "D", key(client.getTerminal(), Capability.key_right));
	keys.bind(ResultTableOperation.OPEN, "o", "O", "\r");
	keys.bind(ResultTableOperation.GOTO, "g", "G");
	keys.bind(ResultTableOperation.NEXT, "n", "N");
	keys.bind(ResultTableOperation.PREV, "p", "P");
	keys.bind(ResultTableOperation.LAST, "l", "L", key(client.getTerminal(), Capability.key_end));
	keys.bind(ResultTableOperation.INC_REFRESH, "+");
	keys.bind(ResultTableOperation.DEC_REFRESH, "-");
	return keys;
}
 
Example 10
Source Project: flink   Source File: CliRowView.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected KeyMap<RowOperation> getKeys() {
	final KeyMap<RowOperation> keys = new KeyMap<>();
	keys.setAmbiguousTimeout(200); // make ESC quicker
	keys.bind(RowOperation.QUIT, "q", "Q", esc());
	keys.bind(RowOperation.UP, "w", "W", key(client.getTerminal(), Capability.key_up));
	keys.bind(RowOperation.DOWN, "s", "S", key(client.getTerminal(), Capability.key_down));
	keys.bind(RowOperation.LEFT, "a", "A", key(client.getTerminal(), Capability.key_left));
	keys.bind(RowOperation.RIGHT, "d", "D", key(client.getTerminal(), Capability.key_right));
	return keys;
}
 
Example 11
Source Project: flink   Source File: CliInputView.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected KeyMap<InputOperation> getKeys() {
	final KeyMap<InputOperation> keys = new KeyMap<>();
	keys.setUnicode(INSERT);
	keys.setAmbiguousTimeout(200); // make ESC quicker
	for (char i = 32; i < 256; i++) {
		keys.bind(INSERT, Character.toString(i));
	}
	keys.bind(LEFT, key(client.getTerminal(), Capability.key_left));
	keys.bind(RIGHT, key(client.getTerminal(), Capability.key_right));
	keys.bind(BACKSPACE, del());

	if (client.isPlainTerminal()) {
		keys.bind(ENTER, "\r", "$");
		keys.bind(QUIT, key(client.getTerminal(), Capability.key_exit), "!");
	} else {
		keys.bind(ENTER, "\r");
		keys.bind(QUIT, esc());
	}
	return keys;
}
 
Example 12
Source Project: Flink-CEPplus   Source File: CliView.java    License: Apache License 2.0 4 votes vote down vote up
private void ensureTerminalFullScreen() {
	final Terminal terminal = client.getTerminal();
	terminal.puts(Capability.enter_ca_mode);
	terminal.puts(Capability.keypad_xmit);
	terminal.puts(Capability.cursor_invisible);
}
 
Example 13
Source Project: Flink-CEPplus   Source File: CliChangelogResultView.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected KeyMap<ResultChangelogOperation> getKeys() {
	final KeyMap<ResultChangelogOperation> keys = new KeyMap<>();
	keys.setAmbiguousTimeout(200); // make ESC quicker
	keys.bind(ResultChangelogOperation.QUIT, "q", "Q", esc(), ctrl('c'));
	keys.bind(ResultChangelogOperation.REFRESH, "r", "R", key(client.getTerminal(), Capability.key_f5));
	keys.bind(ResultChangelogOperation.UP, "w", "W", key(client.getTerminal(), Capability.key_up));
	keys.bind(ResultChangelogOperation.DOWN, "s", "S", key(client.getTerminal(), Capability.key_down));
	keys.bind(ResultChangelogOperation.LEFT, "a", "A", key(client.getTerminal(), Capability.key_left));
	keys.bind(ResultChangelogOperation.RIGHT, "d", "D", key(client.getTerminal(), Capability.key_right));
	keys.bind(ResultChangelogOperation.OPEN, "o", "O", "\r");
	keys.bind(ResultChangelogOperation.INC_REFRESH, "+");
	keys.bind(ResultChangelogOperation.DEC_REFRESH, "-");
	return keys;
}
 
Example 14
Source Project: Flink-CEPplus   Source File: CliRowView.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected KeyMap<RowOperation> getKeys() {
	final KeyMap<RowOperation> keys = new KeyMap<>();
	keys.setAmbiguousTimeout(200); // make ESC quicker
	keys.bind(RowOperation.QUIT, "q", "Q", esc());
	keys.bind(RowOperation.UP, "w", "W", key(client.getTerminal(), Capability.key_up));
	keys.bind(RowOperation.DOWN, "s", "S", key(client.getTerminal(), Capability.key_down));
	keys.bind(RowOperation.LEFT, "a", "A", key(client.getTerminal(), Capability.key_left));
	keys.bind(RowOperation.RIGHT, "d", "D", key(client.getTerminal(), Capability.key_right));
	return keys;
}
 
Example 15
Source Project: flink   Source File: CliView.java    License: Apache License 2.0 4 votes vote down vote up
private void ensureTerminalFullScreen() {
	final Terminal terminal = client.getTerminal();
	terminal.puts(Capability.enter_ca_mode);
	terminal.puts(Capability.keypad_xmit);
	terminal.puts(Capability.cursor_invisible);
}
 
Example 16
Source Project: flink   Source File: CliChangelogResultView.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected KeyMap<ResultChangelogOperation> getKeys() {
	final KeyMap<ResultChangelogOperation> keys = new KeyMap<>();
	keys.setAmbiguousTimeout(200); // make ESC quicker
	keys.bind(ResultChangelogOperation.QUIT, "q", "Q", esc(), ctrl('c'));
	keys.bind(ResultChangelogOperation.REFRESH, "r", "R", key(client.getTerminal(), Capability.key_f5));
	keys.bind(ResultChangelogOperation.UP, "w", "W", key(client.getTerminal(), Capability.key_up));
	keys.bind(ResultChangelogOperation.DOWN, "s", "S", key(client.getTerminal(), Capability.key_down));
	keys.bind(ResultChangelogOperation.LEFT, "a", "A", key(client.getTerminal(), Capability.key_left));
	keys.bind(ResultChangelogOperation.RIGHT, "d", "D", key(client.getTerminal(), Capability.key_right));
	keys.bind(ResultChangelogOperation.OPEN, "o", "O", "\r");
	keys.bind(ResultChangelogOperation.INC_REFRESH, "+");
	keys.bind(ResultChangelogOperation.DEC_REFRESH, "-");
	return keys;
}
 
Example 17
Source Project: flink   Source File: CliRowView.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected KeyMap<RowOperation> getKeys() {
	final KeyMap<RowOperation> keys = new KeyMap<>();
	keys.setAmbiguousTimeout(200); // make ESC quicker
	keys.bind(RowOperation.QUIT, "q", "Q", esc());
	keys.bind(RowOperation.UP, "w", "W", key(client.getTerminal(), Capability.key_up));
	keys.bind(RowOperation.DOWN, "s", "S", key(client.getTerminal(), Capability.key_down));
	keys.bind(RowOperation.LEFT, "a", "A", key(client.getTerminal(), Capability.key_left));
	keys.bind(RowOperation.RIGHT, "d", "D", key(client.getTerminal(), Capability.key_right));
	return keys;
}
 
Example 18
Source Project: flink   Source File: CliView.java    License: Apache License 2.0 4 votes vote down vote up
private void ensureTerminalFullScreen() {
	final Terminal terminal = client.getTerminal();
	terminal.puts(Capability.enter_ca_mode);
	terminal.puts(Capability.keypad_xmit);
	terminal.puts(Capability.cursor_invisible);
}
 
Example 19
Source Project: flink   Source File: CliChangelogResultView.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected KeyMap<ResultChangelogOperation> getKeys() {
	final KeyMap<ResultChangelogOperation> keys = new KeyMap<>();
	keys.setAmbiguousTimeout(200); // make ESC quicker
	keys.bind(ResultChangelogOperation.QUIT, "q", "Q", esc(), ctrl('c'));
	keys.bind(ResultChangelogOperation.REFRESH, "r", "R", key(client.getTerminal(), Capability.key_f5));
	keys.bind(ResultChangelogOperation.UP, "w", "W", key(client.getTerminal(), Capability.key_up));
	keys.bind(ResultChangelogOperation.DOWN, "s", "S", key(client.getTerminal(), Capability.key_down));
	keys.bind(ResultChangelogOperation.LEFT, "a", "A", key(client.getTerminal(), Capability.key_left));
	keys.bind(ResultChangelogOperation.RIGHT, "d", "D", key(client.getTerminal(), Capability.key_right));
	keys.bind(ResultChangelogOperation.OPEN, "o", "O", "\r");
	keys.bind(ResultChangelogOperation.INC_REFRESH, "+");
	keys.bind(ResultChangelogOperation.DEC_REFRESH, "-");
	return keys;
}