Most tasks offer a multi-line textbox (optionally resizable), you can set this in the task.json
:
{
"name": "patternManifest",
"type": "multiLine",
"properties": {
"resizable": true,
"rows": "1"
},
"label": "Manifest file(s)",
"defaultValue": "vss-extension.json",
"required": false,
"helpMarkDown": "Specify the pattern for manifest files. One file per line."
},
Then in the task itself you use the tl.getDelimitedInput()
and pass in the delimiters you want to support, in this task I require them to use newlines
:
const globsManifest = tl.getDelimitedInput("patternManifest", "
", false);
The tasklibrary has support for wildcard matching as well, that way people can add *
, **
and ?
to their inputs and the task will resolve these to actual files, then use the tl.findMatch()
option.
if (vsixFilePattern.indexOf("*") >= 0 || vsixFilePattern.indexOf("?") >= 0) {
tl.debug("Pattern found in vsixFile parameter.");
matchingVsixFile = tl.findMatch(process.cwd(), vsixFilePattern);
}
else {
tl.debug("No pattern found in vsixFile parameter.");
matchingVsixFile = [vsixFilePattern];
}
The paths are relative by default and use the task's workingdirectory. When none is specified the working directory depends on the context of the task (build vs deploy pipeline):
"execution": {
"PowerShell3": {
"target": "$(currentDirectory)\TfvcCheckin.v3.ps1",
"workingDirectory": "$(Build.SourcesDirectory)"
}
}
The user can always enter an absolute path instead of a relative one. And they can always add variables like $(Build.SourcesDirectory)ac
to root the path to a predefined location.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…