From 0d73564e06828fd235c89c742b5cca04903ab5cc Mon Sep 17 00:00:00 2001 From: kyonRay Date: Wed, 23 Oct 2024 15:03:19 +0800 Subject: [PATCH] (jline): fix jline not complete sysconfig bug. --- src/main/java/console/command/JlineUtils.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/console/command/JlineUtils.java b/src/main/java/console/command/JlineUtils.java index ed2f40aa..273cd568 100644 --- a/src/main/java/console/command/JlineUtils.java +++ b/src/main/java/console/command/JlineUtils.java @@ -13,6 +13,7 @@ import console.command.completer.CurrentPathCompleter; import console.command.completer.StringsCompleterIgnoreCase; import console.contract.utils.ContractCompiler; + import java.io.File; import java.io.IOException; import java.util.ArrayList; @@ -21,6 +22,7 @@ import java.util.List; import java.util.Optional; import java.util.Set; + import org.fisco.bcos.sdk.v3.client.Client; import org.fisco.bcos.sdk.v3.client.protocol.response.BcosGroupInfo; import org.fisco.bcos.sdk.v3.client.protocol.response.BcosGroupInfoList; @@ -197,7 +199,7 @@ private static List generateComplters(Client client) { keys.add(SystemConfigService.AUTH_STATUS); for (SystemConfigFeature.Features feature : SystemConfigFeature.Features.values()) { if (client.getChainCompatibilityVersion() - .compareTo(EnumNodeVersion.convertToVersion(feature.enableVersion())) + .compareTo(EnumNodeVersion.convertToVersion(feature.enableVersion())) >= 0) { keys.add(feature.toString()); } @@ -214,7 +216,14 @@ private static List generateComplters(Client client) { if (group.isPresent() && !group.get().getNodeList().isEmpty()) { group.get() .getNodeList() - .forEach(groupNodeInfo -> keys.addAll(groupNodeInfo.getFeatureKeys())); + .forEach(groupNodeInfo -> { + if (groupNodeInfo.getFeatureKeys() != null) { + keys.addAll(groupNodeInfo.getFeatureKeys()); + } + if (groupNodeInfo.getSupportConfigs() != null) { + keys.addAll(groupNodeInfo.getSupportConfigs()); + } + }); } } catch (Exception ignored) { logger.info("Failed to get group info list, skip feature keys.");