}}), "--property-id");
idProperty.addRequiredPreceding(nodePath);
commandName = new ArgumentWithValue(this, new DefaultCompleter(new CandidatesProvider(){
private final DefaultCallbackHandler callback = new DefaultCallbackHandler();
@Override
public List<String> getAllCandidates(CommandContext ctx) {
final String actionName = action.getValue(ctx.getParsedCommandLine());
if(actionName == null) {
return Collections.emptyList();
}
if (actionName.equals("add")) {
final String thePath = nodePath.getValue(ctx.getParsedCommandLine());
if (thePath == null) {
return Collections.emptyList();
}
callback.reset();
try {
ParserUtil.parseOperationRequest(thePath, callback);
} catch (CommandFormatException e) {
return Collections.emptyList();
}
OperationRequestAddress typeAddress = callback.getAddress();
if (!typeAddress.endsOnType()) {
return Collections.emptyList();
}
return Collections.singletonList(typeAddress.getNodeType());
}