MCPcopy Create free account
hub / github.com/gnmyt/Nexterm / processLine

Method processLine

server/lib/ScriptLayer.js:87–125  ·  view source on GitHub ↗
(line)

Source from the content-addressed store, hash-verified

85 }
86
87 processLine(line) {
88 if (this.suppressOutput) {
89 const clean = stripAnsi(line).trim();
90 if (clean === "NEXTERM_READY") {
91 this.suppressOutput = false;
92 return;
93 }
94 }
95 const cmd = processNextermLine(line);
96 if (!cmd) return;
97 switch (cmd.type) {
98 case "input": case "select":
99 this.pending = cmd;
100 this.broadcast(MSG.PROMPT, { inputType: cmd.type, variable: cmd.variable, prompt: cmd.prompt, default: cmd.default, options: cmd.options });
101 break;
102 case "step": this.broadcast(MSG.STEP, { number: this.step++, description: cmd.description }); break;
103 case "warning": this.broadcast(MSG.WARNING, { message: cmd.message }); break;
104 case "info": this.broadcast(MSG.INFO, { message: cmd.message }); break;
105 case "success": this.broadcast(MSG.SUCCESS, { message: cmd.message }); break;
106 case "confirm":
107 this.pending = { variable: "NEXTERM_CONFIRM_RESULT", prompt: cmd.message, inputType: "confirm" };
108 this.broadcast(MSG.CONFIRM, this.pending);
109 break;
110 case "progress": this.broadcast(MSG.PROGRESS, { percentage: cmd.percentage, message: cmd.message || "" }); break;
111 case "summary":
112 this.pending = { variable: "NEXTERM_SUMMARY_RESULT", inputType: "summary" };
113 this.broadcast(MSG.SUMMARY, { title: cmd.title, data: cmd.data });
114 break;
115 case "table":
116 this.pending = { variable: "NEXTERM_TABLE_RESULT", inputType: "table" };
117 this.broadcast(MSG.TABLE, { title: cmd.title, data: cmd.data });
118 break;
119 case "msgbox":
120 this.pending = { variable: "NEXTERM_MSGBOX_RESULT", inputType: "msgbox" };
121 this.broadcast(MSG.MSGBOX, { title: cmd.title, message: cmd.message });
122 break;
123 case "end": this.handleEnd(cmd.exitCode); break;
124 }
125 }
126
127 createMessageHandler(ws) {
128 const handler = (msg) => {

Callers 2

processOutputMethod · 0.95
handleEndMethod · 0.95

Calls 4

broadcastMethod · 0.95
handleEndMethod · 0.95
processNextermLineFunction · 0.85
stripAnsiFunction · 0.50

Tested by

no test coverage detected