Skip to content

Commit

Permalink
refactor: feature used by 1 cmd goes into that cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Nov 9, 2023
1 parent 8d064f1 commit f9cc43d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
5 changes: 5 additions & 0 deletions messages/accesstoken.store.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,8 @@ To use the command in a CI/CD script, set the SFDX_ACCESS_TOKEN environment vari

The access token isn't in the correct format.
It should follow this pattern: %s.

# overwriteAccessTokenAuthUserFile

A file already exists for user "%s", which is associated with the access token you provided.
Are you sure you want to overwrite the existing file?
5 changes: 0 additions & 5 deletions messages/messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,3 @@ Access token of user to use for authentication
# noPrompt

do not prompt for confirmation

# overwriteAccessTokenAuthUserFile

A file already exists for user "%s", which is associated with the access token you provided.
Are you sure you want to overwrite the existing file?
5 changes: 0 additions & 5 deletions src/authBaseCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,4 @@ export abstract class AuthBaseCommand<T> extends SfCommand<T> {
protected async askForAccessToken(disableMasking = false): Promise<string> {
return this.askForHiddenResponse('accessTokenStdin', disableMasking);
}

protected async askOverwriteAuthFile(username: string): Promise<boolean> {
const yN = await this.confirm(messages.getMessage('overwriteAccessTokenAuthUserFile', [username]));
return yN;
}
}
2 changes: 1 addition & 1 deletion src/commands/org/login/access-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export default class LoginAccessToken extends AuthBaseCommand<AuthFields> {
if (!this.flags['no-prompt']) {
const stateAggregator = await StateAggregator.getInstance();
if (await stateAggregator.orgs.exists(username)) {
return this.askOverwriteAuthFile(username);
return this.confirm(messages.getMessage('overwriteAccessTokenAuthUserFile', [username]));
}
}
return true;
Expand Down

0 comments on commit f9cc43d

Please sign in to comment.