mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-05 19:20:12 +08:00
14 lines
365 B
TypeScript
14 lines
365 B
TypeScript
import { ICommand } from '../schema'
|
|
import { Matcher } from './Matcher.js'
|
|
|
|
export class OutputMatcher implements Matcher {
|
|
private matcher: RegExp
|
|
constructor(pattern: string, args?: string) {
|
|
this.matcher = new RegExp(pattern, args)
|
|
}
|
|
|
|
match(command: ICommand): boolean {
|
|
return !!command.output && this.matcher.test(command.output.trim())
|
|
}
|
|
}
|