Bläddra i källkod

feat(cli): add console account subcommands (#17265)

Kit Langton 5 månader sedan
förälder
incheckning
d9dd33aeeb
2 ändrade filer med 27 tillägg och 5 borttagningar
  1. 25 0
      packages/opencode/src/cli/cmd/account.ts
  2. 2 5
      packages/opencode/src/index.ts

+ 25 - 0
packages/opencode/src/cli/cmd/account.ts

@@ -192,3 +192,28 @@ export const OrgsCommand = cmd({
     await runtime.runPromise(orgsEffect())
   },
 })
+
+export const ConsoleCommand = cmd({
+  command: "console",
+  describe: "manage console account",
+  builder: (yargs) =>
+    yargs
+      .command({
+        ...LoginCommand,
+        describe: "log in to console",
+      })
+      .command({
+        ...LogoutCommand,
+        describe: "log out from console",
+      })
+      .command({
+        ...SwitchCommand,
+        describe: "switch active org",
+      })
+      .command({
+        ...OrgsCommand,
+        describe: "list orgs",
+      })
+      .demandCommand(),
+  async handler() {},
+})

+ 2 - 5
packages/opencode/src/index.ts

@@ -3,7 +3,7 @@ import { hideBin } from "yargs/helpers"
 import { RunCommand } from "./cli/cmd/run"
 import { GenerateCommand } from "./cli/cmd/generate"
 import { Log } from "./util/log"
-import { LoginCommand, LogoutCommand, SwitchCommand, OrgsCommand } from "./cli/cmd/account"
+import { ConsoleCommand } from "./cli/cmd/account"
 import { ProvidersCommand } from "./cli/cmd/providers"
 import { AgentCommand } from "./cli/cmd/agent"
 import { UpgradeCommand } from "./cli/cmd/upgrade"
@@ -135,10 +135,7 @@ let cli = yargs(hideBin(process.argv))
   .command(RunCommand)
   .command(GenerateCommand)
   .command(DebugCommand)
-  .command(LoginCommand)
-  .command(LogoutCommand)
-  .command(SwitchCommand)
-  .command(OrgsCommand)
+  .command(ConsoleCommand)
   .command(ProvidersCommand)
   .command(AgentCommand)
   .command(UpgradeCommand)