spindb 0.8.1 → 0.8.2
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.
|
@@ -592,6 +592,7 @@ export async function handleBackup(): Promise<void> {
|
|
|
592
592
|
const containerName = await promptContainerSelect(
|
|
593
593
|
running,
|
|
594
594
|
'Select container to backup:',
|
|
595
|
+
{ includeBack: true },
|
|
595
596
|
)
|
|
596
597
|
if (!containerName) return
|
|
597
598
|
|
|
@@ -715,6 +716,7 @@ export async function handleClone(): Promise<void> {
|
|
|
715
716
|
const sourceName = await promptContainerSelect(
|
|
716
717
|
stopped,
|
|
717
718
|
'Select container to clone:',
|
|
719
|
+
{ includeBack: true },
|
|
718
720
|
)
|
|
719
721
|
if (!sourceName) return
|
|
720
722
|
|
|
@@ -474,6 +474,7 @@ export async function handleStart(): Promise<void> {
|
|
|
474
474
|
const containerName = await promptContainerSelect(
|
|
475
475
|
stopped,
|
|
476
476
|
'Select container to start:',
|
|
477
|
+
{ includeBack: true },
|
|
477
478
|
)
|
|
478
479
|
if (!containerName) return
|
|
479
480
|
|
|
@@ -521,6 +522,7 @@ export async function handleStop(): Promise<void> {
|
|
|
521
522
|
const containerName = await promptContainerSelect(
|
|
522
523
|
running,
|
|
523
524
|
'Select container to stop:',
|
|
525
|
+
{ includeBack: true },
|
|
524
526
|
)
|
|
525
527
|
if (!containerName) return
|
|
526
528
|
|
package/cli/ui/prompts.ts
CHANGED
|
@@ -204,32 +204,48 @@ export async function promptConfirm(
|
|
|
204
204
|
|
|
205
205
|
/**
|
|
206
206
|
* Prompt for container selection from a list
|
|
207
|
+
* @param containers - List of containers to choose from
|
|
208
|
+
* @param message - Prompt message
|
|
209
|
+
* @param options - Optional settings
|
|
210
|
+
* @param options.includeBack - Include a back option (returns null when selected)
|
|
207
211
|
*/
|
|
208
212
|
export async function promptContainerSelect(
|
|
209
213
|
containers: ContainerConfig[],
|
|
210
214
|
message: string = 'Select container:',
|
|
215
|
+
options: { includeBack?: boolean } = {},
|
|
211
216
|
): Promise<string | null> {
|
|
212
217
|
if (containers.length === 0) {
|
|
213
218
|
return null
|
|
214
219
|
}
|
|
215
220
|
|
|
221
|
+
type Choice = { name: string; value: string; short?: string }
|
|
222
|
+
const choices: Choice[] = containers.map((c) => ({
|
|
223
|
+
name: `${c.name} ${chalk.gray(`(${getEngineIcon(c.engine)} ${c.engine} ${c.version}, port ${c.port})`)} ${
|
|
224
|
+
c.status === 'running'
|
|
225
|
+
? chalk.green('● running')
|
|
226
|
+
: chalk.gray('○ stopped')
|
|
227
|
+
}`,
|
|
228
|
+
value: c.name,
|
|
229
|
+
short: c.name,
|
|
230
|
+
}))
|
|
231
|
+
|
|
232
|
+
if (options.includeBack) {
|
|
233
|
+
choices.push({ name: `${chalk.blue('←')} Back`, value: '__back__' })
|
|
234
|
+
}
|
|
235
|
+
|
|
216
236
|
const { container } = await inquirer.prompt<{ container: string }>([
|
|
217
237
|
{
|
|
218
238
|
type: 'list',
|
|
219
239
|
name: 'container',
|
|
220
240
|
message,
|
|
221
|
-
choices
|
|
222
|
-
name: `${c.name} ${chalk.gray(`(${getEngineIcon(c.engine)} ${c.engine} ${c.version}, port ${c.port})`)} ${
|
|
223
|
-
c.status === 'running'
|
|
224
|
-
? chalk.green('● running')
|
|
225
|
-
: chalk.gray('○ stopped')
|
|
226
|
-
}`,
|
|
227
|
-
value: c.name,
|
|
228
|
-
short: c.name,
|
|
229
|
-
})),
|
|
241
|
+
choices,
|
|
230
242
|
},
|
|
231
243
|
])
|
|
232
244
|
|
|
245
|
+
if (container === '__back__') {
|
|
246
|
+
return null
|
|
247
|
+
}
|
|
248
|
+
|
|
233
249
|
return container
|
|
234
250
|
}
|
|
235
251
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spindb",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"description": "Spin up local database containers without Docker. A DBngin-like CLI for PostgreSQL and MySQL.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -32,7 +32,8 @@
|
|
|
32
32
|
"license": "PolyForm-Noncommercial-1.0.0",
|
|
33
33
|
"packageManager": "pnpm@9.14.2",
|
|
34
34
|
"engines": {
|
|
35
|
-
"node": ">=18"
|
|
35
|
+
"node": ">=18",
|
|
36
|
+
"pnpm": ">=8"
|
|
36
37
|
},
|
|
37
38
|
"repository": {
|
|
38
39
|
"type": "git",
|