org.jline.utils.InfoCmp.Capability Java Examples

The following examples show how to use org.jline.utils.InfoCmp.Capability. 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 File: CliTableResultView.java    From flink with 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 #2
Source File: CliInputView.java    From flink with 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 #3
Source File: CliRowView.java    From flink with 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 #4
Source File: CliTableResultView.java    From flink with 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 #5
Source File: CliView.java    From flink with 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 #6
Source File: DefaultBuiltInCommand.java    From super-cloudops with 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 #7
Source File: CliInputView.java    From flink with 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 #8
Source File: CliView.java    From flink with 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 File: CliInputView.java    From Flink-CEPplus with 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 #10
Source File: CliTableResultView.java    From Flink-CEPplus with 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 #11
Source File: CliView.java    From Flink-CEPplus with 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 #12
Source File: CliChangelogResultView.java    From flink with 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 #13
Source File: CliView.java    From Flink-CEPplus with 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 #14
Source File: CliRowView.java    From flink with 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 File: CliView.java    From flink with 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 File: CliView.java    From flink with 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 #17
Source File: CliRowView.java    From Flink-CEPplus with 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 File: CliChangelogResultView.java    From flink with 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 #19
Source File: CliChangelogResultView.java    From Flink-CEPplus with 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;
}