MCPcopy
hub / github.com/di-sukharev/opencommit / prompt

Method prompt

out/cli.cjs:398–409  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

396 a(this, "input"), a(this, "output"), a(this, "rl"), a(this, "opts"), a(this, "_track", false), a(this, "_render"), a(this, "_cursor", 0), a(this, "state", "initial"), a(this, "value"), a(this, "error", ""), a(this, "subscribers", /* @__PURE__ */ new Map()), a(this, "_prevFrame", ""), this.opts = s2, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = u3.bind(this), this._track = C5, this.input = F5, this.output = e3;
397 }
398 prompt() {
399 const u3 = new import_node_tty.WriteStream(0);
400 return u3._write = (F5, e3, s2) => {
401 this._track && (this.value = this.rl.line.replace(/\t/g, ""), this._cursor = this.rl.cursor, this.emit("value", this.value)), s2();
402 }, this.input.pipe(u3), this.rl = import_node_readline.default.createInterface({ input: this.input, output: u3, tabSize: 2, prompt: "", escapeCodeTimeout: 50 }), import_node_readline.default.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== void 0 && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), v3(this.input, true), this.output.on("resize", this.render), this.render(), new Promise((F5, e3) => {
403 this.once("submit", () => {
404 this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), v3(this.input, false), F5(this.value);
405 }), this.once("cancel", () => {
406 this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), v3(this.input, false), F5(V4);
407 });
408 });
409 }
410 on(u3, F5) {
411 const e3 = this.subscribers.get(u3) ?? [];
412 e3.push({ cb: F5 }), this.subscribers.set(u3, e3);

Calls 9

v3Function · 0.85
F5Function · 0.85
pipeMethod · 0.80
renderMethod · 0.80
emitMethod · 0.45
writeMethod · 0.45
onMethod · 0.45
onceMethod · 0.45
offMethod · 0.45

Tested by

no test coverage detected