Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: change org logout commands and flags to sf style #5071

Merged
merged 4 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export abstract class SfdxCommandletExecutor<T>
const cancellationToken = cancellationTokenSource.token;
const execution = new CliCommandExecutor(this.build(response.data), {
cwd: this.executionCwd,
env: { SFDX_JSON_TO_STDOUT: 'true' }
env: { SF_JSON_TO_STDOUT: 'true' }
}).execute(cancellationToken);

let output = '';
Expand Down
12 changes: 6 additions & 6 deletions packages/salesforcedx-vscode-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,11 @@
"when": "sfdx:project_opened"
},
{
"command": "sfdx.force.auth.logout.all",
"command": "sfdx.org.logout.all",
"when": "sfdx:project_opened"
},
{
"command": "sfdx.force.auth.logout.default",
"command": "sfdx.org.logout.default",
"when": "sfdx:project_opened && sfdx:has_default_username"
},
{
Expand Down Expand Up @@ -640,12 +640,12 @@
"title": "%force_auth_access_token_authorize_org_text%"
},
{
"command": "sfdx.force.auth.logout.all",
"title": "%force_auth_logout_all_text%"
"command": "sfdx.org.logout.all",
"title": "%org_logout_all_text%"
},
{
"command": "sfdx.force.auth.logout.default",
"title": "%force_auth_logout_default_text%"
"command": "sfdx.org.logout.default",
"title": "%org_logout_default_text%"
},
{
"command": "sfdx.force.open.documentation",
Expand Down
4 changes: 2 additions & 2 deletions packages/salesforcedx-vscode-core/package.nls.ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"force_auth_web_login_authorize_dev_hub_text": "SFDX: Dev Hub を認証",
"force_auth_web_login_authorize_org_text": "SFDX: 組織を認証",
"force_auth_access_token_authorize_org_text": "SFDX: Authorize an Org using Session ID",
"force_auth_logout_all_text": "SFDX: すべての認証済み組織からログアウト",
"force_auth_logout_default_text": "SFDX: Log Out from Default Org",
"org_logout_all_text": "SFDX: すべての認証済み組織からログアウト",
"org_logout_default_text": "SFDX: Log Out from Default Org",
"force_org_create_default_scratch_org_text": "SFDX: デフォルトのスクラッチ組織を作成...",
"force_org_open_default_scratch_org_text": "SFDX: デフォルトの組織を開く",
"force_source_pull_default_org_text": "SFDX: デフォルトのスクラッチ組織からソースをプル",
Expand Down
4 changes: 2 additions & 2 deletions packages/salesforcedx-vscode-core/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"force_auth_web_login_authorize_dev_hub_text": "SFDX: Authorize a Dev Hub",
"force_auth_web_login_authorize_org_text": "SFDX: Authorize an Org",
"force_auth_access_token_authorize_org_text": "SFDX: Authorize an Org using Session ID",
"force_auth_logout_all_text": "SFDX: Log Out from All Authorized Orgs",
"force_auth_logout_default_text": "SFDX: Log Out from Default Org",
"org_logout_all_text": "SFDX: Log Out from All Authorized Orgs",
"org_logout_default_text": "SFDX: Log Out from Default Org",
"force_open_documentation_text": "SFDX: Open Documentation",
"force_org_create_default_scratch_org_text": "SFDX: Create a Default Scratch Org...",
"force_org_open_default_scratch_org_text": "SFDX: Open Default Org",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,10 @@ export class ScratchOrgLogoutParamsGatherer

public async gather(): Promise<CancelResponse | ContinueResponse<string>> {
const prompt = nls.localize(
'auth_logout_scratch_prompt',
'org_logout_scratch_prompt',
this.alias || this.username
);
const logoutResponse = nls.localize('auth_logout_scratch_logout');
const logoutResponse = nls.localize('org_logout_scratch_logout');

const confirm = await vscode.window.showInformationMessage(
prompt,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import {
SfdxWorkspaceChecker
} from '../util';
import { AuthParams, AuthParamsGatherer } from './authParamsGatherer';
import { ForceAuthLogoutAll } from './forceAuthLogout';
import { OrgLogoutAll } from './orgLogout';

export interface DeviceCodeResponse {
user_code: string;
Expand Down Expand Up @@ -230,7 +230,7 @@ export async function promptLogOutForProdOrg() {
await new SfdxCommandlet(
new SfdxWorkspaceChecker(),
new DemoModePromptGatherer(),
ForceAuthLogoutAll.withoutShowingChannel()
OrgLogoutAll.withoutShowingChannel()
).run();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,41 +28,41 @@ import {
} from '../util';
import { ScratchOrgLogoutParamsGatherer } from './authParamsGatherer';

export class ForceAuthLogoutAll extends SfdxCommandletExecutor<{}> {
public static withoutShowingChannel(): ForceAuthLogoutAll {
const instance = new ForceAuthLogoutAll();
export class OrgLogoutAll extends SfdxCommandletExecutor<{}> {
public static withoutShowingChannel(): OrgLogoutAll {
const instance = new OrgLogoutAll();
instance.showChannelOutput = false;
return instance;
}

public build(data: {}): Command {
return new SfdxCommandBuilder()
.withDescription(nls.localize('force_auth_logout_all_text'))
.withArg('force:auth:logout')
.withDescription(nls.localize('org_logout_all_text'))
.withArg('org:logout')
RitamAgrawal marked this conversation as resolved.
Show resolved Hide resolved
.withArg('--all')
.withArg('--noprompt')
.withArg('--no-prompt')
.withLogName('force_auth_logout')
.build();
}
}

const workspaceChecker = new SfdxWorkspaceChecker();
const parameterGatherer = new EmptyParametersGatherer();
const executor = new ForceAuthLogoutAll();
const executor = new OrgLogoutAll();
const commandlet = new SfdxCommandlet(
workspaceChecker,
parameterGatherer,
executor
);

export async function forceAuthLogoutAll() {
export async function orgLogoutAll() {
await commandlet.run();
}

export class AuthLogoutDefault extends LibraryCommandletExecutor<string> {
export class OrgLogoutDefault extends LibraryCommandletExecutor<string> {
constructor() {
super(
nls.localize('force_auth_logout_default_text'),
nls.localize('org_logout_default_text'),
'force_auth_logout_default',
OUTPUT_CHANNEL
);
Expand All @@ -86,7 +86,7 @@ export class AuthLogoutDefault extends LibraryCommandletExecutor<string> {
}
}

export async function forceAuthLogoutDefault() {
export async function orgLogoutDefault() {
const { username, isScratch, alias, error } = await resolveDefaultUsername();
if (error) {
telemetryService.sendException(error.name, error.message);
Expand All @@ -99,12 +99,12 @@ export async function forceAuthLogoutDefault() {
isScratch
? new ScratchOrgLogoutParamsGatherer(username, alias)
: new SimpleGatherer<string>(username),
new AuthLogoutDefault()
new OrgLogoutDefault()
);
await logoutCommandlet.run();
} else {
notificationService.showInformationMessage(
nls.localize('auth_logout_no_default_org')
nls.localize('org_logout_no_default_org')
);
}
}
Expand Down
6 changes: 1 addition & 5 deletions packages/salesforcedx-vscode-core/src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,7 @@ export {
turnOffLogging,
ForceStopApexDebugLoggingExecutor
} from './forceStopApexDebugLogging';
export {
forceAuthLogoutAll,
ForceAuthLogoutAll,
forceAuthLogoutDefault
} from './auth/forceAuthLogout';
export { orgLogoutAll, orgLogoutDefault, OrgLogoutAll } from './auth/orgLogout';
CristiCanizales marked this conversation as resolved.
Show resolved Hide resolved
import { DeveloperLogTraceFlag } from '../traceflag/developerLogTraceFlag';
export const developerLogTraceFlag = DeveloperLogTraceFlag.getInstance();
export { forceConfigSet, ForceConfigSetExecutor } from './forceConfigSet';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export abstract class SfdxCommandletExecutor<T>
const cancellationToken = cancellationTokenSource.token;
const execution = new CliCommandExecutor(this.build(response.data), {
cwd: this.executionCwd,
env: { SFDX_JSON_TO_STDOUT: 'true' }
env: { SF_JSON_TO_STDOUT: 'true' }
}).execute(cancellationToken);

let output = '';
Expand Down
20 changes: 10 additions & 10 deletions packages/salesforcedx-vscode-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ import {
forceApexTriggerCreate,
forceAuthAccessToken,
forceAuthDevHub,
forceAuthLogoutAll,
forceAuthLogoutDefault,
forceAuthWebLogin,
forceConfigList,
forceConfigSet,
Expand Down Expand Up @@ -73,6 +71,8 @@ import {
forceVisualforceComponentCreate,
forceVisualforcePageCreate,
initSObjectDefinitions,
orgLogoutAll,
orgLogoutDefault,
registerFunctionInvokeCodeLensProvider,
SourceStatusFlags,
turnOffLogging,
Expand Down Expand Up @@ -146,13 +146,13 @@ function registerCommands(
'sfdx.force.auth.dev.hub',
forceAuthDevHub
);
const forceAuthLogoutAllCmd = vscode.commands.registerCommand(
'sfdx.force.auth.logout.all',
forceAuthLogoutAll
const orgLogoutAllCmd = vscode.commands.registerCommand(
'sfdx.org.logout.all',
orgLogoutAll
);
const forceAuthLogoutDefaultCmd = vscode.commands.registerCommand(
'sfdx.force.auth.logout.default',
forceAuthLogoutDefault
const orgLogoutDefaultCmd = vscode.commands.registerCommand(
'sfdx.org.logout.default',
orgLogoutDefault
);
const forceOpenDocumentationCmd = vscode.commands.registerCommand(
'sfdx.force.open.documentation',
Expand Down Expand Up @@ -413,8 +413,8 @@ function registerCommands(
forceAuthAccessTokenCmd,
forceAuthWebLoginCmd,
forceAuthDevHubCmd,
forceAuthLogoutAllCmd,
forceAuthLogoutDefaultCmd,
orgLogoutAllCmd,
orgLogoutDefaultCmd,
forceDataSoqlQueryInputCmd,
forceDataSoqlQuerySelectionCmd,
forceDiffFile,
Expand Down
10 changes: 5 additions & 5 deletions packages/salesforcedx-vscode-core/src/messages/i18n.ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ export const messages = {
'VS Code のSalesforce 拡張機能をデモモードで実行しています。本番環境に接続するときに確認を求められます。',
demo_mode_prompt:
'デモモードまたは共有マシンで、ビジネスまたは本番組織を認証することは推奨されません。認証を続ける場合、組織を使用した後、必ず "SFDX: すべての認証済み組織からログアウト" を実行してください。',
force_auth_logout_all_text: 'SFDX: すべての認証済み組織からログアウト',
force_auth_logout_default_text: 'SFDX: Log Out from Default Org',
org_logout_all_text: 'SFDX: すべての認証済み組織からログアウト',
org_logout_default_text: 'SFDX: Log Out from Default Org',
manifest_editor_title_message: 'マニフェストエディタ',
REST_API: 'REST API',
tooling_API: 'Tooling API',
Expand All @@ -229,10 +229,10 @@ export const messages = {
auth_custom_label: 'カスタム',
auth_custom_detail: 'カスタムログイン URL を入力',
auth_invalid_url: 'URL は http:// か https:// で始める必要があります。',
auth_logout_scratch_prompt:
org_logout_scratch_prompt:
'Log out of this scratch org?\n\nBefore logging out, ensure that you or someone on your team has a username and password for %s scratch org. Otherwise you might lose all access to this scratch org.',
auth_logout_scratch_logout: 'Logout',
auth_logout_no_default_org: 'No default org to logout from',
org_logout_scratch_logout: 'Logout',
org_logout_no_default_org: 'No default org to logout from',
error_fetching_auth_info_text:
'保存時のプッシュまたはデプロイ実行中にエラー: デフォルトの組織に接続できませんでした。"SFDX: デフォルトのスクラッチ組織を作成" または "SFDX: 組織を認証" を実行して、保存したソースをプッシュまたはデプロイしてください。もしくは、保存時のプッシュまたはデプロイを無効化するため、VS Code のユーザまたはワークスペース設定で "salesforcedx-vscode-core.push-or-deploy-on-save.enabled" を false に設定してください。',
error_no_package_directories_found_on_setup_text:
Expand Down
10 changes: 5 additions & 5 deletions packages/salesforcedx-vscode-core/src/messages/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ export const messages = {
'You are running Salesforce Extensions for VS Code in demo mode. You will be prompted for confirmation when connecting to production orgs.',
demo_mode_prompt:
'Authorizing a business or production org is not recommended on a demo or shared machine. If you continue with the authentication, be sure to run "SFDX: Log Out from All Authorized Orgs" when you\'re done using this org.',
force_auth_logout_all_text: 'SFDX: Log Out from All Authorized Orgs',
force_auth_logout_default_text: 'SFDX: Log Out from Default Org',
org_logout_all_text: 'SFDX: Log Out from All Authorized Orgs',
org_logout_default_text: 'SFDX: Log Out from Default Org',
manifest_input_dupe_error:
'Manifest with the name %s already exists. Delete this manifest or use another name.',
manifest_input_save_placeholder:
Expand All @@ -268,10 +268,10 @@ export const messages = {
auth_custom_label: 'Custom',
auth_custom_detail: 'Enter a custom login URL',
auth_invalid_url: 'URL must begin with http:// or https://',
auth_logout_scratch_prompt:
org_logout_scratch_prompt:
'Log out of this scratch org?\n\nBefore logging out, ensure that you or someone on your team has a username and password for %s scratch org. Otherwise you might lose all access to this scratch org.',
auth_logout_scratch_logout: 'Logout',
auth_logout_no_default_org: 'No default org to logout from',
org_logout_scratch_logout: 'Logout',
org_logout_no_default_org: 'No default org to logout from',
error_fetching_auth_info_text:
'Error running push or deploy on save: We couldn\'t connect to your default org. Run "SFDX: Create a Default Scratch Org" or "SFDX: Authorize an Org", then push or deploy the source that you just saved. Or, to disable push or deploy on save, set "salesforcedx-vscode-core.push-or-deploy-on-save.enabled" to false in your user or workspace settings for VS Code.',
error_no_package_directories_found_on_setup_text:
Expand Down
Loading