Skip to content

Commit

Permalink
[hotfix] Improve StandaloneJobClusterEntrypoint command line help
Browse files Browse the repository at this point in the history
Properly print the CLI help if the command line options could not be parsed.
  • Loading branch information
tillrohrmann committed Aug 22, 2018
1 parent 65dffc6 commit fa3fba5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public static void main(String[] args) {
clusterConfiguration = commandLineParser.parse(args);
} catch (FlinkParseException e) {
LOG.error("Could not parse command line arguments {}.", args, e);
commandLineParser.printHelp();
commandLineParser.printHelp(StandaloneJobClusterEntryPoint.class.getSimpleName());
System.exit(1);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public static void main(String[] args) {
entrypointClusterConfiguration = commandLineParser.parse(args);
} catch (FlinkParseException e) {
LOG.error("Could not parse command line arguments {}.", args, e);
commandLineParser.printHelp();
commandLineParser.printHelp(StandaloneSessionClusterEntrypoint.class.getSimpleName());
System.exit(1);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ public T parse(@Nonnull String[] args) throws FlinkParseException {
return parserResultFactory.createResult(commandLine);
}

public void printHelp() {
public void printHelp(@Nonnull String cmdLineSyntax) {
final HelpFormatter helpFormatter = new HelpFormatter();
helpFormatter.printHelp("", parserResultFactory.getOptions());
helpFormatter.setLeftPadding(5);
helpFormatter.setWidth(80);
helpFormatter.printHelp(cmdLineSyntax, parserResultFactory.getOptions(), true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ private static Configuration loadConfiguration(String[] args) throws FlinkParseE
clusterConfiguration = commandLineParser.parse(args);
} catch (FlinkParseException e) {
LOG.error("Could not parse the command line options.", e);
commandLineParser.printHelp();
commandLineParser.printHelp(TaskManagerRunner.class.getSimpleName());
throw e;
}

Expand Down

0 comments on commit fa3fba5

Please sign in to comment.