提交 35eb38af 编写于 作者: J Joao Moreno

🐛 cant use stdin in windows cli

fixes #18826
上级 8b24b77b
......@@ -122,7 +122,7 @@ class Main {
console.log(localize('foundExtension', "Found '{0}' in the marketplace.", id));
console.log(localize('installing', "Installing..."));
return this.extensionManagementService.installFromGallery(extension)
return this.extensionManagementService.installFromGallery(extension, false)
.then(() => console.log(localize('successInstall', "Extension '{0}' v{1} was successfully installed!", id, extension.version)));
});
});
......@@ -142,7 +142,7 @@ class Main {
console.log(localize('uninstalling', "Uninstalling {0}...", id));
return this.extensionManagementService.uninstall(extension)
return this.extensionManagementService.uninstall(extension, true)
.then(() => console.log(localize('successUninstall', "Extension '{0}' was successfully uninstalled!", id)));
});
}));
......
......@@ -237,7 +237,7 @@ export interface IExtensionManagementService {
install(zipPath: string): TPromise<void>;
installFromGallery(extension: IGalleryExtension, promptToInstallDependencies?: boolean): TPromise<void>;
uninstall(extension: ILocalExtension): TPromise<void>;
uninstall(extension: ILocalExtension, force?: boolean): TPromise<void>;
getInstalled(type?: LocalExtensionType): TPromise<ILocalExtension[]>;
}
......
......@@ -17,7 +17,7 @@ export interface IExtensionManagementChannel extends IChannel {
call(command: 'event:onDidUninstallExtension'): TPromise<void>;
call(command: 'install', path: string): TPromise<void>;
call(command: 'installFromGallery', extension: IGalleryExtension): TPromise<void>;
call(command: 'uninstall', extension: ILocalExtension): TPromise<void>;
call(command: 'uninstall', args: [ILocalExtension, boolean]): TPromise<void>;
call(command: 'getInstalled'): TPromise<ILocalExtension[]>;
call(command: string, arg?: any): TPromise<any>;
}
......@@ -44,7 +44,7 @@ export class ExtensionManagementChannel implements IExtensionManagementChannel {
case 'event:onDidUninstallExtension': return eventToCall(this.onDidUninstallExtension);
case 'install': return this.service.install(arg);
case 'installFromGallery': return this.service.installFromGallery(arg[0], arg[1]);
case 'uninstall': return this.service.uninstall(arg);
case 'uninstall': return this.service.uninstall(arg[0], arg[1]);
case 'getInstalled': return this.service.getInstalled(arg);
}
return undefined;
......@@ -77,8 +77,8 @@ export class ExtensionManagementChannelClient implements IExtensionManagementSer
return this.channel.call('installFromGallery', [extension, promptToInstallDependencies]);
}
uninstall(extension: ILocalExtension): TPromise<void> {
return this.channel.call('uninstall', extension);
uninstall(extension: ILocalExtension, force = false): TPromise<void> {
return this.channel.call('uninstall', [extension, force]);
}
getInstalled(type: LocalExtensionType = null): TPromise<ILocalExtension[]> {
......
......@@ -290,20 +290,20 @@ export class ExtensionManagementService implements IExtensionManagementService {
});
}
uninstall(extension: ILocalExtension): TPromise<void> {
uninstall(extension: ILocalExtension, force = false): TPromise<void> {
return this.removeOutdatedExtensions().then(() => {
return this.scanUserExtensions().then<void>(installed => {
const promises = installed
.filter(e => e.manifest.publisher === extension.manifest.publisher && e.manifest.name === extension.manifest.name)
.map(e => this.checkForDependenciesAndUninstall(e, installed));
.map(e => this.checkForDependenciesAndUninstall(e, installed, force));
return TPromise.join(promises);
});
});
}
private checkForDependenciesAndUninstall(extension: ILocalExtension, installed: ILocalExtension[]): TPromise<void> {
private checkForDependenciesAndUninstall(extension: ILocalExtension, installed: ILocalExtension[], force: boolean): TPromise<void> {
return this.preUninstallExtension(extension.id)
.then(() => this.hasDependencies(extension, installed) ? this.promptForDependenciesAndUninstall(extension, installed) : this.promptAndUninstall(extension, installed))
.then(() => this.hasDependencies(extension, installed) ? this.promptForDependenciesAndUninstall(extension, installed, force) : this.promptAndUninstall(extension, installed, force))
.then(() => this.postUninstallExtension(extension.id),
error => {
this.postUninstallExtension(extension.id, error);
......@@ -318,7 +318,12 @@ export class ExtensionManagementService implements IExtensionManagementService {
return false;
}
private promptForDependenciesAndUninstall(extension: ILocalExtension, installed: ILocalExtension[]): TPromise<void> {
private promptForDependenciesAndUninstall(extension: ILocalExtension, installed: ILocalExtension[], force: boolean): TPromise<void> {
if (force) {
const dependencies = distinct(this.getDependenciesToUninstallRecursively(extension, installed, [])).filter(e => e !== extension);
return this.uninstallWithDependencies(extension, dependencies, installed);
}
const message = nls.localize('uninstallDependeciesConfirmation', "Would you like to uninstall '{0}' only or its dependencies also?", extension.manifest.displayName || extension.manifest.name);
const options = [
nls.localize('uninstallOnly', "Only"),
......@@ -338,7 +343,11 @@ export class ExtensionManagementService implements IExtensionManagementService {
}, error => TPromise.wrapError(errors.canceled()));
}
private promptAndUninstall(extension: ILocalExtension, installed: ILocalExtension[]): TPromise<void> {
private promptAndUninstall(extension: ILocalExtension, installed: ILocalExtension[], force: boolean): TPromise<void> {
if (force) {
return this.uninstallWithDependencies(extension, [], installed);
}
const message = nls.localize('uninstallConfirmation', "Are you sure you want to uninstall '{0}'?", extension.manifest.displayName || extension.manifest.name);
const options = [
nls.localize('ok', "Ok"),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册