2

I'm using picocli to implement a cli tool and I've got a command which looks like the following.

mainCommand subCommand <parameter1>:<parameter2> parameter3

The question I have is how to map the parameter and parameter2 as picoCli parameters using the picoCli annotation. The following is my approach on the annotations.

@CommandLine.Parameters(index = "0", split = ":")
private List<String> moduleParam;

Is the above the correct way to annotate the parameters or is there a better way on implementing the annotation. Please advice.

Imesh Chandrasiri
  • 5,558
  • 15
  • 60
  • 103

1 Answers1

1

The split attribute can be used for both named options and positional parameters.

What you’re doing looks fine to me.

Remko Popma
  • 35,130
  • 11
  • 92
  • 114