1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const cli_framework_1 = require("@ionic/cli-framework");
|
4 | const color_1 = require("../../lib/color");
|
5 | const base_1 = require("./base");
|
6 | class 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" ],
|
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 | }
|
48 | exports.OpenCommand = OpenCommand;
|