Multiple args with arg4j

user2281439

I have a parameter which I need to parse from command line. I use for this arg4j of version 2.0.23. I need to parse path parameter and in command line can be specified one or more path's. So I need to parse multiple params. Here's the way I find:

private List<String> list = new ArrayList<String>();

@Option(name = "-p", required = true)
public void addPath(String arg) {list.add(arg);}  

It works ok. But I want to know is it correct or there is a better way? I've googled that in version 2.0.13 there was parameter multipleValue in @Option, but seems now it's gone.

donnyton

Try:

import org.kohsuke.args4j.spi.StringArrayOptionHandler;

@Option(name = "-p", handler = StringArrayOptionHandler.class, required = true)
private List<String> list;

which should allow

-p arg1 arg2 ...

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Using map with multiple args

From Dev

Switch case with multiple args

From Dev

argparse set default to multiple args

From Dev

Nginx How to get multiple $args?

From Dev

Clojure: filtering with a function of multiple args

From Dev

Run command with args multiple time

From Dev

Pass multiple args from bash into python

From Dev

xargs with multiple commands and max-args

From Dev

Apply function to multiple pandas columns with Args

From Dev

python syntax error *args with optional arg

From Dev

Args4j list arguments that contain space not handled

From Dev

How can I validate options with args4j?

From Dev

How do I fix a StringTempate4 error: context passed 2 args to template with 1 declared arg

From Dev

How to pass/receive multiple args to a RESTful Web API GET method?

From Dev

how to use lodash _ without operator with an array rather than multiple args

From Dev

Multiple commands with args under 1 hotkey in Sublime Text 3

From Dev

django-rest-framework HyperlinkedIdentityField with multiple lookup args

From Dev

Excute java class from python with extrnal jar and multiple args

From Dev

How to use *args to create multiple html tables from lists?

From Dev

Combine url with multiple same args from submitted form

From Dev

Is the order of std::env::args guaranteed to remain consistent over multiple calls?

From Dev

Python/ PonyORM /MySQL - Query using multiple URL Args

From Dev

Why have a function with an_arg_name and *args as parameters instead of just *args

From Dev

a bezier function that takes 4 args in haskell

From Dev

P4 Trigger, %args% parameter is empty

From Dev

Python decorate methods with variable number of positional args and optional arg

From Dev

How to access arg/args (passed by `GridCompute.apply()`) from GridClosure?

From Dev

Exception while parsing command line options using args4j

From Dev

Remove default value in printUsage() method. [args4j library]

Related Related

  1. 1

    Using map with multiple args

  2. 2

    Switch case with multiple args

  3. 3

    argparse set default to multiple args

  4. 4

    Nginx How to get multiple $args?

  5. 5

    Clojure: filtering with a function of multiple args

  6. 6

    Run command with args multiple time

  7. 7

    Pass multiple args from bash into python

  8. 8

    xargs with multiple commands and max-args

  9. 9

    Apply function to multiple pandas columns with Args

  10. 10

    python syntax error *args with optional arg

  11. 11

    Args4j list arguments that contain space not handled

  12. 12

    How can I validate options with args4j?

  13. 13

    How do I fix a StringTempate4 error: context passed 2 args to template with 1 declared arg

  14. 14

    How to pass/receive multiple args to a RESTful Web API GET method?

  15. 15

    how to use lodash _ without operator with an array rather than multiple args

  16. 16

    Multiple commands with args under 1 hotkey in Sublime Text 3

  17. 17

    django-rest-framework HyperlinkedIdentityField with multiple lookup args

  18. 18

    Excute java class from python with extrnal jar and multiple args

  19. 19

    How to use *args to create multiple html tables from lists?

  20. 20

    Combine url with multiple same args from submitted form

  21. 21

    Is the order of std::env::args guaranteed to remain consistent over multiple calls?

  22. 22

    Python/ PonyORM /MySQL - Query using multiple URL Args

  23. 23

    Why have a function with an_arg_name and *args as parameters instead of just *args

  24. 24

    a bezier function that takes 4 args in haskell

  25. 25

    P4 Trigger, %args% parameter is empty

  26. 26

    Python decorate methods with variable number of positional args and optional arg

  27. 27

    How to access arg/args (passed by `GridCompute.apply()`) from GridClosure?

  28. 28

    Exception while parsing command line options using args4j

  29. 29

    Remove default value in printUsage() method. [args4j library]

HotTag

Archive