-
Notifications
You must be signed in to change notification settings - Fork 425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
StringIndexOutOfBounds in help when command has too many (and long) aliases #1870
Comments
Nice catch! 👍 |
Huh, it seems I won't be able to try to fix that. There's even a question what should be a solution. Let it overflow? Wrap the line? |
Picocli’s table component supports both of these options, so try both and see which result you like better. |
Huh, I'm sorry, I wasn't even able to manage my clone to build. It's not a high priority thing, it can wait , maybe a few months. |
I have a fix, will commit shortly
test @Test
public void testIssue1870StringIndexOutOfBounds() {
@Command(name = "top", subcommands = ImportCommand.class) class Top { }
String actual = usageString(new CommandLine(new Top()), Help.Ansi.OFF);
String expected = String.format("" +
"Usage: top [COMMAND]%n" +
"Commands:%n" +
" import-from-excel, import-from-xls, import-from-xlsx, import-from-csv,%n" +
" import-from-txt%n" +
" Imports the data from various excel%n" +
" files (xls, xlsx, csv or even%n" +
" txt).%n");
assertEquals(expected, actual);
} |
Hello,
I have a command with several aliases, and they are "long", like so:
When I use it as a subcommand and trigger help on that supercommand (either by using the
HelpCommand
or via theusageHelp
, picocli fails with following stack trace:It all seems it's trying to fit all the alliases on one help line, but overflowing that line. If I remove the last alias, it outputs really narrow column with the description:
Could it be fixed please?
The text was updated successfully, but these errors were encountered: