Skip to content

variableArity does not end when new argument appears #26

@tomasbjerre

Description

@tomasbjerre

I'm using variable artity:

    final Argument<List<List<String>>> violationsArg =
        stringArgument("--violations", "-v")
            .variableArity()
            .repeated()
            .description(
                "The violations to look for. <PARSER> <FOLDER> <REGEXP PATTERN> <NAME> where PARSER is one of: "
                    + parsersString
                    + "\n Example: -v \"JSHINT\" \".\" \".*/jshint.xml$\" \"JSHint\"")
            .build();

This works great:

npx violations-command-line -s ERROR -mv 0 \
 -v "CHECKSTYLE" "." ".*checkstyle/main\.xml$" "Checkstyle" \
 -v "JSHINT" "." ".*jshint/report\.xml$" "JSHint"

But if I move single parameter arguments after arguments with variable arity:

npx violations-command-line \
 -v "CHECKSTYLE" "." ".*checkstyle/main\.xml$" "Checkstyle" \
 -v "JSHINT" "." ".*jshint/report\.xml$" "JSHint" \
 -s ERROR -mv 0

The -s ERROR -mv 0 is parsed as arguments to -v.

Is this intended? What I would have wanted is to have same result as in first example.

https://github.com/tomasbjerre/violations-command-line/blob/master/src/main/java/se/bjurr/violations/main/Runner.java

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions