From 620714f0e9299df2e363e2b1dc030229f5154fc6 Mon Sep 17 00:00:00 2001 From: Anuj Date: Wed, 2 Jun 2021 18:43:22 +0530 Subject: [PATCH 1/2] Refactor profiles usage to projects --- src/commands/profiles/list.js | 12 ++++++------ src/commands/profiles/remove.js | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/commands/profiles/list.js b/src/commands/profiles/list.js index 9c7e3c139..0094ac99d 100644 --- a/src/commands/profiles/list.js +++ b/src/commands/profiles/list.js @@ -13,19 +13,19 @@ class ProfilesList extends BaseCommand { accountSid: ENVIRONMENT_ACCOUNT_SID, region: ENVIRONMENT_REGION, }; - this.userConfig.profiles.unshift(strippedEnvProfile); + this.userConfig.projects.unshift(strippedEnvProfile); this.userConfig.setActiveProfile(strippedEnvProfile.id); } - if (this.userConfig.profiles.length > 0) { + if (this.userConfig.projects.length > 0) { // If none of the profiles have a region, delete it from all of them so it doesn't show up in the output. - if (!this.userConfig.profiles.some((p) => p.region)) { - this.userConfig.profiles.forEach((p) => delete p.region); + if (!this.userConfig.projects.some((p) => p.region)) { + this.userConfig.projects.forEach((p) => delete p.region); } const activeProfile = this.userConfig.getActiveProfile(); - this.userConfig.profiles.forEach((p) => { + this.userConfig.projects.forEach((p) => { p.active = p.id === activeProfile.id; }); - this.output(this.userConfig.profiles); + this.output(this.userConfig.projects); } else { this.logger.warn(`No profiles have been configured. Run ${chalk.bold('twilio profiles:create')} to create one!`); } diff --git a/src/commands/profiles/remove.js b/src/commands/profiles/remove.js index 4c72972d3..0908a6525 100644 --- a/src/commands/profiles/remove.js +++ b/src/commands/profiles/remove.js @@ -33,7 +33,7 @@ class ProfilesRemove extends TwilioClientCommand { 'Are you sure you want to remove the active profile? Run "twilio profiles:use" to set another profile as active.', ); } - if (this.userConfig.profiles.length === 1) { + if (this.userConfig.projects.length === 1) { this.logger.warn( 'Are you sure you want to remove the last profile? Run "twilio profiles:create" to create another profile.', ); From 16497b45313492660ae07920ab27ffd7e277a550 Mon Sep 17 00:00:00 2001 From: Anuj Date: Thu, 3 Jun 2021 11:22:36 +0530 Subject: [PATCH 2/2] Correct comment --- src/commands/profiles/list.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/profiles/list.js b/src/commands/profiles/list.js index 0094ac99d..bcc83599e 100644 --- a/src/commands/profiles/list.js +++ b/src/commands/profiles/list.js @@ -5,7 +5,7 @@ class ProfilesList extends BaseCommand { async run() { await super.run(); const envProfile = this.userConfig.getProfileFromEnvironment(); - // If environment profile exists, add required details to userConfig.profiles, and mark as active. + // If environment profile exists, add required details to userConfig.projects, and mark as active. if (envProfile) { const { accountSid: ENVIRONMENT_ACCOUNT_SID, region: ENVIRONMENT_REGION } = envProfile; const strippedEnvProfile = {