public async execute()

in src/dal/tfs/GetTfsWorkFoldInfo.ts [14:42]


    public async execute(): Promise<ITfsWorkFoldInfo | undefined> {
        const parseWorkFoldRegexp = /Collection: (.*?)\r?\n\s(.*?):\s(.*)/;

        try {
            const result: {stdout: string} = await this.cpProxy.execAsync(this.getCommand());
            const tfsWorkFoldResult: string = result.stdout.toString().trim();
            const match = parseWorkFoldRegexp.exec(tfsWorkFoldResult);
            const repositoryUrl: string = match[1];
            const purl: url.Url = url.parse(repositoryUrl);
            if (purl) {
                const collectionName = purl.host.split(".")[0];
                const tfsInfo: ITfsWorkFoldInfo = {
                    repositoryUrl: repositoryUrl,
                    collectionName: collectionName,
                    projectRemotePath: match[2],
                    projectLocalPath: match[3]
                };
                Logger.LogObject(tfsInfo);
                return tfsInfo;
            } else {
                Logger.logError(`GetTfsWorkFoldInfoo: TfsInfo cannot be parsed.`);
                return undefined;
            }
        } catch (err) {
            Logger.logError("GetTfsWorkFoldInfo: caught an exception during tf workfold command:" +
                Utils.formatErrorMessage(err));
            return undefined;
        }
    }