Skip to content

Commit

Permalink
Fail when extra unsupported parameters were given to CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
kokosing committed Dec 12, 2017
1 parent e903092 commit 070bad4
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ public class TemptoRunnerCommandLineParser
public static class ParsingException
extends RuntimeException
{
public ParsingException(String message)
{
super(message);
}

public ParsingException(String message, Throwable cause)
{
super(message, cause);
Expand Down Expand Up @@ -130,6 +135,9 @@ private boolean isChangable(String option)
private TemptoRunnerOptions commandLineToOptions(CommandLine commandLine)
{
ImmutableMap.Builder<String, String> values = ImmutableMap.<String, String>builder();
if (!commandLine.getArgList().isEmpty()) {
throw new ParsingException("Extra unsupported parameters: " + commandLine.getArgList());
}
for (Option option : options) {
Optional<String> value = getOptionValue(commandLine, option);
if (value.isPresent()) {
Expand Down

0 comments on commit 070bad4

Please sign in to comment.