You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Do not return an error when list commands return an empty list #5472
A number of list commands (eg. ssh-key, deploy-key, gpg-key) return a non-zero code when the list is empty. This is incorrect, and makes it difficult to distinguish between an empty list, which there is nothing wrong with, and an actual error. I ran into this while creating a script for adding deploy keys. The GitHub API returns an error if you try to add the same key (even if it's in the same repo). To avert that, I check the list first, but this throws an error when the list is empty.
Steps to reproduce the behavior
Type this 'gh deploy-key list'
Expected vs actual behavior
List commands should return success for empty lists, not an error as is currently the case.
Logs
$ gh repo deploy-key list;echo error: $?
No deploy keys found in user/repo
error: 1
@mohd-akram Agreed that our list commands should not return an error on empty lists. We recently changed this behavior for the extension list command. We are open to pull requests making this change.
Activity
samcoe commentedon Apr 18, 2022
@mohd-akram Agreed that our
listcommands should not return an error on empty lists. We recently changed this behavior for theextension listcommand. We are open to pull requests making this change.Griffin641498 commentedon Apr 22, 2022
Griffin641498 commentedon Apr 22, 2022