diff options
Diffstat (limited to 'appc-common/src')
-rw-r--r-- | appc-common/src/main/java/org/onap/appc/CmdLine.java | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/appc-common/src/main/java/org/onap/appc/CmdLine.java b/appc-common/src/main/java/org/onap/appc/CmdLine.java index d63bd8758..383de8949 100644 --- a/appc-common/src/main/java/org/onap/appc/CmdLine.java +++ b/appc-common/src/main/java/org/onap/appc/CmdLine.java @@ -29,32 +29,27 @@ import org.onap.appc.encryption.EncryptionTool; public class CmdLine { public static void main(String[] args) { - if(args.length <= 1 || args.length >= 3){ - printUsage(); - }else{ - String command = args[0]; - - switch(command){ - case "encrypt": - if(args[1]!= null){ - String clearText = args[1]; - String encrypted = EncryptionTool.getInstance().encrypt(clearText); - System.out.println(encrypted); - }else{ - printUsage(); - } - break; - default: - printUsage(); - break; - + + if (args.length < 1) { + printUsage(); + return; + } + + String command = args[0];//first parameter + + if (0 == command.compareTo("encrypt") && args.length == 2)//two parameters are required + { + String clearText = args[1]; + String encrypted = EncryptionTool.getInstance().encrypt(clearText); + System.out.println(encrypted); + return; + } else { + printUsage(); } - } - } private static void printUsage(){ System.out.println("Usage: java -jar <this jar> ..."); System.out.println("\tencrypt <your text> \t\t(Encrypts your text)"); } -} +}
\ No newline at end of file |