4b092ccd8889b315222e4f90338d0ed586e3ec95

Author
TheEdgeOfRage <git@theedgeofrage.com>
Committer
TheEdgeOfRage <git@theedgeofrage.com>
Date

Message

Use directory as default workspace name in herdr new workspace script

Diff

 1diff --git a/dot_local/bin/executable_herdr-new-pi-workspace b/dot_local/bin/executable_herdr-new-pi-workspace
 2index c9fd42b1dcc17ad20c59cf6f5a0ccf503afd3c8e..9247992ff20342e3ceb027e6f97ea540706aab5f 100644
 3--- a/dot_local/bin/executable_herdr-new-pi-workspace
 4+++ b/dot_local/bin/executable_herdr-new-pi-workspace
 5@@ -176,11 +176,12 @@ function textPrompt() {
 6   return prompt;
 7 }
 8 
 9-async function chooseWorkspaceName() {
10+async function chooseWorkspaceName(directory) {
11+  const defaultName = path.basename(directory);
12   const workspaceName = (
13-    await textPrompt().question("Workspace name: ")
14+    await textPrompt().question(`Workspace name [${defaultName}]: `)
15   ).trim();
16-  return workspaceName || null;
17+  return workspaceName || defaultName;
18 }
19 
20 function parseWorkspaceCreated(output) {
21@@ -257,7 +258,7 @@ async function main() {
22       return;
23     }
24 
25-    const workspaceName = await chooseWorkspaceName();
26+    const workspaceName = await chooseWorkspaceName(directory);
27     if (!workspaceName) {
28       console.log("Cancelled.");
29       return;