How to get the input order of parameters in JCommander?

sensn :

How can I get the input order of parameters in JCommander?
I want to know which parameter was input first.
For example

Myapp --cut -- reverse
Myapp --reverse -- cut

Is this possible in Jcommander?
And if so, how?

Mạnh Quyết Nguyễn :

One way to achieve your need is instead of define multiple flag.

See Arities (multiple values for parameters)

Then read your command args:

@Parameter(names = "-cmd", variableArity = true)
public List<String> commands= new ArrayList<>();

MyApp -cmd cut reverse -anotherCmd 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=34675&siteId=1