cbeust / jcommander

Command line parsing framework for Java
Apache License 2.0
1.96k stars 334 forks source link

Improve support for collections on default values #490

Closed marcobjorge closed 1 year ago

marcobjorge commented 4 years ago

The previous interface for ´IDefaultProvider´ assumes that defaults have been represented as a String. Although this is ok for most cases, with Lists the String approach becomes harder to guarantee (e.g. unescaped split on comma) and with Maps it's not even supported. By having the ´IDefaultProvider´ return a List instead of a plain String simplifies the representation of default values for Lists (e.g. clean object [1, 2] instead of CSV String 1,2) and allows the representation of Maps (e.g. String a=b).