MCPcopy Index your code
hub / github.com/cli/cli / deleteRun

Function deleteRun

pkg/cmd/ssh-key/delete/delete.go:58–91  ·  view source on GitHub ↗
(opts *DeleteOptions)

Source from the content-addressed store, hash-verified

56}
57
58func deleteRun(opts *DeleteOptions) error {
59 httpClient, err := opts.HttpClient()
60 if err != nil {
61 return err
62 }
63
64 cfg, err := opts.Config()
65 if err != nil {
66 return err
67 }
68
69 host, _ := cfg.Authentication().DefaultHost()
70 key, err := getSSHKey(httpClient, host, opts.KeyID)
71 if err != nil {
72 return err
73 }
74
75 if !opts.Confirmed {
76 if err := opts.Prompter.ConfirmDeletion(key.Title); err != nil {
77 return err
78 }
79 }
80
81 err = deleteSSHKey(httpClient, host, opts.KeyID)
82 if err != nil {
83 return err
84 }
85
86 if opts.IO.IsStdoutTTY() {
87 cs := opts.IO.ColorScheme()
88 fmt.Fprintf(opts.IO.Out, "%s SSH key %q (%s) deleted from your account\n", cs.SuccessIcon(), key.Title, opts.KeyID)
89 }
90 return nil
91}

Callers 2

NewCmdDeleteFunction · 0.70
Test_deleteRunFunction · 0.70

Calls 9

getSSHKeyFunction · 0.85
deleteSSHKeyFunction · 0.85
IsStdoutTTYMethod · 0.80
ColorSchemeMethod · 0.80
SuccessIconMethod · 0.80
ConfigMethod · 0.65
DefaultHostMethod · 0.65
AuthenticationMethod · 0.65
ConfirmDeletionMethod · 0.65

Tested by 1

Test_deleteRunFunction · 0.56