Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: current
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:

      args4j 2.0.18

      Description

      It seems that multi value options do not work.

      Steps to reproduce:

      1. create an argument bean with the argument definition:

      @Option(name = "-msg_file", usage = "Message File(s) <msg-file>", required = true, multiValued = true)
      private List<String> msgFiles_;

      2. write an example application which will parse the command line into this argument bean

      3. execute this application with the arguments: -msg_file a.txt b.txt c.txt

      4. args4j will fail with the following error:
      No argument is allowed: b.txt

        Activity

        Hide
        mativait added a comment -

        Same problem is present already in version 2.0.12.

        Show
        mativait added a comment - Same problem is present already in version 2.0.12.
        Hide
        MRalwasser added a comment -

        Any news regarding this issue?

        Show
        MRalwasser added a comment - Any news regarding this issue?
        Hide
        steffenbr added a comment -

        Okay, this issue has been open for more than one year now. This project seems to be dead. I'll check JCommander.

        Show
        steffenbr added a comment - Okay, this issue has been open for more than one year now. This project seems to be dead. I'll check JCommander.
        Hide
        seanf added a comment -

        I think the example @Option is meant to be used like this:
        -msg_file a.txt -msg_file b.txt -msg_file c.txt

        Otherwise Args4j doesn't know when the multiple arguments for -msg_file actually stop.

        Show
        seanf added a comment - I think the example @Option is meant to be used like this: -msg_file a.txt -msg_file b.txt -msg_file c.txt Otherwise Args4j doesn't know when the multiple arguments for -msg_file actually stop.
        Hide
        MRalwasser added a comment -

        It could stop as soon as another valid option name is found.

        Of course this will not work for the corner case that a multi value is passed which is equal to a valid option name but in most of the cases this will solve the problem and it's much better than what we have today.

        Your hint that multi values are used in this way
        "-msg_file a.txt -msg_file b.txt -msg_file c.txt" might be correct but this is far a way from standard unix conventions and practical usage.

        E.g. is should be possible to specify -msg_file *.txt
        and rely on bash expansion which will replace *.txt to all valid matching names.
        Because arg4j needs the name of the option right before every multi value we cannot use
        all the nice unix tools and its benefits easily.

        Show
        MRalwasser added a comment - It could stop as soon as another valid option name is found. Of course this will not work for the corner case that a multi value is passed which is equal to a valid option name but in most of the cases this will solve the problem and it's much better than what we have today. Your hint that multi values are used in this way "-msg_file a.txt -msg_file b.txt -msg_file c.txt" might be correct but this is far a way from standard unix conventions and practical usage. E.g. is should be possible to specify -msg_file *.txt and rely on bash expansion which will replace *.txt to all valid matching names. Because arg4j needs the name of the option right before every multi value we cannot use all the nice unix tools and its benefits easily.

          People

          • Assignee:
            Unassigned
            Reporter:
            MRalwasser
          • Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: