import { CpProxy } from "../moduleproxies/cp-proxy" ; import { inject , injectable } from "inversify" ; import { TYPES } from "../utils/constants" ; @ injectable ( ) export class TfvcIsActiveValidator { constructor ( @ inject ( TYPES . CpProxy ) private readonly cpProxy ) { } public async validate ( workspaceRootPath , tfPath ) { return this . checkIsTfsRepository ( workspaceRootPath , tfPath ) ; } private async checkIsTfsRepository ( workspaceRootPath , tfPath ) { const briefDiffCommand = `"${ tfPath }" diff /noprompt /format:brief /recursive "${ workspaceRootPath }"` ; try { await this . cpProxy . execAsync ( briefDiffCommand ) ; } catch ( err ) { throw new Error ( "Tfs repository was not determined" ) ; } } }