UNPKG

1.7 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const cli_framework_1 = require("@ionic/cli-framework");
4const color_1 = require("../../lib/color");
5const base_1 = require("./base");
6class OpenCommand extends base_1.CapacitorCommand {
7 async getMetadata() {
8 return {
9 name: 'open',
10 type: 'project',
11 summary: 'Open the IDE for a given native platform project',
12 description: `
13${color_1.input('ionic capacitor open')} will do the following:
14- Open the IDE for your native project (Xcode for iOS, Android Studio for Android)
15 `,
16 inputs: [
17 {
18 name: 'platform',
19 summary: `The platform to open (e.g. ${['android', 'ios'].map(v => color_1.input(v)).join(', ')})`,
20 validators: [cli_framework_1.validators.required],
21 },
22 ],
23 groups: ["beta" /* BETA */],
24 };
25 }
26 async preRun(inputs, options, runinfo) {
27 await this.preRunChecks(runinfo);
28 if (!inputs[0]) {
29 const platform = await this.env.prompt({
30 type: 'list',
31 name: 'platform',
32 message: 'What platform would you like to open?',
33 choices: ['android', 'ios'],
34 });
35 inputs[0] = platform.trim();
36 }
37 await this.checkForPlatformInstallation(inputs[0]);
38 }
39 async run(inputs, options) {
40 const [platform] = inputs;
41 const args = ['open'];
42 if (platform) {
43 args.push(platform);
44 }
45 await this.runCapacitor(args);
46 }
47}
48exports.OpenCommand = OpenCommand;