You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "gg (JIRA)" <ji...@apache.org> on 2010/05/11 07:37:35 UTC

[jira] Created: (CLI-199) Improve HelpFormatter by making renderOptions() and renderWrappedText() public

Improve HelpFormatter by making renderOptions() and renderWrappedText() public
------------------------------------------------------------------------------

                 Key: CLI-199
                 URL: https://issues.apache.org/jira/browse/CLI-199
             Project: Commons CLI
          Issue Type: Improvement
          Components: CLI-1.x
    Affects Versions: 1.2, 1.1, 1.3
            Reporter: gg
            Priority: Trivial


Under certain circumstances it is usefull that HelpFormatter printing methods return a string buffer which can be used in further processing instead of direct printing to a PW or std.out. 
When having a closer look at the source one can easily retrieve string buffers with formatted text by changing the visibility of renderOptions() and renderWrappedText()  from protected to public. This will make the "core" formatting methods available without adding additional functionallity to the HelpFormatter.

Another option would be to add a set of print....() methods returning the SB instead of printing its content.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (CLI-199) Improve HelpFormatter by making renderOptions() and renderWrappedText() public

Posted by "gg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CLI-199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12878217#action_12878217 ] 

gg edited comment on CLI-199 at 6/12/10 2:23 AM:
-------------------------------------------------

The assumption I made was not correct. Both rendering methods can stay protected as it would colst too much effort to use them for gettig a nice looking output.
Nevertheless my requirement having help content rendered into a StringBuffer had to be solved. So I added kind of an indirection to the printng exposing additional (public) rendering functions. One can now decide if to print or to render into a SB.

Due to some strage behavior regarding the newLine usage renderHelp() is the only method which may currently not be "generic". 

I attached my version of the HelpFormatter to give you a better idea of the whole thing.

Cheers, Ulf

[Update] renderHelp() has been thrown out.

      was (Author: prong):
    The assumption I made was not correct. Both rendering methods can stay protected as it would colst too much effort to use them for gettig a nice looking output.
Nevertheless my requirement having help content rendered into a StringBuffer had to be solved. So I added kind of an indirection to the printng exposing additional (public) rendering functions. One can now decide if to print or to render into a SB.

Due to some strage behavior regarding the newLine usage renderHelp() is the only method which may currently not be "generic".

I attached my version of the HelpFormatter to give you a better idea of the whole thing.

Cheers, Ulf


  
> Improve HelpFormatter by making renderOptions() and renderWrappedText() public
> ------------------------------------------------------------------------------
>
>                 Key: CLI-199
>                 URL: https://issues.apache.org/jira/browse/CLI-199
>             Project: Commons CLI
>          Issue Type: Improvement
>          Components: CLI-1.x
>    Affects Versions: 1.1, 1.2, 1.3
>            Reporter: gg
>            Priority: Trivial
>
> Under certain circumstances it is usefull that HelpFormatter printing methods return a string buffer which can be used in further processing instead of direct printing to a PW or std.out. 
> When having a closer look at the source one can easily retrieve string buffers with formatted text by changing the visibility of renderOptions() and renderWrappedText()  from protected to public. This will make the "core" formatting methods available without adding additional functionallity to the HelpFormatter.
> Another option would be to add a set of print....() methods returning the SB instead of printing its content.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CLI-199) Improve HelpFormatter by making renderOptions() and renderWrappedText() public

Posted by "Emmanuel Bourg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CLI-199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12880561#action_12880561 ] 

Emmanuel Bourg commented on CLI-199:
------------------------------------

I'm still no really sure to understand what you are trying to achieve, a real life example would certainly help. Did you consider using a StringWriter?

> Improve HelpFormatter by making renderOptions() and renderWrappedText() public
> ------------------------------------------------------------------------------
>
>                 Key: CLI-199
>                 URL: https://issues.apache.org/jira/browse/CLI-199
>             Project: Commons CLI
>          Issue Type: Improvement
>          Components: CLI-1.x
>    Affects Versions: 1.1, 1.2, 1.3
>            Reporter: gg
>            Priority: Trivial
>         Attachments: HelpFormatter.java
>
>
> Under certain circumstances it is usefull that HelpFormatter printing methods return a string buffer which can be used in further processing instead of direct printing to a PW or std.out. 
> When having a closer look at the source one can easily retrieve string buffers with formatted text by changing the visibility of renderOptions() and renderWrappedText()  from protected to public. This will make the "core" formatting methods available without adding additional functionallity to the HelpFormatter.
> Another option would be to add a set of print....() methods returning the SB instead of printing its content.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CLI-199) Improve HelpFormatter by making renderOptions() and renderWrappedText() public

Posted by "Emmanuel Bourg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CLI-199?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Bourg resolved CLI-199.
--------------------------------

    Resolution: Not A Problem

