Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set activate workspace in .wmill/activeWorkspace in workspace directory #5085

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions cli/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,13 @@ async function getActiveWorkspaceName(
return opts?.workspace;
}
try {
return await Deno.readTextFile((await getRootStore()) + "/activeWorkspace");
return (await Deno.readTextFile(".wmill/activeWorkspace")).trim();
} catch {
return undefined;
try {
return await Deno.readTextFile((await getRootStore()) + "/activeWorkspace");
} catch {
return undefined;
}
}
}

Expand Down Expand Up @@ -120,6 +124,14 @@ async function switchC(opts: GlobalOptions, workspaceName: string) {
}

export async function setActiveWorkspace(workspaceName: string) {
try {
if (Deno.statSync('.wmill').isDirectory) {
await Deno.writeTextFile(".wmill/activeWorkspace", workspaceName);
return;
}
} catch {
log.info("No .wmill folder found, set active workspace global");
}
await Deno.writeTextFile(
(await getRootStore()) + "/activeWorkspace",
workspaceName
Expand Down
Loading