Highlight outputs in karaf gogo shell

The command shell:highlight in mhus-osgi-tools 1.3.5 will provide a command to search and highlight text via pipe:

The basic usage are:

service:list | highlight bundle

The command accept regex expressions and by default the regex is case insensitive, the result is:

[org.osgi.service.url.URLStreamHandlerService]
----------------------------------------------
 service.bundleid = 51
 service.id = 31
 service.scope = singleton
 url.handler.protocol = [wrap]
Provided by : 
 OPS4J Pax Url - wrap: (51)
Used by: 
 Apache Karaf :: Deployer :: Wrap Non OSGi Jar (28)
 System Bundle (0)

More complex is the the option to search multiple words and change the color for each finding:

service:list | highlight \#blue bundle \#green service

The result:

[org.osgi.service.url.URLStreamHandlerService]
----------------------------------------------
 service.bundleid = 51
 service.id = 31
 service.scope = singleton
 url.handler.protocol = [wrap]
Provided by : 
 OPS4J Pax Url - wrap: (51)
Used by: 
 Apache Karaf :: Deployer :: Wrap Non OSGi Jar (28)
 System Bundle (0)

A nice feature to manipulate text output is the option to set a start and stop marker for findings. This is useful for a non color terminal:

service:list | highlight \#a[ \#o] service

The result:

[org.osgi.[service].url.URLStreamHandler[Service]]
----------------------------------------------
 [service].bundleid = 51
 [service].id = 31
 [service].scope = singleton
 url.handler.protocol = [wrap]
Provided by : 
 OPS4J Pax Url - wrap: (51)
Used by: 
 Apache Karaf :: Deployer :: Wrap Non OSGi Jar (28)
 System Bundle (0)

With more options it’s possible to switch on case sensitive '#Ion' or set background color '#Bblue'.



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

Creating a flux sync configuration referring a config map for substitution