Skip to content

Commit

Permalink
added better command line input validation messages
Browse files Browse the repository at this point in the history
  • Loading branch information
alaurenz committed Nov 14, 2013
1 parent 31a65da commit c1bff1e
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/main/java/com/socrata/datasync/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,20 @@ public static void main(String[] args) throws ParseException {
}

private static boolean commandArgsValid(CommandLine cmd) {
if(cmd.getOptionValue("i") == null ||
cmd.getOptionValue("f") == null ||
cmd.getOptionValue("m") == null ||
cmd.getOptionValue("h") == null) {
System.out.println("Missing one or more required arguments.");
if(cmd.getOptionValue("f") == null) {
System.out.println("Missing required argument: -f,--file is required");
return false;
}
if(cmd.getOptionValue("h") == null) {
System.out.println("Missing required argument: -h,--header is required");
return false;
}
if(cmd.getOptionValue("i") == null) {
System.out.println("Missing required argument: -i,--datasetid is required");
return false;
}
if(cmd.getOptionValue("m") == null) {
System.out.println("Missing required argument: -m,--method is required");
return false;
}

Expand Down

0 comments on commit c1bff1e

Please sign in to comment.