[ 
https://issues.apache.org/jira/browse/CLI-166?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12713472#action_12713472
 ] 

Emmanuel Bourg commented on CLI-166:
------------------------------------

I'm pondering if this feature shouldn't be marked as Won't Fix. The best we can 
do is to support the feature on Unix only. Supporting Windows means duplicating 
a part of JLine and getting headaches on the native stuff. And if we can't 
support Windows it'll be useless. People developing multiplatform applications 
will use JLine directly, and we would have wasted our time implementing and 
testing a half baked feature.

I suggest documenting in a FAQ how to achieve the automatic width and delegate 
the work to JLine. It's as simple as this:

{code:java}
HelpFormatter hf = new HelpFormatter();
hf.setWidth(Math.min(Terminal.getTerminal().getTerminalWidth(), 120));
{code}

> Terminal width detection
> ------------------------
>
>                 Key: CLI-166
>                 URL: https://issues.apache.org/jira/browse/CLI-166
>             Project: Commons CLI
>          Issue Type: New Feature
>          Components: Help formatter
>            Reporter: Emmanuel Bourg
>             Fix For: 1.3
>
>
> HelpFormatter could be improved by adjusting automatically its width to the 
> width of the terminal. The width of the terminal can be retrieved by the stty 
> command on unix systems, on Windows it requires a native call. The JLine 
> project on SourceForge already implements this logic.
> http://jline.sourceforge.net
> I suggest to add a setAutoWidth(boolean) method in HelpFormatter that will 
> try to get the terminal width. If it fails it'll fall back to the width 
> provided by getWidth().

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

Reply via email to