mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
14 lines
363 B
TypeScript
14 lines
363 B
TypeScript
import { ICommand } from '../schema'
|
|
import { Matcher } from './Matcher.js'
|
|
|
|
export class CommandMatcher implements Matcher {
|
|
private matcher: RegExp
|
|
constructor(command: string, flags?: string) {
|
|
this.matcher = new RegExp(command, flags)
|
|
}
|
|
|
|
match(command: ICommand): boolean {
|
|
return !!command.command && this.matcher.test(command.command)
|
|
}
|
|
}
|