bmweb-cli 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/bmweb.js +17 -3
  2. package/package.json +1 -1
package/dist/bmweb.js CHANGED
@@ -1867,6 +1867,7 @@ function terminalHomeHost(api, status) {
1867
1867
  var SHIFTED_DIGITS = "!@#$%^&*()";
1868
1868
  var DIGITS = "1234567890";
1869
1869
  var GAUGE_WIDTH = 12;
1870
+ var QUIT_MS = 4e3;
1870
1871
  function keyToPress(k) {
1871
1872
  if (k.ctrl && k.name === "c") return "quit";
1872
1873
  if (k.name === "escape") return "back";
@@ -1941,6 +1942,7 @@ function nodeTerminal() {
1941
1942
  });
1942
1943
  } finally {
1943
1944
  rl.close();
1945
+ input.resume();
1944
1946
  raw(true);
1945
1947
  paused = false;
1946
1948
  }
@@ -2576,16 +2578,27 @@ async function tuiCommand(chassis, sgbd, opts = {}) {
2576
2578
  if (opts.menu !== p.menu) await p.openMenu(opts.menu);
2577
2579
  }
2578
2580
  const program = p;
2581
+ let leaving = false;
2579
2582
  const unsubscribe = term.onKey((k) => {
2580
2583
  if (ui.modal) return;
2581
2584
  const what = keyToPress(k);
2582
2585
  if (what === null) return;
2583
2586
  if (what === "quit") {
2584
- unsubscribe();
2585
- program.leaveModule().catch(() => {
2587
+ if (leaving) {
2588
+ if (k.ctrl && !opts.term) {
2589
+ term.close();
2590
+ process.exit(130);
2591
+ }
2592
+ return;
2593
+ }
2594
+ leaving = true;
2595
+ const done = program.leaveModule().catch(() => {
2586
2596
  });
2597
+ const late = new Promise((r2) => setTimeout(r2, QUIT_MS));
2598
+ Promise.race([done, late]).then(() => ui.left());
2587
2599
  return;
2588
2600
  }
2601
+ if (leaving) return;
2589
2602
  if (what === "back") {
2590
2603
  ui.requestStop();
2591
2604
  program.back().catch(() => {
@@ -2607,7 +2620,7 @@ async function tuiCommand(chassis, sgbd, opts = {}) {
2607
2620
  }
2608
2621
 
2609
2622
  // src/bmweb.ts
2610
- var VERSION = true ? "0.1.2" : "0.0.0-dev";
2623
+ var VERSION = true ? "0.1.3" : "0.0.0-dev";
2611
2624
  var INCLUDE = {
2612
2625
  include: {
2613
2626
  kind: "list",
@@ -2940,6 +2953,7 @@ async function main(argv, out = (l) => process.stdout.write(l + "\n"), err = (l)
2940
2953
  if (typeof process !== "undefined" && process.argv[1] && /bmweb(\.js)?$/.test(process.argv[1])) {
2941
2954
  main(process.argv.slice(2)).then((code) => {
2942
2955
  process.exitCode = code;
2956
+ process.stdout.write("", () => process.exit(code));
2943
2957
  });
2944
2958
  }
2945
2959
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bmweb-cli",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "BMWeb's tools as a command line: read INPA .IPO scripts, compile .IPS sources, search the corpus job index, decode and diff shared Garage reports, and, over a K+DCAN cable, run jobs, whole-car scans and INPA screens in the terminal.",
5
5
  "license": "GPL-3.0-only",
6
6
  "type": "module",