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(list): empty list when no authed orgs are found #552

Merged
merged 1 commit into from Dec 12, 2022
Merged

fix(list): empty list when no authed orgs are found #552

merged 1 commit into from Dec 12, 2022

Conversation

ghost
Copy link

@ghost ghost commented Dec 2, 2022

What does this PR do?

Fix the list printing empty table when no auth'd orgs are found

What issues does this PR fix or reference?

forcedotcom/cli#1796

As suggested by @cristiand391, I've simply added a check for the length of the array returned by AuthInfo.listAllAuthorizations to avoid relying on the error to be throw thrown.

@cristiand391
Copy link
Member

QA notes:

tested with sfdx-cli/7.181.1 darwin-x64 node-v18.12.1:

auth:list

✅ prints No results found if no auth'd orgs are found:

➜  plugin-auth git:(list-empty-table-no-orgs-fix) tree ~/.sfdx
/Users/cdominguez/.sfdx  [error opening dir]

0 directories, 0 files
➜  plugin-auth git:(list-empty-table-no-orgs-fix) tree ~/.sf
/Users/cdominguez/.sf
└── sf.log

0 directories, 1 file
➜  plugin-auth git:(list-empty-table-no-orgs-fix) ./bin/dev auth:list
No results found
➜  plugin-auth git:(list-empty-table-no-orgs-fix) echo $?
0

✅ JSON output matches latest sfdx:

➜  plugin-auth git:(list-empty-table-no-orgs-fix) ./bin/dev auth:list --json
{
  "status": 0,
  "result": []
}
➜  plugin-auth git:(list-empty-table-no-orgs-fix) sfdx auth:list --json
{
  "status": 0,
  "result": []
}

✅ lists auth'd orgs:

➜  plugin-auth git:(list-empty-table-no-orgs-fix) ./bin/dev auth:list
=== authenticated orgs

 ALIAS          USERNAME                              ORG ID             INSTANCE URL                                             AUTH METHOD
 ────────────── ───────────────────────────────────── ────────────────── ──────────────────────────────────────────────────────── ───────────
 ****           ********************************      ****************** **************************************                   web
 **             ************************************* ****************** ******************************************************** web
 ************** ************************************* ****************** *****************************                            web
➜  plugin-auth git:(list-empty-table-no-orgs-fix) echo $?
0

@cristiand391 cristiand391 merged commit b510c11 into salesforcecli:main Dec 12, 2022
@cristiand391
Copy link
Member

Merged, thanks @aemounib! :)

@cromwellryan
Copy link
Member

Thanks @aemounib! And congrats to Morocco on the World Cup! ⚽ ⚽ ⚽

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants