Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private static void appendSynopsis(Command command, StringBuilder helpMessageBui
if (!options.isEmpty()) {
for (CommandOption option : options) {
helpMessageBuilder.append(" ");
if (isRequired(option)) {
if (!isRequired(option)) {
helpMessageBuilder.append("[");
}
if (option.longName() != null) {
Expand All @@ -92,7 +92,7 @@ private static void appendSynopsis(Command command, StringBuilder helpMessageBui
helpMessageBuilder.append("-").append(option.shortName());
}
helpMessageBuilder.append(" ").append(option.type().getSimpleName());
if (isRequired(option)) {
if (!isRequired(option)) {
helpMessageBuilder.append("]");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void testRenderHelpWithRequiredAndOptionalOptions() {
This command says hi to the user.

SYNOPSIS
hi [--name String] --times int --help
hi --name String [--times int] --help

OPTIONS
--name or -n String
Expand Down Expand Up @@ -173,7 +173,7 @@ void testRenderHelpWithOptionalOptionMissingDefaultValueUsesPrimitiveDefault() {
hi - Say hi

SYNOPSIS
hi --times int --help
hi [--times int] --help

OPTIONS
--times or -t int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void testHelpMessageForCommand() throws Exception {
This command says hi to the user.

SYNOPSIS
hi [--name String] --times int --help
hi --name String [--times int] --help

OPTIONS
--name or -n String
Expand Down Expand Up @@ -185,7 +185,7 @@ void testHelpMessageForCommandWithArgs() throws Exception {
This command says hi to the user.

SYNOPSIS
hi --times int [(String)] [(String)] --help
hi [--times int] [(String)] [(String)] --help

OPTIONS
--times or -t int
Expand Down Expand Up @@ -259,7 +259,7 @@ void testHelpMessageForCommandWithVariadicArgs() throws Exception {
This command says hi to the user.

SYNOPSIS
hi --name String (Integer...) --help
hi [--name String] (Integer...) --help

OPTIONS
--name String
Expand Down Expand Up @@ -339,7 +339,7 @@ void testSynopsisSpaceBetweenNonRequiredOptions() throws Exception {
This command says hi to the user.

SYNOPSIS
hi [--name String] --times int --suffix String --help
hi --name String [--times int] [--suffix String] --help

OPTIONS
--name or -n String
Expand Down Expand Up @@ -416,7 +416,7 @@ void testHelpMessageForCommandAlias() throws Exception {
This command says hi to the user.

SYNOPSIS
hi [--name String] --times int --help
hi --name String [--times int] --help

OPTIONS
--name or -n String
Expand Down Expand Up @@ -478,7 +478,7 @@ void testHelpMessageForCommandWithoutHelpText() throws Exception {
hi - Say hi

SYNOPSIS
hi [--name String] --help
hi --name String --help

OPTIONS
--name or -n String
Expand Down