use of org.jboss.as.cli.CommandLineCompleter in project wildfly-core by wildfly.
the class OperationRequestCompleter method completeNoPropertiesProvided.
private int completeNoPropertiesProvided(CommandContext ctx, String buffer, Collection<CommandArgument> allArgs, List<String> candidates) {
try {
boolean needNeg = false;
for (CommandArgument arg : allArgs) {
if (arg.canAppearNext(ctx)) {
// In this case call the value completer.
if (arg.getIndex() >= 0) {
final CommandLineCompleter valCompl = arg.getValueCompleter();
if (valCompl != null) {
valCompl.complete(ctx, "", 0, candidates);
// Values have been added as candidate.
// If there are some options to propose, they will be mixed
// with the values. That only applies to commands.
}
} else {
candidates.add(arg.getDecoratedName());
// doesn't need a value (is a boolean).
if (!arg.isValueRequired()) {
needNeg = true;
}
}
}
}
if (needNeg) {
candidates.add(Util.NOT_OPERATOR);
}
Collections.sort(candidates);
return buffer.length();
} catch (CommandFormatException e) {
return -1;
}
}
Aggregations