Skip to content

Any recommendation to parse arguments that are space separated #2342

Answered by remkop
snicoll asked this question in Q&A
Discussion options

You must be logged in to vote

Okay, I think there is some confusion because of the unit tests: if the values are quoted correctly, the single-arity option --compiler-arguments does exactly what you need.

In the unit tests, however, there should be no quotes because they are interpreted and removed by the shell (Bash for example).

Example code:

import picocli.CommandLine;
import picocli.CommandLine.Option;
import picocli.CommandLine.Parameters;

import java.util.Arrays;
import java.util.List;

public class MyCommand implements Runnable {
    @Option(names = { "--compiler-arguments" }, split = " ",
            description = "Compiler arguments to use to compile generated sources.")
    private List<String> compilerArgum…

Replies: 7 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@snicoll
Comment options

Comment options

You must be logged in to vote
2 replies
@remkop
Comment options

@snicoll
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@snicoll
Comment options

Answer selected by snicoll
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants