Skip to content

Commit 1040645

Browse files
committed
feat: Add links for registering git key
1 parent a6ea995 commit 1040645

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

cli/publickey.go

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
package cli
22

33
import (
4+
"strings"
5+
46
"github.com/spf13/cobra"
57
"golang.org/x/xerrors"
68

9+
"github.com/coder/coder/cli/cliui"
710
"github.com/coder/coder/codersdk"
811
)
912

1013
func publickey() *cobra.Command {
1114
return &cobra.Command{
12-
Use: "publickey",
15+
Use: "publickey",
16+
Aliases: []string{"pubkey"},
1317
RunE: func(cmd *cobra.Command, args []string) error {
1418
client, err := createClient(cmd)
1519
if err != nil {
@@ -21,7 +25,16 @@ func publickey() *cobra.Command {
2125
return xerrors.Errorf("create codersdk client: %w", err)
2226
}
2327

24-
cmd.Println(key.PublicKey)
28+
cmd.Println(cliui.Styles.Wrap.Render(
29+
"This is your public key for using " + cliui.Styles.Field.Render("git") + " in " +
30+
"Coder. All clones with SSH will be authenticated automatically 🪄.",
31+
))
32+
cmd.Println()
33+
cmd.Println("Add to GitHub and GitLab:")
34+
cmd.Println(cliui.Styles.Prompt.String() + "https://github.com/settings/ssh/new")
35+
cmd.Println(cliui.Styles.Prompt.String() + "https://gitlab.com/-/profile/keys")
36+
cmd.Println()
37+
cmd.Println(cliui.Styles.Code.Render(strings.TrimSpace(key.PublicKey)))
2538

2639
return nil
2740
},

0 commit comments

Comments
 (0)