import type { Command } from "commander"; import { setLocalWorkspace } from "../../../commands/config"; import { setDefaultWorkspace } from "../../../config"; import { strict } from "../../helpers"; export function registerAuthUse(parent: Command): void { strict(parent.command("use")) .description("Set default workspace profile") .argument("", "Workspace profile name") .option("--local", "Set local workspace instead of global default") .action(async (name: string, options: { local?: boolean }) => { if (options.local) { const result = await setLocalWorkspace(name); console.log( `Local workspace set to "${result.local.workspace}" in ${result.path}.`, ); return; } await setDefaultWorkspace(name); console.log(`Default workspace set to "${name}".`); }); }