Skip to content

Commit e01c26b

Browse files
committed
add exit logic for nb call
1 parent 5bc459c commit e01c26b

File tree

6 files changed

+10
-8
lines changed

6 files changed

+10
-8
lines changed

toolkit-app/src/main/java/iot/technology/client/toolkit/app/ToolKitCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public static void main(String[] args) {
8585
boolean isChinese = bundle.getLocale().equals(Locale.CHINESE);
8686
nbCmd.getCommandSpec().usageMessage().hidden(!isChinese);
8787

88-
int exitStatus = commandLine.execute(args);
88+
int exitStatus = commandLine.execute("nb", "call");
8989
if (exitStatus == ExitCodeEnum.NOTEND.getValue()) {
9090
return;
9191
}

toolkit-nbiot/src/main/java/iot/technology/client/toolkit/nb/command/sub/NbCallCommand.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,10 @@ public Integer call() throws Exception {
8282
tkNode.check(context);
8383
bizService.printValueToConsole(code, context);
8484
ObjectUtils.setValue(domain, code, tkNode.getValue(context));
85-
bizService.nbProcessorAfterLogic(code, domain, context);
85+
boolean processLogicResult = bizService.nbProcessorAfterLogic(code, domain, context);
86+
if (!processLogicResult) {
87+
break;
88+
}
8689
code = tkNode.nextNode(context);
8790
} catch (UserInterruptException | EndOfFileException e) {
8891
return ExitCodeEnum.ERROR.getValue();

toolkit-nbiot/src/main/java/iot/technology/client/toolkit/nb/service/NbBizService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public boolean nbProcessorAfterLogic(String code, NbConfigSettingsDomain domain,
113113
FileUtils.writeDataToFile(SYS_NB_MOBILE_PRODUCT_FILE_NAME, settingsJson);
114114
return mobileBizService.call(mobileConfigDomain);
115115
}
116-
return false;
116+
return true;
117117

118118
}
119119

toolkit-nbiot/src/main/java/iot/technology/client/toolkit/nb/service/node/NbTypeNode.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ public class NbTypeNode implements TkNode {
2121

2222
@Override
2323
public void prePrompt(NodeContext context) {
24-
StringUtils.toolkitPromptText();
2524
if (bundle.getLocale().equals(Locale.CHINESE)) {
2625
System.out.format(ColorUtils.greenItalic("(1) 电信AEP * ") + "%n");
2726
System.out.format(ColorUtils.greenItalic("(2) 移动OneNET") + "%n");

toolkit-nbiot/src/main/java/iot/technology/client/toolkit/nb/service/processor/MobileBizService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ public boolean call(MobileConfigDomain mobileConfigDomain) {
6161
while (isEnd) {
6262
String data;
6363
data = reader.readLine(prompt);
64-
if (data.equals("quit")) {
64+
context.setData(data);
65+
if (data.equals("exit")) {
6566
return false;
6667
}
67-
context.setData(data);
6868
for (TkProcessor processor : getTkProcessorList()) {
6969
if (processor.supports(context)) {
7070
processor.handle(context);

toolkit-nbiot/src/main/java/iot/technology/client/toolkit/nb/service/processor/TelecomBizService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ public boolean call(TelecomConfigDomain telecomConfigDomain) {
6262
while (isEnd) {
6363
String data;
6464
data = reader.readLine(prompt);
65-
if (data.equals("quit")) {
65+
context.setData(data);
66+
if (data.equals("exit")) {
6667
return false;
6768
}
68-
context.setData(data);
6969
for (TkProcessor processor : getTkProcessorList()) {
7070
if (processor.supports(context)) {
7171
processor.handle(context);

0 commit comments

Comments
 (0)