@lsst/pik-plugin-worktree 0.5.1 → 0.5.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.
- package/dist/index.js +37 -3
- package/dist/lib/plugin.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { select, input, confirm } from "@inquirer/prompts";
|
|
1
|
+
import { select, input, confirm, Separator } from "@inquirer/prompts";
|
|
3
2
|
import pc from "picocolors";
|
|
3
|
+
import { Command } from "commander";
|
|
4
4
|
import { basename, resolve, relative } from "path";
|
|
5
5
|
import { execSync } from "child_process";
|
|
6
6
|
import { existsSync, mkdirSync, copyFileSync } from "fs";
|
|
@@ -336,6 +336,7 @@ const removeCommand = new Command("remove").alias("rm").description("Remove a wo
|
|
|
336
336
|
process.exit(1);
|
|
337
337
|
}
|
|
338
338
|
});
|
|
339
|
+
const BACK_VALUE = /* @__PURE__ */ Symbol("back");
|
|
339
340
|
const worktreePlugin = {
|
|
340
341
|
name: "Worktree",
|
|
341
342
|
description: "Manage git worktrees",
|
|
@@ -347,7 +348,40 @@ const worktreePlugin = {
|
|
|
347
348
|
worktreeCmd.addCommand(listCommand);
|
|
348
349
|
worktreeCmd.addCommand(removeCommand);
|
|
349
350
|
worktreeCmd.action(async () => {
|
|
350
|
-
|
|
351
|
+
while (true) {
|
|
352
|
+
let action;
|
|
353
|
+
try {
|
|
354
|
+
action = await select({
|
|
355
|
+
message: "Worktree actions",
|
|
356
|
+
choices: [
|
|
357
|
+
{ name: "Create worktree", value: "create" },
|
|
358
|
+
{ name: "List worktrees", value: "list" },
|
|
359
|
+
{ name: "Remove worktree", value: "remove" },
|
|
360
|
+
new Separator(),
|
|
361
|
+
{ name: pc.dim("← Back"), value: BACK_VALUE }
|
|
362
|
+
]
|
|
363
|
+
});
|
|
364
|
+
} catch (error) {
|
|
365
|
+
if (error instanceof Error && error.name === "ExitPromptError") {
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
throw error;
|
|
369
|
+
}
|
|
370
|
+
if (action === BACK_VALUE) {
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
switch (action) {
|
|
374
|
+
case "create":
|
|
375
|
+
await createCommand.parseAsync([], { from: "user" });
|
|
376
|
+
break;
|
|
377
|
+
case "list":
|
|
378
|
+
await listCommand.parseAsync([], { from: "user" });
|
|
379
|
+
break;
|
|
380
|
+
case "remove":
|
|
381
|
+
await removeCommand.parseAsync([], { from: "user" });
|
|
382
|
+
break;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
351
385
|
});
|
|
352
386
|
}
|
|
353
387
|
};
|
package/dist/lib/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/lib/plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/lib/plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAShD,eAAO,MAAM,cAAc,EAAE,SA2D5B,CAAC"}
|