Skip to content

Commit eeb7c40

Browse files
authored
Show when GitHub users have no SSH keys configured (#396)
* Show when GitHub users have no SSH keys configured When specifying GitHub users with --github-user, display a clear indicator in the authorized keys section if a user has no SSH keys configured. This helps users understand why a particular user won't be able to connect to the session. The [!] prefix visually distinguishes these users while keeping the message informative and non-alarming. We use [!] instead of an emoji because emojis have inconsistent rendering across different terminal emulators (iTerm2, Terminal.app, VSCode), which breaks table alignment and column spacing. * Remove newline in warning message for missing SSH keys configuration
1 parent 4505dc2 commit eeb7c40

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

cmd/upterm/command/session.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,11 +332,15 @@ func validateCurrentRequiredFlags(c *cobra.Command, args []string) error {
332332
func displayAuthorizedKeys(keys []*api.AuthorizedKey) string {
333333
var aks []string
334334
for _, ak := range keys {
335-
var fps []string
336-
for _, fp := range ak.PublicKeyFingerprints {
337-
fps = append(fps, fmt.Sprintf("- %s", fp))
335+
if len(ak.PublicKeyFingerprints) == 0 {
336+
aks = append(aks, fmt.Sprintf("[!] %s (no SSH keys configured)", ak.Comment))
337+
} else {
338+
var fps []string
339+
for _, fp := range ak.PublicKeyFingerprints {
340+
fps = append(fps, fmt.Sprintf("- %s", fp))
341+
}
342+
aks = append(aks, fmt.Sprintf("%s:\n%s", ak.Comment, strings.Join(fps, "\n")))
338343
}
339-
aks = append(aks, fmt.Sprintf("%s:\n%s", ak.Comment, strings.Join(fps, "\n")))
340344
}
341345

342346
return strings.Join(aks, "\n")

0 commit comments

Comments
 (0)