mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 19:00:22 +00:00
CLI route: support argv-aware plugin preloading
This commit is contained in:
@@ -10,11 +10,13 @@ import { findRoutedCommand } from "./program/routes.js";
|
|||||||
async function prepareRoutedCommand(params: {
|
async function prepareRoutedCommand(params: {
|
||||||
argv: string[];
|
argv: string[];
|
||||||
commandPath: string[];
|
commandPath: string[];
|
||||||
loadPlugins?: boolean;
|
loadPlugins?: boolean | ((argv: string[]) => boolean);
|
||||||
}) {
|
}) {
|
||||||
emitCliBanner(VERSION, { argv: params.argv });
|
emitCliBanner(VERSION, { argv: params.argv });
|
||||||
await ensureConfigReady({ runtime: defaultRuntime, commandPath: params.commandPath });
|
await ensureConfigReady({ runtime: defaultRuntime, commandPath: params.commandPath });
|
||||||
if (params.loadPlugins) {
|
const shouldLoadPlugins =
|
||||||
|
typeof params.loadPlugins === "function" ? params.loadPlugins(params.argv) : params.loadPlugins;
|
||||||
|
if (shouldLoadPlugins) {
|
||||||
ensurePluginRegistryLoaded();
|
ensurePluginRegistryLoaded();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user