vscode-docker/commands/push-image.ts

32 строки
1.0 KiB
TypeScript
Исходник Обычный вид История

2016-09-16 00:49:32 +03:00
import vscode = require('vscode');
2017-03-02 04:49:54 +03:00
import { ImageItem, quickPickImage } from './utils/quick-pick-image';
import { reporter } from '../telemetry/telemetry';
import { DockerNode } from '../explorer/dockerExplorer';
2017-03-04 04:13:14 +03:00
const teleCmdId: string = 'vscode-docker.image.push';
2016-09-16 00:49:32 +03:00
export async function pushImage(context?: DockerNode) {
let imageToPush: Docker.ImageDesc;
let imageName: string = "";
2017-06-06 03:55:05 +03:00
if (context && context.imageDesc) {
imageToPush = context.imageDesc;
imageName = context.label;
} else {
const selectedItem: ImageItem = await quickPickImage();
if (selectedItem) {
imageToPush = selectedItem.imageDesc;
imageName = selectedItem.label;
}
}
if (imageToPush) {
const terminal = vscode.window.createTerminal(imageName);
terminal.sendText(`docker push ${imageName}`);
2017-06-06 03:55:05 +03:00
terminal.show();
if (reporter) {
reporter.sendTelemetryEvent('command', {
command: teleCmdId
});
}
};
2016-09-20 19:47:56 +03:00
}