2017-05-30 13:36 GMT+02:00 Jean-Baptiste Onofré <[email protected]>:
> Hi Dominik,
>
> 1. When you do the System.out you can use color scheme/code. To simplify
> this you can use Ansi utils, doing something like:
>
> Ansi.ansi(output).fg(Ansi.Color.RED).a("foo").a("bar").reset();
>
You can also use jline's AttributedStringBuilder or jansi AnsiRenderer...
>
> 2. At argument/options level, it's related to completer. For the output,
> you can use paging or filtering on the output.
>
You need to inject a reference to the terminal:
@Reference org.apache.karaf.shell.api.console.Session session;
Then, you'll have to check the terminal's height using
session.getTerminal().getHeight() and compare to the estimated number of
lines.
To read user input, use session.getKeyboard().read() ...
>
> Regards
> JB
>
>
> On 05/30/2017 11:28 AM, Dominik Marciniszyn wrote:
>
>> Hi,
>>
>> I would like to customize commands created by myself. Some of this
>> commands
>> returns a lot of information. So I have two questions:
>>
>> 1. How could I creating custom coloring of my commands?
>> 2. How could I create limitations of displaying results on the console? I
>> would like do mechanism like in Karaf shell - "karaf@root()> Display all
>> 294
>> possibilities? (y or n)"
>>
>> Thank You for help or advice,
>> Dominik Marciniszyn
>>
>>
>>
>> --
>> View this message in context: http://karaf.922171.n3.nabble.
>> com/Own-Karaf-commands-customization-tp4050498.html
>> Sent from the Karaf - Dev mailing list archive at Nabble.com.
>>
>>
> --
> Jean-Baptiste Onofré
> [email protected]
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>
--
------------------------
Guillaume Nodet