>>>>> "Raif" == Raif S Naffah <[EMAIL PROTECTED]> writes:

Raif> the attached proposed patch adds better handling of longOnly options 
Raif> when printing the tool's help text.

Thanks.

Raif> Index: Parser.java

Raif> +  private void printText(PrintStream out, String text)
Raif> +  {

Raif> +        // is there a newline in the substring [start..finish]?

If we're implementing line wrapping then we shouldn't need newlines in
the text in the first place, should we?

It seems to me that we should just ensure that the input strings here
are properly formatted to 80 characters.  That can be done in the
source and by the translators.  Then we don't need wrapping support in
Parser at all.

Raif> +    if (longOnly)
Raif> +      printHelpLongOnly(out);
Raif> +    else
Raif> +      printHelp(out);

I'd rather not have a second method for printHelpLongOnly.
"Long only" is actually a misnomer left over from GNU getopt -- the
short form of options is still supported and should still be
documented in the help output.

So instead this should just be a flag on printHelp.

One thing that is still missing is nice support for the case when the
help overflows a line.  I think your code here isn't sufficient,
though, in that we would want to indent following lines to the start
of long text properly.  Here is an example from 'cp --help':

  -u, --update                 copy only when the SOURCE file is newer
                                 than the destination file or when the
                                 destination file is missing

Since we're computing the columns dynamically we would have to compute
the starting column for the help text and indent to there plus 2.

One concern I have is that wrapping is a pain to get right across
Locales, and even in English if there is quoted text.  But maybe we
can just try it and see.

Tom

Reply via email to