Преглед изворни кода

Update index.ts

🤖 Generated with [OpenCode](https://opencode.ai)

Co-Authored-By: OpenCode <[email protected]>
Dax Raad пре 8 месеци
родитељ
комит
d4d218d7d6
1 измењених фајлова са 9 додато и 2 уклоњено
  1. 9 2
      packages/opencode/src/index.ts

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

@@ -35,12 +35,19 @@ const cli = yargs(hideBin(process.argv))
   })
   .usage("\n" + UI.logo())
   .command({
-    command: "$0",
+    command: "$0 <project>",
     describe: "Start OpenCode TUI",
+    builder: (yargs) =>
+      yargs.positional("project", {
+        type: "string",
+        describe: "path to start opencode in",
+      }),
     handler: async (args) => {
       while (true) {
+        const cwd = args.project ? path.resolve(args.project) : process.cwd()
+        process.chdir(cwd)
         const result = await App.provide(
-          { cwd: process.cwd(), version: VERSION },
+          { cwd, version: VERSION },
           async () => {
             const providers = await Provider.list()
             if (Object.keys(providers).length === 0) {