feat(cli): uninstall opencode installed via windows package managers (#8571)
This commit is contained in:
committed by
GitHub
parent
ee4ea65311
commit
0ccf9bd9ac
@@ -133,6 +133,8 @@ async function showRemovalSummary(targets: RemovalTargets, method: Installation.
|
|||||||
bun: "bun remove -g opencode-ai",
|
bun: "bun remove -g opencode-ai",
|
||||||
yarn: "yarn global remove opencode-ai",
|
yarn: "yarn global remove opencode-ai",
|
||||||
brew: "brew uninstall opencode",
|
brew: "brew uninstall opencode",
|
||||||
|
choco: "choco uninstall opencode",
|
||||||
|
scoop: "scoop uninstall opencode",
|
||||||
}
|
}
|
||||||
prompts.log.info(` ✓ Package: ${cmds[method] || method}`)
|
prompts.log.info(` ✓ Package: ${cmds[method] || method}`)
|
||||||
}
|
}
|
||||||
@@ -182,16 +184,27 @@ async function executeUninstall(method: Installation.Method, targets: RemovalTar
|
|||||||
bun: ["bun", "remove", "-g", "opencode-ai"],
|
bun: ["bun", "remove", "-g", "opencode-ai"],
|
||||||
yarn: ["yarn", "global", "remove", "opencode-ai"],
|
yarn: ["yarn", "global", "remove", "opencode-ai"],
|
||||||
brew: ["brew", "uninstall", "opencode"],
|
brew: ["brew", "uninstall", "opencode"],
|
||||||
|
choco: ["choco", "uninstall", "opencode"],
|
||||||
|
scoop: ["scoop", "uninstall", "opencode"],
|
||||||
}
|
}
|
||||||
|
|
||||||
const cmd = cmds[method]
|
const cmd = cmds[method]
|
||||||
if (cmd) {
|
if (cmd) {
|
||||||
spinner.start(`Running ${cmd.join(" ")}...`)
|
spinner.start(`Running ${cmd.join(" ")}...`)
|
||||||
const result = await $`${cmd}`.quiet().nothrow()
|
const result =
|
||||||
|
method === "choco"
|
||||||
|
? await $`echo Y | choco uninstall opencode -y -r`.quiet().nothrow()
|
||||||
|
: await $`${cmd}`.quiet().nothrow()
|
||||||
if (result.exitCode !== 0) {
|
if (result.exitCode !== 0) {
|
||||||
spinner.stop(`Package manager uninstall failed`, 1)
|
spinner.stop(`Package manager uninstall failed: exit code ${result.exitCode}`, 1)
|
||||||
prompts.log.warn(`You may need to run manually: ${cmd.join(" ")}`)
|
if (
|
||||||
errors.push(`Package manager: exit code ${result.exitCode}`)
|
method === "choco" &&
|
||||||
|
result.stdout.toString("utf8").includes("not running from an elevated command shell")
|
||||||
|
) {
|
||||||
|
prompts.log.warn(`You may need to run '${cmd.join(" ")}' from an elevated command shell`)
|
||||||
|
} else {
|
||||||
|
prompts.log.warn(`You may need to run manually: ${cmd.join(" ")}`)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
spinner.stop("Package removed")
|
spinner.stop("Package removed")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user