-
Notifications
You must be signed in to change notification settings - Fork 1
/
open.js
24 lines (19 loc) · 850 Bytes
/
open.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const { Command, flags } = require('@oclif/command');
const isSalesforceProject = require('../helpers/context-validation');
const { openOrg } = require('../helpers/scratch-org');
const { listOrgs } = require('../helpers/scratch-org-list');
class OpenCommand extends Command {
async run() {
const { flags } = this.parse(OpenCommand);
if (!isSalesforceProject() && !flags.select) {
this.log('This command is required to run from within an SFDX project.');
return;
}
return flags.select ? listOrgs().then(({ username }) => openOrg(username)) : openOrg();
}
}
OpenCommand.description = 'Open the default scratch org in the browser or by picking from the list of available orgs.';
OpenCommand.flags = {
select: flags.boolean({ char: 's', description: 'Select scratch org to open' })
};
module.exports = OpenCommand;