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?
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?
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