tui plugins (#19347)
This commit is contained in:
@@ -33,16 +33,18 @@ import path from "path"
|
||||
import { Global } from "./global"
|
||||
import { JsonMigration } from "./storage/json-migration"
|
||||
import { Database } from "./storage/db"
|
||||
import { errorMessage } from "./util/error"
|
||||
import { PluginCommand } from "./cli/cmd/plug"
|
||||
|
||||
process.on("unhandledRejection", (e) => {
|
||||
Log.Default.error("rejection", {
|
||||
e: e instanceof Error ? e.message : e,
|
||||
e: errorMessage(e),
|
||||
})
|
||||
})
|
||||
|
||||
process.on("uncaughtException", (e) => {
|
||||
Log.Default.error("exception", {
|
||||
e: e instanceof Error ? e.message : e,
|
||||
e: errorMessage(e),
|
||||
})
|
||||
})
|
||||
|
||||
@@ -63,7 +65,15 @@ const cli = yargs(hideBin(process.argv))
|
||||
type: "string",
|
||||
choices: ["DEBUG", "INFO", "WARN", "ERROR"],
|
||||
})
|
||||
.option("pure", {
|
||||
describe: "run without external plugins",
|
||||
type: "boolean",
|
||||
})
|
||||
.middleware(async (opts) => {
|
||||
if (opts.pure) {
|
||||
process.env.OPENCODE_PURE = "1"
|
||||
}
|
||||
|
||||
await Log.init({
|
||||
print: process.argv.includes("--print-logs"),
|
||||
dev: Installation.isLocal(),
|
||||
@@ -143,6 +153,7 @@ const cli = yargs(hideBin(process.argv))
|
||||
.command(GithubCommand)
|
||||
.command(PrCommand)
|
||||
.command(SessionCommand)
|
||||
.command(PluginCommand)
|
||||
.command(DbCommand)
|
||||
.fail((msg, err) => {
|
||||
if (
|
||||
@@ -194,7 +205,7 @@ try {
|
||||
if (formatted) UI.error(formatted)
|
||||
if (formatted === undefined) {
|
||||
UI.error("Unexpected error, check log file at " + Log.file() + " for more details" + EOL)
|
||||
process.stderr.write((e instanceof Error ? e.message : String(e)) + EOL)
|
||||
process.stderr.write(errorMessage(e) + EOL)
|
||||
}
|
||||
process.exitCode = 1
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user