2093 extensibility add twenty auth switch command (#17286)

add auth:switch and auth:list commands
This commit is contained in:
martmull
2026-01-20 16:12:59 +01:00
committed by GitHub
parent e599d6c4d0
commit 579c59bd11
9 changed files with 264 additions and 958 deletions
+10 -4
View File
@@ -17,15 +17,21 @@ program
program.option(
'--workspace <name>',
'Use a specific workspace configuration',
'default',
'Use a specific workspace configuration (overrides the default set by auth:switch)',
);
program.hook('preAction', (thisCommand) => {
program.hook('preAction', async (thisCommand) => {
const opts = (thisCommand as any).optsWithGlobals
? (thisCommand as any).optsWithGlobals()
: thisCommand.opts();
const workspace = opts.workspace;
// If --workspace is provided, use it; otherwise, read the persisted default
let workspace = opts.workspace;
if (!workspace) {
const configService = new ConfigService();
workspace = await configService.getDefaultWorkspace();
}
ConfigService.setActiveWorkspace(workspace);
console.log(
chalk.gray(`👩‍💻 Workspace - ${ConfigService.getActiveWorkspace()}`),