From 9bfbcc601a06a2ef6b6c02169c7ddf9d826b5d93 Mon Sep 17 00:00:00 2001 From: ndycode Date: Sat, 21 Mar 2026 04:39:09 +0800 Subject: [PATCH] refactor: route switch through command module --- lib/codex-manager.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/codex-manager.ts b/lib/codex-manager.ts index 26d0ccbe..07fccee6 100644 --- a/lib/codex-manager.ts +++ b/lib/codex-manager.ts @@ -4382,7 +4382,11 @@ async function handleManageAction( ): Promise { if (typeof menuResult.switchAccountIndex === "number") { const index = menuResult.switchAccountIndex; - await runSwitch([String(index + 1)]); + await runSwitchCommand([String(index + 1)], { + setStoragePath, + loadAccounts, + persistAndSyncSelectedAccount, + }); return; } @@ -4796,14 +4800,6 @@ async function runAuthLogin(args: string[]): Promise { } } -async function runSwitch(args: string[]): Promise { - return runSwitchCommand(args, { - setStoragePath, - loadAccounts, - persistAndSyncSelectedAccount, - }); -} - async function persistAndSyncSelectedAccount({ storage, targetIndex, @@ -5287,7 +5283,11 @@ export async function runCodexMultiAuthCli(rawArgs: string[]): Promise { }); } if (command === "switch") { - return runSwitch(rest); + return runSwitchCommand(rest, { + setStoragePath, + loadAccounts, + persistAndSyncSelectedAccount, + }); } if (command === "check") { return runCheckCommand({ runHealthCheck });