本文整理汇总了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;
}
示例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)) {
示例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);
}