From c1bff1eb29f06b80fc91f273d91fe9975d7a3513 Mon Sep 17 00:00:00 2001 From: Adrian Laurenzi Date: Wed, 13 Nov 2013 17:32:41 -0800 Subject: [PATCH] added better command line input validation messages --- src/main/java/com/socrata/datasync/Main.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/socrata/datasync/Main.java b/src/main/java/com/socrata/datasync/Main.java index deb0d480..6aa0d82d 100644 --- a/src/main/java/com/socrata/datasync/Main.java +++ b/src/main/java/com/socrata/datasync/Main.java @@ -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; }