cli: show helpful message for 'snapcraft list-keys' with no keys
Metadata
Current evaluation
Merged fix replacing the empty table output of snapcraft list-keys with a helpful message directing users to register-key --help. Added a unit test mocking an empty key list. Approved and merged after reviewer guidance on test implementation.
Suggested action: —
No scores available.
Issue body
Tell user to see 'register-key --help' if there is no key registered. Before this fix, an empty table was printed. (which is ugly and redundant)
LP: [#1720210](https://bugs.launchpad.net/snapcraft/+bug/1720210)
- [X] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [X] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [X] If this is a bugfix. Have you checked that there is a bug report open for the issue you are trying to fix on [bug reports](https://bugs.launchpad.net/snapcraft)?
- [x] If this is a new feature. Have you discussed the design on the [forum](https://forum.snapcraft.io)?
- [X] Have you successfully run `./runtests.sh static`?
- [x] Have you successfully run `./runtests.sh unit`?
-----
Hi! I could check that the changed message is printed with my account w/o registering key, and after I registered one, the ordinary table showed up. However, I'm not sure how to write a test for it. Or is it simple enough that there's no test needed? I'm doing this as a GCI task to fix a bitesize bug of snapcraft, and not that familiar with these stuff ;( If there's something I didn't do correctly with the flow, do not hesitate to teach me. Many thanks!
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged fix replacing the empty table output of snapcraft list-keys with a helpful message directing users to register-key --help. Added a unit test mocking an empty key list. Approved and merged after reviewer guidance on test implementation. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged a fix replacing the empty table for snapcraft list-keys with a helpful message pointing to register-key --help. After maintainer guidance, the contributor added a unit test for the empty key scenario, and the pull request was merged. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged a fix to display a helpful message when snapcraft list-keys has no registered keys, replacing an empty table. A maintainer guided adding a unit test for the empty keys scenario before merging. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #786 Add `snapcraft list-keys` | snapcraft | merged | Merged changes adding the snapcraft list-keys command to show store-registered keys. The author promptly resolved an initial CI test failure, reviewers approved the update, and the branch was merged. | |
| #1736864 snapcraft list-keys with no snap keys returns an empty table | snapcraft (launchpad) | closed | Fixed via PR #1784. The command now displays a helpful message instead of an empty table when no local keys are registered, resolving the reported UX issue. | |
| #1720210 snapcraft list-keys with no keys returns an empty table | snapcraft (launchpad) | closed | Abandoned. Closed without implementation, leaving snapcraft list-keys to display an empty table instead of a helpful message when no keys are registered. | |
| #1622037 snapcraft list-keys prints no message when there are no keys | snapcraft (launchpad) | open | snapcraft list-keys prints only an empty table header when no keys are registered; a friendly message (and possibly tips on adding keys) is requested. Unlabelled, zero comments, no activity for ~10 years; a similar Launchpad bug remains open. | |
| #1858994 snapcraft list-keys doesn't show the non-registered key when no key is registered | snapcraft (launchpad) | open | list-keys (snapcraft 3.8) fails to show a locally created key when no key is registered yet, printing 'No keys have been registered' instead. Unlabelled, zero comments, no activity for ~6.6 years; the command was later removed and replaced by snapcraft keys. | |
| #1720207 snapcraft list-keys returns no keys, but the user has keys | snapcraft (launchpad) | open | Maintainer elopio reported snapcraft list-keys showing an empty table despite the user having a registered key, while create-key says a 'default' key exists. Zero comments, no activity for ~6.4 years; the list-keys command has since been removed and replaced by keys. | |
| #824 Add `snapcraft create-key` | snapcraft | merged | Merged. Adds snapcraft create-key to wrap snap create-key, unifying key creation and registration. Prevents duplicate registration errors and improves UX. Applied reviewer feedback and minor tweaks before merging. |