//profile.addCantAppearAfter(helpArg);
operation = new ArgumentWithValue(this, new DefaultCompleter(new CandidatesProvider(){
@Override
public Collection<String> getAllCandidates(CommandContext ctx) {
DefaultOperationRequestAddress address = new DefaultOperationRequestAddress();
if(isDependsOnProfile() && ctx.isDomainMode()) {
final String profileName = profile.getValue(ctx.getParsedCommandLine());
if(profileName == null) {
return Collections.emptyList();
}
address.toNode("profile", profileName);
}
for(OperationRequestAddress.Node node : getRequiredAddress()) {
address.toNode(node.getType(), node.getName());
}
address.toNode(getRequiredType(), "?");
Collection<String> ops = ctx.getOperationCandidatesProvider().getOperationNames(ctx, address);
ops.removeAll(excludedOps);
if(customHandlers != null) {
ops.addAll(customHandlers.keySet());
}
return ops;
}}), 0, "--operation") {
@Override
public boolean canAppearNext(CommandContext ctx) throws CommandFormatException {
if(isDependsOnProfile() && ctx.isDomainMode() && !profile.isValueComplete(ctx.getParsedCommandLine())) {
return false;
}
return super.canAppearNext(ctx);
}
};
operation.addCantAppearAfter(helpArg);
name = new ArgumentWithValue(this, new DefaultCompleter(new DefaultCompleter.CandidatesProvider() {
@Override
public List<String> getAllCandidates(CommandContext ctx) {
ModelControllerClient client = ctx.getModelControllerClient();
if (client == null) {
return Collections.emptyList();
}
DefaultOperationRequestAddress address = new DefaultOperationRequestAddress();
if(isDependsOnProfile() && ctx.isDomainMode()) {
final String profileName = profile.getValue(ctx.getParsedCommandLine());
if(profile == null) {
return Collections.emptyList();
}
address.toNode("profile", profileName);
}
for(OperationRequestAddress.Node node : getRequiredAddress()) {
address.toNode(node.getType(), node.getName());
}
return Util.getNodeNames(ctx.getModelControllerClient(), address, getRequiredType());
}
}), (idProperty == null ? "--name" : "--" + idProperty)) {
@Override