picocli icon indicating copy to clipboard operation
picocli copied to clipboard

Add IDefaultValuesProvider API for multi-value default provider

Open remkop opened this issue 3 years ago • 0 comments

Related to #879 and #877:

If new annotations are added to support multi-value default/fallback values, then it makes sense to add new API that provides the multi-value equivalent of the IDefaultProvider interface. Something like this:

public interface IDefaultValuesProvider {
    String[] defaultValue(ArgSpec argSpec) throws Exception; // or List<String>?
}

To be explored:

  • return type: String[] array or some java.util collection like List<String>?
  • use existing @Command(defaultValueProvider) annotation or add separate @Command(defaultValuesProvider) annotation?
  • name: is IDefaultValuesProvider too similar to the existing IDefaultProvider interface? (If we choose to reuse the existing @Command(defaultValueProvider) annotation then would IDefaultValueProvider2 extends IDefaultProvider be better?)
  • Other...?

While the #877 ticket only mentions PropertiesDefaultProvider,

remkop avatar Feb 21 '22 02:02 remkop