mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-25 23:39:32 +00:00
14 lines
464 B
TypeScript
14 lines
464 B
TypeScript
// Shared command-path matching helpers for CLI startup and registration policy.
|
|
|
|
/** Matches a command path prefix, or the full path when `exact` is requested. */
|
|
export function matchesCommandPath(
|
|
commandPath: string[],
|
|
pattern: readonly string[],
|
|
params?: { exact?: boolean },
|
|
): boolean {
|
|
if (pattern.some((segment, index) => commandPath[index] !== segment)) {
|
|
return false;
|
|
}
|
|
return !params?.exact || commandPath.length === pattern.length;
|
|
}
|