File tree 2 files changed +19
-3
lines changed
2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change 1
1
package cli
2
2
3
3
import (
4
+ "strings"
5
+
4
6
"github.com/spf13/cobra"
5
7
"golang.org/x/xerrors"
6
8
9
+ "github.com/coder/coder/cli/cliui"
7
10
"github.com/coder/coder/codersdk"
8
11
)
9
12
10
13
func publickey () * cobra.Command {
11
14
return & cobra.Command {
12
- Use : "publickey" ,
15
+ Use : "publickey" ,
16
+ Aliases : []string {"pubkey" },
13
17
RunE : func (cmd * cobra.Command , args []string ) error {
14
18
client , err := createClient (cmd )
15
19
if err != nil {
@@ -21,7 +25,16 @@ func publickey() *cobra.Command {
21
25
return xerrors .Errorf ("create codersdk client: %w" , err )
22
26
}
23
27
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 )))
25
38
26
39
return nil
27
40
},
Original file line number Diff line number Diff line change @@ -210,12 +210,15 @@ func TestProvisionerd(t *testing.T) {
210
210
didAcquireJob atomic.Bool
211
211
didDryRun atomic.Bool
212
212
)
213
+ var complete sync.Once
213
214
completeChan := make (chan struct {})
214
215
closer := createProvisionerd (t , func (ctx context.Context ) (proto.DRPCProvisionerDaemonClient , error ) {
215
216
return createProvisionerDaemonClient (t , provisionerDaemonTestServer {
216
217
acquireJob : func (ctx context.Context , _ * proto.Empty ) (* proto.AcquiredJob , error ) {
217
218
if didAcquireJob .Load () {
218
- close (completeChan )
219
+ complete .Do (func () {
220
+ close (completeChan )
221
+ })
219
222
return & proto.AcquiredJob {}, nil
220
223
}
221
224
didAcquireJob .Store (true )
You can’t perform that action at this time.
0 commit comments