You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Łukasz Dywicki (JIRA)" <ji...@apache.org> on 2011/01/11 10:55:46 UTC

[jira] Created: (KARAF-374) Clean up commands and remove System.out from them, simplify JANSI usage.

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
    Affects Versions: 2.1.2
            Reporter: Ł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 is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (KARAF-374) Clean up commands and remove System.out from them, simplify JANSI usage.

Posted by "Jean-Baptiste Onofré (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/KARAF-374?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12983188#action_12983188 ] 

Jean-Baptiste Onofré commented on KARAF-374:
--------------------------------------------

For the first point, I prefer to use System.out.println() as it's intercepted by the service wrapper (which is not the case for the getConsole().println().

> 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
>    Affects Versions: 2.1.2
>            Reporter: Ł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 is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (KARAF-374) Clean up commands and remove System.out from them, simplify JANSI usage.

Posted by "Łukasz Dywicki (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/KARAF-374?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12980056#action_12980056 ] 

Łukasz Dywicki commented on KARAF-374:
--------------------------------------

I just found AnsiRenderer in Jansi. The syntax is following:
@|bold,red Some text|@

@|fg_red,bold Some text on red background|@

> 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
>    Affects Versions: 2.1.2
>            Reporter: Ł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 is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] [Updated] (KARAF-374) Clean up commands and remove System.out from them, simplify JANSI usage.

Posted by "Jean-Baptiste Onofré (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/KARAF-374?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jean-Baptiste Onofré updated KARAF-374:
---------------------------------------

      Component/s: console
    Fix Version/s: 3.1.0

> 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: console
>    Affects Versions: 2.1.2
>            Reporter: Łukasz Dywicki
>            Assignee: Łukasz Dywicki
>             Fix For: 3.1.0
>
>
> 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 is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (KARAF-374) Clean up commands and remove System.out from them, simplify JANSI usage.

Posted by "Łukasz Dywicki (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/KARAF-374?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13092735#comment-13092735 ] 

Łukasz Dywicki commented on KARAF-374:
--------------------------------------

Since we talk about commands I think that output printed from commands comes from user interaction. When somebody execute command the System.out in fact is used as getConsole.println(). In case of any exceptions commands log them to karaf.log so I don't think that wrapper.log is relevant here.

> 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
>             Fix For: 3.1.0
>
>
> 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 is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] Work started: (KARAF-374) Clean up commands and remove System.out from them, simplify JANSI usage.

Posted by "Łukasz Dywicki (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/KARAF-374?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Work on KARAF-374 started by Łukasz Dywicki.

> 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
>    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 is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] Assigned: (KARAF-374) Clean up commands and remove System.out from them, simplify JANSI usage.

Posted by "Łukasz Dywicki (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/KARAF-374?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Łukasz Dywicki reassigned KARAF-374:
------------------------------------

    Assignee: Łukasz Dywicki

> 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
>    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 is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Work stopped] (KARAF-374) Clean up commands and remove System.out from them, simplify JANSI usage.

Posted by "Łukasz Dywicki (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/KARAF-374?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Work on KARAF-374 stopped by Łukasz Dywicki.

> 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
>             Fix For: 3.1.0
>
>
> 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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (KARAF-374) Clean up commands and remove System.out from them, simplify JANSI usage.

Posted by "Achim Nierbeck (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/KARAF-374?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12980026#action_12980026 ] 

Achim Nierbeck commented on KARAF-374:
--------------------------------------

One remark though, System.out are also printed to the wrapper.log file when running with the service wrapper. 
I'm not sure the console output is printed there as well 

> 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
>    Affects Versions: 2.1.2
>            Reporter: Ł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 is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.