overlord-cli 3.18.0 → 3.20.0
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.
- package/bin/_cli/index.mjs +2 -1
- package/bin/_cli/new-ticket.mjs +15 -2
- package/package.json +1 -2
package/bin/_cli/index.mjs
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import { runAttachCommand } from './attach.mjs';
|
|
4
4
|
import { runAuthCommand } from './auth.mjs';
|
|
5
5
|
import { runLauncherCommand } from './launcher.mjs';
|
|
6
|
-
import { runCreateCommand, runPromptCommand } from './new-ticket.mjs';
|
|
7
6
|
import { runProtocolCommand } from './protocol.mjs';
|
|
8
7
|
import { runDoctorCommand, runSetupCommand } from './setup.mjs';
|
|
9
8
|
import { runTicketCommand } from './ticket.mjs';
|
|
@@ -67,11 +66,13 @@ export async function runCli({ primaryCommand }) {
|
|
|
67
66
|
}
|
|
68
67
|
|
|
69
68
|
if (command === 'create') {
|
|
69
|
+
const { runCreateCommand } = await import('./new-ticket.mjs');
|
|
70
70
|
await runCreateCommand(rest);
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
if (command === 'prompt') {
|
|
75
|
+
const { runPromptCommand } = await import('./new-ticket.mjs');
|
|
75
76
|
await runPromptCommand(rest);
|
|
76
77
|
return;
|
|
77
78
|
}
|
package/bin/_cli/new-ticket.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import readline from 'node:readline
|
|
3
|
+
import readline from 'node:readline';
|
|
4
4
|
import { stdin as input, stdout as output } from 'node:process';
|
|
5
5
|
|
|
6
6
|
import { buildAuthHeaders, resolveAuth } from './credentials.mjs';
|
|
@@ -90,6 +90,19 @@ async function promptForSelection({ items, label, prompt, renderItem }) {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
const rl = readline.createInterface({ input, output });
|
|
93
|
+
const question = promptText =>
|
|
94
|
+
new Promise((resolve, reject) => {
|
|
95
|
+
const handleError = error => {
|
|
96
|
+
rl.off('error', handleError);
|
|
97
|
+
reject(error);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
rl.once('error', handleError);
|
|
101
|
+
rl.question(promptText, answer => {
|
|
102
|
+
rl.off('error', handleError);
|
|
103
|
+
resolve(answer);
|
|
104
|
+
});
|
|
105
|
+
});
|
|
93
106
|
|
|
94
107
|
try {
|
|
95
108
|
while (true) {
|
|
@@ -98,7 +111,7 @@ async function promptForSelection({ items, label, prompt, renderItem }) {
|
|
|
98
111
|
output.write(` ${index + 1}. ${renderItem(item, index)}\n`);
|
|
99
112
|
});
|
|
100
113
|
|
|
101
|
-
const answer = await
|
|
114
|
+
const answer = await question(`\n${prompt} `);
|
|
102
115
|
const selectedIndex = parseNumberedSelection(answer, items.length);
|
|
103
116
|
if (selectedIndex !== null) {
|
|
104
117
|
return items[selectedIndex];
|