mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 19:50:43 +00:00
16 lines
408 B
TypeScript
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;
|
|
}
|