Skip to content

Commit e2ca41e

Browse files
committed
Migrate bm delete commands to canonical ux/confirm helper
Switches bm/users/delete and bm/access-key/delete from @inquirer/prompts to the SDK's @salesforce/b2c-tooling-sdk/ux confirm() introduced in main. Drops the @inquirer/prompts dependency from these two files.
1 parent 9d61a1f commit e2ca41e

2 files changed

Lines changed: 12 additions & 14 deletions

File tree

packages/b2c-cli/src/commands/bm/access-key/delete.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
* For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
55
*/
66
import {Args, Flags} from '@oclif/core';
7-
import {confirm as promptConfirm} from '@inquirer/prompts';
87
import {deleteBmUserAccessKey} from '@salesforce/b2c-tooling-sdk/operations/bm-users';
8+
import {confirm} from '@salesforce/b2c-tooling-sdk/ux';
99
import {BmUserAuthCommand} from '../../../utils/bm/user-auth-command.js';
1010
import {resolveLoginOrWhoami} from '../../../utils/bm/resolve-login.js';
1111
import {t} from '../../../i18n/index.js';
@@ -60,14 +60,13 @@ export default class BmAccessKeyDelete extends BmUserAuthCommand<typeof BmAccess
6060
const login = await resolveLoginOrWhoami(this.instance, this.args.login);
6161

6262
if (!force && !this.jsonEnabled()) {
63-
const answer = await promptConfirm({
64-
message: t(
65-
'commands.bm.accessKey.delete.confirm',
66-
'Delete the {{scope}} access key for {{login}} on {{hostname}}?',
67-
{login, scope, hostname},
68-
),
69-
default: false,
70-
});
63+
const answer = await confirm(
64+
t('commands.bm.accessKey.delete.confirm', 'Delete the {{scope}} access key for {{login}} on {{hostname}}?', {
65+
login,
66+
scope,
67+
hostname,
68+
}),
69+
);
7170
if (!answer) {
7271
this.log(t('commands.bm.accessKey.delete.cancelled', 'Cancelled.'));
7372
return {success: false, login, scope, hostname};

packages/b2c-cli/src/commands/bm/users/delete.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
* For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
55
*/
66
import {Args, Flags} from '@oclif/core';
7-
import {confirm as promptConfirm} from '@inquirer/prompts';
87
import {InstanceCommand} from '@salesforce/b2c-tooling-sdk/cli';
98
import {deleteBmUser} from '@salesforce/b2c-tooling-sdk/operations/bm-users';
9+
import {confirm} from '@salesforce/b2c-tooling-sdk/ux';
1010
import {t} from '../../../i18n/index.js';
1111

1212
interface DeleteResult {
@@ -48,10 +48,9 @@ export default class BmUsersDelete extends InstanceCommand<typeof BmUsersDelete>
4848
const hostname = this.resolvedConfig.values.hostname!;
4949

5050
if (!force && !this.jsonEnabled()) {
51-
const answer = await promptConfirm({
52-
message: t('commands.bm.users.delete.confirm', 'Delete user {{login}} from {{hostname}}?', {login, hostname}),
53-
default: false,
54-
});
51+
const answer = await confirm(
52+
t('commands.bm.users.delete.confirm', 'Delete user {{login}} from {{hostname}}?', {login, hostname}),
53+
);
5554
if (!answer) {
5655
this.log(t('commands.bm.users.delete.cancelled', 'Cancelled.'));
5756
return {success: false, login, hostname};

0 commit comments

Comments
 (0)