You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Jeremiah Voris <je...@gmail.com> on 2006/03/07 23:10:08 UTC

[CLI] Help Formatting

I just downloaded cli 1.0 and have begun playing with it. It seems
fairly straightforward but I am running into one oddity and am not
sure if it is just that I'm missing something or if there is a bug. It
seems as if descriptions that line wrap loose track of where they
should cut off the line after they wrap.

In other words, let's say you have 150 characters of description text
and an indent of 25 characters to display your options within. The
description text for the first line will go on for about 50 characters
or so and then wrap. On that wrapped line, it will start at the
correct indent position but it looks like it is feeding a string
longer than 50 or so characters long for that second and any
subsequent description lines. The result is nasty wrapping that
clutters up the help description.

Again, I'm not sure if I'm doing something wrong, so here's some
simple code to show what I'm doing:

Options options = new Options();
options.addOption(OptionBuilder.withArgName("context")
					.withLongOpt("context")
					.hasArg()
					.withDescription(
						"Here is a very long description "
						+ "that should wrap over three lines "
						+ "and you should notice how the "
						+ "wrapping messes up after the first "
						+ "line.")
					.create('c'));

HelpFormatter help = new HelpFormatter();
help.printHelp("Application", options, true);


So I guess my question is, am I doing something wrong?

--
533777336444244

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org