for (String alias : aliases) {
options.put(alias, option);
}
}
}
Argument argument = field.getAnnotation(Argument.class);
if (argument != null) {
Integer key = argument.index();
if (arguments.containsKey(key)) {
LOGGER.warn("Duplicate @Argument annotations on class " + type.getName() + " for index: " + key + " see: " + field);
} else {
arguments.put(key, field);
}
}
}
}
options.put(HelpOption.HELP.name(), HelpOption.HELP);
optionsCompleter = new StringsCompleter(options.keySet());
// Build arguments completers
List<Completer> argsCompleters = null;
Map<String, Completer> optionalCompleters = null;
if (function instanceof CompletableFunction) {
Map<String, Completer> focl = ((CompletableFunction) function).getOptionalCompleters();
List<Completer> fcl = ((CompletableFunction) function).getCompleters();
if (focl != null || fcl != null) {
argsCompleters = new ArrayList<Completer>();
if (fcl != null) {
for (Completer c : fcl) {
argsCompleters.add(c == null ? NullCompleter.INSTANCE : c);
}
}
optionalCompleters = focl;
}
}
if (argsCompleters == null) {
final Map<Integer, Object> values = getCompleterValues(function);
argsCompleters = new ArrayList<Completer>();
boolean multi = false;
for (int key = 0; key < arguments.size(); key++) {
Completer completer = null;
Field field = arguments.get(key);
if (field != null) {
Argument argument = field.getAnnotation(Argument.class);
multi = (argument != null && argument.multiValued());
org.apache.karaf.shell.commands.Completer ann = field.getAnnotation(org.apache.karaf.shell.commands.Completer.class);
if (ann != null) {
Class clazz = ann.value();
String[] value = ann.values();
if (clazz != null) {