Last active
May 9, 2019 16:59
-
-
Save daharon/e6b303c643c1a286830067e7d848e888 to your computer and use it in GitHub Desktop.
Double printing of argument group members
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Usage: <main class> [--foos=FOO[,FOO...] [--foos=FOO[,FOO...]]... --bars=BAR[, | |
BAR...] [--bars=BAR[,BAR...]]...] | |
GROUP --bars=BAR[,BAR...] | |
--foos=FOO[,FOO...] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Usage: <main class> [--foos=FOO[,FOO...] [--foos=FOO[,FOO...]]... --bars=BAR[, | |
BAR...] [--bars=BAR[,BAR...]]...] | |
GROUP --bars=BAR[,BAR...] | |
--foos=FOO[,FOO...] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import picocli.CommandLine; | |
import picocli.CommandLine.ArgGroup; | |
import picocli.CommandLine.Option; | |
import java.util.List; | |
public class PicoCliTestJava implements Runnable { | |
@ArgGroup(heading = "GROUP", exclusive = false) | |
private Group group; | |
private static class Group { | |
@Option(names = {"--foos"}, | |
paramLabel = "FOO", | |
split = ",", | |
required = true) | |
List<String> foos; | |
@Option(names = {"--bars"}, | |
paramLabel = "BAR", | |
split = ",", | |
required = true) | |
List<String> bars; | |
} | |
@Override | |
public void run() { | |
CommandLine.usage(this, System.out); | |
} | |
public static void main(String[] args) { | |
CommandLine.run(new PicoCliTestJava(), args); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import picocli.CommandLine | |
import picocli.CommandLine.ArgGroup | |
import picocli.CommandLine.Option | |
class PicoCliTestKotlin : Runnable { | |
@ArgGroup(heading = "GROUP", exclusive = false) | |
private var group: Group = Group() | |
companion object { | |
private class Group { | |
@Option(names = ["--foos"], | |
paramLabel = "FOO", | |
split = ",", | |
required = true) | |
var foos: MutableList<String> = mutableListOf() | |
@Option(names = ["--bars"], | |
paramLabel = "BAR", | |
split = ",", | |
required = true) | |
var bars: MutableList<String> = mutableListOf() | |
} | |
} | |
override fun run() = CommandLine.usage(this, System.out) | |
} | |
fun main(args: Array<String>) = | |
CommandLine.run(PicoCliTestKotlin(), *args) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment