Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Introduce --force arg to install extension without prompts
  • Loading branch information
sandy081 committed Sep 13, 2018
1 parent 5b223a4 commit 1dd7326
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/vs/code/node/cliProcessMain.ts
Expand Up @@ -77,7 +77,7 @@ class Main {
} else if (argv['install-extension']) {
const arg = argv['install-extension'];
const args: string[] = typeof arg === 'string' ? [arg] : arg;
returnPromise = this.installExtension(args);
returnPromise = this.installExtension(args, argv['force']);
} else if (argv['uninstall-extension']) {
const arg = argv['uninstall-extension'];
const ids: string[] = typeof arg === 'string' ? [arg] : arg;
Expand All @@ -96,7 +96,7 @@ class Main {
});
}

private installExtension(extensions: string[]): TPromise<any> {
private installExtension(extensions: string[], force: boolean): TPromise<any> {
const vsixTasks: Task[] = extensions
.filter(e => /\.vsix$/i.test(e))
.map(id => () => {
Expand Down Expand Up @@ -138,7 +138,7 @@ class Main {
}

const [installedExtension] = installed.filter(e => areSameExtensions({ id: getGalleryExtensionIdFromLocal(e) }, { id }));
if (installedExtension) {
if (installedExtension && !force) {
const outdated = semver.gt(extension.version, installedExtension.manifest.version);
if (outdated) {
const updateMessage = localize('updateMessage', "Extension '{0}' v{1} is already installed, but a newer version {2} is available in the marketplace. Would you like to update?", id, installedExtension.manifest.version, extension.version);
Expand Down

0 comments on commit 1dd7326

Please sign in to comment.