當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript task.command函數代碼示例

本文整理匯總了TypeScript中azure-pipelines-task-lib/task.command函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript command函數的具體用法?TypeScript command怎麽用?TypeScript command使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了command函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: _extractAdvinst

async function _extractAdvinst(sourceMsi: string): Promise<string> {
  console.log(taskLib.loc("AI_ExtractTool"));

  // Ensure the c:\windows\installer folder exists. MSIEXEC will fail on some clients (E.g. Hosted VS2017)
  // due to the lack of this folder.

  let windowsInstallerFolder = path.join(taskLib.getVariable('windir'), 'Installer');
  if (!taskLib.exist(windowsInstallerFolder)) {
    taskLib.debug(taskLib.loc("AI_CreateInstallerFolder"))
    taskLib.mkdirP(windowsInstallerFolder);
  }

  let advinstWorkFolder = path.join(_getAgentTemp(), 'AdvancedInstaller');
  let msiExtractionPath: string = path.join(advinstWorkFolder, 'resources');
  // Create the work folder, otherwise msiexec will fail because of the log path.
  if (!taskLib.exist(advinstWorkFolder))
    taskLib.mkdirP(advinstWorkFolder);
  let msiLogPath: string = path.join(advinstWorkFolder, 'advinst_install.log');

  let msiexecArguments: string[] = ['/a', sourceMsi, 'TARGETDIR=' + msiExtractionPath, '/qn', '/l*v', msiLogPath];

  let exitCode = taskLib.execSync('msiexec.exe', msiexecArguments).code;
  if (exitCode != 0) {
    taskLib.command('task.uploadfile', {}, msiLogPath);
    return null;
  }
  return msiExtractionPath;
}
開發者ID:Caphyon,項目名稱:advinst-vsts-task,代碼行數:28,代碼來源:AdvinstTool.ts

示例2: applyManipulations

            break;
    }

    if (pointInTime === "afterManipulation") {
        tl.debug("Applying selected manipulations.");
        value = applyManipulations(value);
    }
} else {
    tl.debug("Applying selected manipulations.");
    value = applyManipulations(value);
}

const variable = tl.getInput("variableName", true);

if (variable.search(/^Build[._]BuildNumber$/i) >= 0) {
    tl.command("build.updatebuildnumber", null, value);
    console.log(`Set buildnumber to: ${value}`);
    tl.setResult(tl.TaskResult.Succeeded, `Set buildnumber to: ${value}`);
} else {
    tl.setVariable(variable, value, isSecret);
    console.log(`Set ${variable} to: ${value}`);
    tl.setResult(tl.TaskResult.Succeeded, `Set ${variable} to: ${value}`);
}

function applyManipulations(value: string): string {
    if (tl.getBoolInput("searchReplace", false)) {
        tl.debug("Applying selected Search & Replace.");
        value = searchAndReplace(value);
    }

    if (tl.getBoolInput("trim", false)) {
開發者ID:jessehouwing,項目名稱:vsts-variable-tasks,代碼行數:31,代碼來源:vsts-variable-transform.ts

示例3: publishTelemetry

export function publishTelemetry(area: string, feature: string, properties: { [key: string]: any }): void {
    const data = JSON.stringify(properties);
    tl.debug('telemetry area: ' + area + ' feature: ' + feature + ' data: ' + data);
    tl.command('telemetry.publish', { 'area': area, 'feature': feature }, data);
}
開發者ID:Microsoft,項目名稱:vsts-tasks,代碼行數:5,代碼來源:cieventlogger.ts


注:本文中的azure-pipelines-task-lib/task.command函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。