|
@@ -25,9 +25,12 @@ const cancel = new AbortController()
|
|
|
|
|
|
|
|
const cli = yargs(hideBin(process.argv))
|
|
const cli = yargs(hideBin(process.argv))
|
|
|
.scriptName("opencode")
|
|
.scriptName("opencode")
|
|
|
- .version(Installation.VERSION)
|
|
|
|
|
|
|
+ .help("help", "show help")
|
|
|
|
|
+ .alias("help", "h")
|
|
|
|
|
+ .version("version", "show version number", Installation.VERSION)
|
|
|
|
|
+ .alias("version", "v")
|
|
|
.option("print-logs", {
|
|
.option("print-logs", {
|
|
|
- describe: "Print logs to stderr",
|
|
|
|
|
|
|
+ describe: "print logs to stderr",
|
|
|
type: "boolean",
|
|
type: "boolean",
|
|
|
})
|
|
})
|
|
|
.middleware(async () => {
|
|
.middleware(async () => {
|
|
@@ -40,7 +43,7 @@ const cli = yargs(hideBin(process.argv))
|
|
|
.usage("\n" + UI.logo())
|
|
.usage("\n" + UI.logo())
|
|
|
.command({
|
|
.command({
|
|
|
command: "$0 [project]",
|
|
command: "$0 [project]",
|
|
|
- describe: "start opencode TUI",
|
|
|
|
|
|
|
+ describe: "start opencode tui",
|
|
|
builder: (yargs) =>
|
|
builder: (yargs) =>
|
|
|
yargs.positional("project", {
|
|
yargs.positional("project", {
|
|
|
type: "string",
|
|
type: "string",
|
|
@@ -89,21 +92,21 @@ const cli = yargs(hideBin(process.argv))
|
|
|
},
|
|
},
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- ;(async () => {
|
|
|
|
|
- if (Installation.VERSION === "dev") return
|
|
|
|
|
- if (Installation.isSnapshot()) return
|
|
|
|
|
- const config = await Config.global()
|
|
|
|
|
- if (config.autoupdate === false) return
|
|
|
|
|
- const latest = await Installation.latest()
|
|
|
|
|
- if (Installation.VERSION === latest) return
|
|
|
|
|
- const method = await Installation.method()
|
|
|
|
|
- if (method === "unknown") return
|
|
|
|
|
- await Installation.upgrade(method, latest)
|
|
|
|
|
- .then(() => {
|
|
|
|
|
- Bus.publish(Installation.Event.Updated, { version: latest })
|
|
|
|
|
- })
|
|
|
|
|
- .catch(() => {})
|
|
|
|
|
- })()
|
|
|
|
|
|
|
+ ; (async () => {
|
|
|
|
|
+ if (Installation.VERSION === "dev") return
|
|
|
|
|
+ if (Installation.isSnapshot()) return
|
|
|
|
|
+ const config = await Config.global()
|
|
|
|
|
+ if (config.autoupdate === false) return
|
|
|
|
|
+ const latest = await Installation.latest()
|
|
|
|
|
+ if (Installation.VERSION === latest) return
|
|
|
|
|
+ const method = await Installation.method()
|
|
|
|
|
+ if (method === "unknown") return
|
|
|
|
|
+ await Installation.upgrade(method, latest)
|
|
|
|
|
+ .then(() => {
|
|
|
|
|
+ Bus.publish(Installation.Event.Updated, { version: latest })
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(() => { })
|
|
|
|
|
+ })()
|
|
|
|
|
|
|
|
await proc.exited
|
|
await proc.exited
|
|
|
server.stop()
|
|
server.stop()
|