Karaf 4.2.x and BRACKETED_PASTE

Since karaf 4.2.x (since I migrated from 4.0.10 to 4.2.2 and higher) I recognises a new feature in karaf console if copy and paste. If paste multi line content it will not pasted as single commands. Instead it will be pasted as a block and executed at once.

This feature is useful in some situations but in some it's also useful to work with the 'old style mode' - line by line.

Another problem is that exiting the karaf console with escape sequences, e.g. in docker attach mode (ctrl+p-q) the BRACKETED_PASTE mode will not be disabled and you have to disable it manually by typing

printf "\e[?2004l"

but it's not possible to paste it in this moment...

To switch between the modes I found the reason for the behaviour in the LineReader from jline 3. The reader can be configured to enable and disable the option and is accessible in the karaf console by the parameter '.jline.reader' Use the command

$.jline.reader option BRACKETED_PASTE false

to disable the option and 

$.jline.reader option BRACKETED_PASTE true

to enable the option.

Since mhus-osgi-tools 1.6.0 I added sub commands in the command 'console' to control the options also. Use

console reader.set BRACKETED_PASTE true

to work with the jline reader and

console reader.status

to get a list of options and the actual status.

Note:

After looking around in the shell scripts of karaf I found the more common option to switch between modes. Use

setopt BRACKETED_PASTE

and

unsetopt BRACKETED_PASTE

to switch between modes.

Kommentare

Beliebte Posts aus diesem Blog

Sonatype Nexus fails with random "peer not authenticated" errors behind ingress

[mhus lib] Reorg in generation 7 nearly finished

[mhus lib] Implemented Bearer JWS tokens