Skip to content

Commit

Permalink
Don't print usage errors when using -h/--help
Browse files Browse the repository at this point in the history
This is unfortunately due to a bug in airline itself
(airlift/airline#44). So it's easier to just
have a workaround in place when printing the help message.
  • Loading branch information
Eduard Tudenhoefner committed Mar 30, 2020
1 parent 520457a commit ffbc678
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions management-api-server/src/main/java/com/datastax/mgmtapi/Cli.java
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,18 @@ public static void main(String[] args) {
}
catch (ParseException p)
{
System.err.println(String.format("Usage error: %s", p.getMessage()));
System.err.println();
//noinspection StatementWithEmptyBody
if (args.length > 0 && (args[0].equals("-h") || args[0].equals("--help")))
{
// don't tell the user it's a usage error
// a bug in airline (https://github.com/airlift/airline/issues/44) prints a usage error even if
// a user just uses -h/--help
}
else
{
System.err.println(String.format("Usage error: %s", p.getMessage()));
System.err.println();
}

try
{
Expand Down

0 comments on commit ffbc678

Please sign in to comment.