Skip to content

Commit

Permalink
Submit Import: Error if extra parameters on command line
Browse files Browse the repository at this point in the history
  • Loading branch information
danjasuw committed May 19, 2020
1 parent a7d26a3 commit eeb11a4
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,18 @@ public static void main(String[] args) throws Exception {
System.exit( PROGRAM_EXIT_CODE_HELP );
}
}

// Show an error if there is anything on the command line not associated with a parameter
String[] remainingArgs = cmdLineParser.getRemainingArgs();
if( remainingArgs.length > 0 ) {
System.out.println( "Unexpected command line parameters:");
for ( String remainingArg : remainingArgs ) {
System.out.println( remainingArg );
}
System.err.println( "" );
System.err.println( FOR_HELP_STRING );
System.exit( PROGRAM_EXIT_CODE_INVALID_INPUT );
}

usernameFromCommandLine = (String)cmdLineParser.getOptionValue( usernameCommandLineOpt );

Expand Down

0 comments on commit eeb11a4

Please sign in to comment.