karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Guillaume Nodet (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (KARAF-374) Clean up commands and remove System.out from them, simplify JANSI usage.
Date Wed, 21 May 2014 12:05:38 GMT

     [ https://issues.apache.org/jira/browse/KARAF-374?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Guillaume Nodet closed KARAF-374.
---------------------------------

       Resolution: Won't Fix
    Fix Version/s:     (was: 4.0.0)

There is a big difference between System.out and getConsole() in the case where commands are
piped.  System.out will be the input of the next command in the pipe, while getConsole() will
be printed directly to the user.
If we were to remove calls to System.out, grep, more, tac commands which usually use piping
would just be useless.

> Clean up commands and remove System.out from them, simplify JANSI usage.
> ------------------------------------------------------------------------
>
>                 Key: KARAF-374
>                 URL: https://issues.apache.org/jira/browse/KARAF-374
>             Project: Karaf
>          Issue Type: Improvement
>          Components: karaf-shell
>    Affects Versions: 2.1.2
>            Reporter: Łukasz Dywicki
>            Assignee: Łukasz Dywicki
>
> Currently we have two bad things in our commands. First is System.out.println() mix with
getConsole().println()
> Second thing is jansi usage. It is really cool to have colour output under Windows/Unix
shell but printing something with this library is a little hard. Fluent api in this case is
not the best choice:
> String str = Ansi.ansi()
>     .fg(Ansi.Color.RED)
>     .a("Command not found: ")
>     .a(Ansi.Attribute.INTENSITY_BOLD)
>     .a(((CommandNotFoundException) t).getCommand())
>     .a(Ansi.Attribute.INTENSITY_BOLD_OFF)
>     .fg(Ansi.Color.DEFAULT).toString();
> Instead of simple string tags:
> String str = new Ansi("[red]Command not found: [bold]" + ((CommandNotFoundException)
t).getCommand() +  "[/bold][/red]).toString(); 
> These two things are releated because we can simply wrap getConsole().println() with
jansi but System.out.println not.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message