Skip to content

Commit d13114a

Browse files
authored
add option to skip opening the generated extension (#514)
1 parent d5ff9f3 commit d13114a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

generators/app/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export default class extends Generator {
7777
this.option('quick', { type: Boolean, alias: 'q', description: 'Quick mode, skip all optional prompts and use defaults' });
7878
this.option('open', { type: Boolean, alias: 'o', description: 'Open the generated extension in Visual Studio Code' });
7979
this.option('openInInsiders', { type: Boolean, alias: 'O', description: 'Open the generated extension in Visual Studio Code Insiders' });
80-
80+
this.option('skipOpen', { type: Boolean, alias:'s', description: 'Skip opening the generated extension in Visual Studio Code' });
8181
this.option('extensionType', { type: String, alias: 't', description: extensionGenerators.slice(0, 6).map(e => e.aliases[0]).join(', ') + '...' });
8282
this.option('extensionDisplayName', { type: String, alias: 'n', description: 'Display name of the extension' });
8383
this.option('extensionId', { type: String, description: 'Id of the extension' });
@@ -242,7 +242,7 @@ export default class extends Generator {
242242

243243
const [codeStableLocation, codeInsidersLocation] = await Promise.all([which('code').catch(() => undefined), which('code-insiders').catch(() => undefined)]);
244244

245-
if (!this.extensionConfig.insiders && !this.options['open'] && !this.options['openInInsiders'] && !this.options['quick']) {
245+
if (!this.extensionConfig.insiders && !this.options['open'] && !this.options['openInInsiders'] && !this.options['quick'] && !this.options['skipOpen']) {
246246
const cdLocation = this.options['destination'] || this.extensionConfig.name;
247247

248248
this.log('To start editing with Visual Studio Code, use the following commands:');
@@ -265,6 +265,10 @@ export default class extends Generator {
265265
this.log('For more information, also visit http://code.visualstudio.com and follow us @code.');
266266
this.log('\r\n');
267267

268+
if (this.options['skipOpen']) {
269+
return;
270+
}
271+
268272
if (this.options["open"]) {
269273
if (codeStableLocation) {
270274
this.log(`Opening ${this.destinationPath()} in Visual Studio Code...`);

0 commit comments

Comments
 (0)