in src/manifestList.ts [186:252]
private async runCommand(
context: vscode.ExtensionContext,
command: WskDeployCommand,
withDeployment: boolean
): Promise<void> {
const authList = [
new DefaultAuthPick(),
...this.getSavedAuthList().map((auth) => new AuthPick(auth)),
];
let deploymentFile;
// select deployment yaml
if (withDeployment) {
const OPEN_FILE = 'Open file...';
const selected = await vscode.window.showQuickPick(
[...this._manifests.map((m) => m.uri.path), OPEN_FILE],
{
placeHolder: 'Select the wskdeploy deployment yaml file',
}
);
if (!selected) {
return;
}
if (selected === OPEN_FILE) {
const uri = await vscode.window.showOpenDialog({
canSelectFiles: true,
canSelectFolders: false,
canSelectMany: false,
filters: {
Manifest: ['yaml', 'yml'],
},
});
if (!uri || uri.length === 0) {
return;
}
deploymentFile = uri[0].path;
} else {
deploymentFile = selected;
}
}
// select target namespace and host
const selected = await vscode.window.showQuickPick<AuthPick>(authList, {
placeHolder: `Select the target API host to run ${command.label} command`,
});
if (!selected) {
return;
}
const projectName = await vscode.window.showInputBox({
placeHolder: 'Please enter project name (optional)',
});
// run command
switch (command.wskDeployCommand) {
case WskDeployCommands.DEPLOY:
this.runDeploy(command.manifest, selected.auth, deploymentFile, projectName);
break;
case WskDeployCommands.UNDEPLOY:
this.runUndeploy(command.manifest, selected.auth, deploymentFile, projectName);
break;
case WskDeployCommands.SYNC:
this.runSync(command.manifest, selected.auth, deploymentFile, projectName);
break;
}
}