java - command line parsing using apache commons cli -
Tryng to use m apache commons cli, my use case is the variable number of arguments with some options.
Say
-p str1 str2; this could be
-p str1 str2 str3. Strn another
-m str1 -h with
cmdline.getOptionValues ("p"); This only brings the final string. How can I get all the values of a particular option?
Edit:
if (Cmdline.hasOption ("p")) {string [] argsList = cmdline.getOptionValues (p); String string = arrays.toString (argsList); ArgsList = strLine.split (","); } Am I doing this right? Should I get accurate data in the string that I want or unknowingly add white spaces to someone else?
Use isres () with a value separator set to a comma , Then the option becomes -p str1, str2, str3, ..., strn CLI < How to manage multi-valuable options in / html>
Comments
Post a Comment