MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / selectVersion

Function selectVersion

packages/core/fumadb/src/cli/index.ts:23–50  ·  view source on GitHub ↗
(defaultValue?: string)

Source from the content-addressed store, hash-verified

21 const db = options.db as FumaDB;
22
23 async function selectVersion(defaultValue?: string) {
24 const schemas = db.schemas;
25 const selected = await select({
26 message: "Select target schema version:",
27 options: schemas.map((s, i) => {
28 let hint: string | undefined;
29 if (s.version === defaultValue) {
30 hint = "current";
31 } else if (i === schemas.length - 1) {
32 hint = "latest";
33 }
34
35 return {
36 value: s.version,
37 label: s.version,
38 hint,
39 };
40 }),
41 initialValue: defaultValue,
42 });
43
44 if (isCancel(selected)) {
45 cancel("Migration cancelled.");
46 process.exit(0);
47 }
48
49 return selected;
50 }
51
52 async function inputOutputPath(type: "sql" | "orm", suggestion: string) {
53 const result = await text({

Callers 1

mainFunction · 0.85

Calls 1

cancelFunction · 0.50

Tested by

no test coverage detected