> Improve HelpFormatter by making renderOptions() and renderWrappedText() public
> ------------------------------------------------------------------------------
>
>                 Key: CLI-199
>                 URL: https://issues.apache.org/jira/browse/CLI-199
>             Project: Commons CLI
>          Issue Type: Improvement
>          Components: CLI-1.x
>    Affects Versions: 1.1, 1.2, 1.3
>            Reporter: gg
>            Priority: Trivial
>         Attachments: HelpFormatter.java
>
>
> Under certain circumstances it is usefull that HelpFormatter printing methods return a string buffer which can be used in further processing instead of direct printing to a PW or std.out. 
> When having a closer look at the source one can easily retrieve string buffers with formatted text by changing the visibility of renderOptions() and renderWrappedText()  from protected to public. This will make the "core" formatting methods available without adding additional functionallity to the HelpFormatter.
> Another option would be to add a set of print....() methods returning the SB instead of printing its content.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CLI-199) Improve HelpFormatter by making renderOptions() and renderWrappedText() public

Posted by "gg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CLI-199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12878217#action_12878217 ] 

gg commented on CLI-199:
------------------------

The assumption I made was not correct. Both rendering methods can stay protected as it would colst too much effort to use them for gettig a nice looking output.
Nevertheless my requirement having help content rendered into a StringBuffer had to be solved. So I added kind of an indirection to the printng exposing additional (public) rendering functions. One can now decide if to print or to render into a SB.

Due to some strage behavior regarding the newLine usage renderHelp() is the only method which may currently not be "generic".

I attached my version of the HelpFormatter to give you a better idea of the whole thing.

Cheers, Ulf



> Improve HelpFormatter by making renderOptions() and renderWrappedText() public
> ------------------------------------------------------------------------------
>
>                 Key: CLI-199
>                 URL: https://issues.apache.org/jira/browse/CLI-199
>             Project: Commons CLI
>          Issue Type: Improvement
>          Components: CLI-1.x
>    Affects Versions: 1.1, 1.2, 1.3
>            Reporter: gg
>            Priority: Trivial
>
> Under certain circumstances it is usefull that HelpFormatter printing methods return a string buffer which can be used in further processing instead of direct printing to a PW or std.out. 
> When having a closer look at the source one can easily retrieve string buffers with formatted text by changing the visibility of renderOptions() and renderWrappedText()  from protected to public. This will make the "core" formatting methods available without adding additional functionallity to the HelpFormatter.
> Another option would be to add a set of print....() methods returning the SB instead of printing its content.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CLI-199) Improve HelpFormatter by making renderOptions() and renderWrappedText() public

Posted by "Emmanuel Bourg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CLI-199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12878121#action_12878121 ] 

Emmanuel Bourg commented on CLI-199:
------------------------------------

Could you give an example of the processing you do on the output of the HelpFormatter? With the current API you should be able to achieve the same result with a StringWriter inside a PrintWriter.

> Improve HelpFormatter by making renderOptions() and renderWrappedText() public
> ------------------------------------------------------------------------------
>
>                 Key: CLI-199
>                 URL: https://issues.apache.org/jira/browse/CLI-199
>             Project: Commons CLI
>          Issue Type: Improvement
>          Components: CLI-1.x
>    Affects Versions: 1.1, 1.2, 1.3
>            Reporter: gg
>            Priority: Trivial
>
> Under certain circumstances it is usefull that HelpFormatter printing methods return a string buffer which can be used in further processing instead of direct printing to a PW or std.out. 
> When having a closer look at the source one can easily retrieve string buffers with formatted text by changing the visibility of renderOptions() and renderWrappedText()  from protected to public. This will make the "core" formatting methods available without adding additional functionallity to the HelpFormatter.
> Another option would be to add a set of print....() methods returning the SB instead of printing its content.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CLI-199) Improve HelpFormatter by making renderOptions() and renderWrappedText() public

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

gg updated CLI-199:
-------------------

    Attachment: HelpFormatter.java

The modiefied version of the HelpFormatter

> Improve HelpFormatter by making renderOptions() and renderWrappedText() public
> ------------------------------------------------------------------------------
>
>                 Key: CLI-199
>                 URL: https://issues.apache.org/jira/browse/CLI-199
>             Project: Commons CLI
>          Issue Type: Improvement
>          Components: CLI-1.x
>    Affects Versions: 1.1, 1.2, 1.3
>            Reporter: gg
>            Priority: Trivial
>         Attachments: HelpFormatter.java
>
>
> Under certain circumstances it is usefull that HelpFormatter printing methods return a string buffer which can be used in further processing instead of direct printing to a PW or std.out. 
> When having a closer look at the source one can easily retrieve string buffers with formatted text by changing the visibility of renderOptions() and renderWrappedText()  from protected to public. This will make the "core" formatting methods available without adding additional functionallity to the HelpFormatter.
> Another option would be to add a set of print....() methods returning the SB instead of printing its content.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.