You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, please make it possible to customize the default enum values in the help. Type names are not always sufficient.
Example of how I modified it. You can use it or think of another way.
Create custom DefaultUsageFormatter with overridden method appendAllParametersDetails(..) and under line where is if (type.isEnum()) {
public interface IEnumFormatter {
List<String> getValues();
}
Usage on custom (my) enum is:
public enum ActionType implements IEnumFormatter {
KILL("kill"),
SACRIFICE_HAMSTER("sacrifice");
private final String alias;
ActionType(String alias) {
this.alias = alias;
}
@Override
public List<String> getValues() {
var values = values();
var list = new ArrayList<String>(values.length);
for (var v : values) {
list.add(v.alias);
}
return list;
}
}
PS:
Method newLineAndIndent(..) in DefaultUsageFormatter must be protected not private.
Thanks and let me know ;-)
The text was updated successfully, but these errors were encountered:
Hi, please make it possible to customize the default enum values in the help. Type names are not always sufficient.
Example of how I modified it. You can use it or think of another way.
Create custom DefaultUsageFormatter with overridden method appendAllParametersDetails(..) and under line where is
if (type.isEnum()) {
modify this:
String valueList = EnumSet.allOf((Class<? extends Enum>) type).toString();
on this:
Create a new interface:
Usage on custom (my) enum is:
PS:
Method newLineAndIndent(..) in DefaultUsageFormatter must be protected not private.
Thanks and let me know ;-)
The text was updated successfully, but these errors were encountered: