Hi,

I have read the CLI usage.html and searched the JDocs and mail archives. I
cannot figure out a *good* way to solve my problem, I gather there is
something very simple I am missing.

Here's how I'd like to use the command line:

Process -run <name> -files file1.xml file2.xml file3.xml file*n*.xml

... where there is a minimum of zero and no maximum number of file names
given. Name is a String and is mandatory. So and example is:

Process -run "SendAll" -files description.xml anotherdumbexample.xml
yetanotherdumbexample.xml

Here's the relevant code (I think):

 public static void main(String[] args) {
    Options options = new Options();
    Option run = OptionBuilder.hasArg()
                              .withArgName("files")
                              .withValueSeparator()
                              .withDescription("Run a process")
                              .create("run");
    //NOTE: How can I change the above to get desired outcome???

    options.addOption(run);

    CommandLineParser parser = new BasicParser();
    try {
      CommandLine cmd = parser.parse(options, args);
      if(cmd.hasOption("run")) {
        //NOTE: This is the sort of thing I'm trying to do...
        //NOTE: What is the 'proper' way???
        String commandName = cmd.getOptionValue("run");
        List fileNames = cmd.getArgValues("files");
        //Then iterate through the fileNames list retrieving each filename
      }
    }
    catch (ParseException e) {
    }
  }



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to