Files
openclaw/src/cli/program/routes.ts
2026-04-27 12:13:51 +01:00

16 lines
408 B
TypeScript

import { routedCommands, type RouteSpec } from "./route-specs.js";
export type { RouteSpec } from "./route-specs.js";
export function findRoutedCommand(path: string[], argv?: string[]): RouteSpec | null {
for (const route of routedCommands) {
if (route.matches(path)) {
if (argv && route.canRun && !route.canRun(argv)) {
continue;
}
return route;
}
}
return null;
}