(f *cmdutil.Factory, runF func(*DeleteOptions) error)
| 19 | } |
| 20 | |
| 21 | func NewCmdDelete(f *cmdutil.Factory, runF func(*DeleteOptions) error) *cobra.Command { |
| 22 | opts := &DeleteOptions{ |
| 23 | HTTPClient: f.HttpClient, |
| 24 | IO: f.IOStreams, |
| 25 | } |
| 26 | |
| 27 | cmd := &cobra.Command{ |
| 28 | Use: "delete <key-id>", |
| 29 | Short: "Delete a deploy key from a GitHub repository", |
| 30 | Args: cobra.ExactArgs(1), |
| 31 | RunE: func(cmd *cobra.Command, args []string) error { |
| 32 | opts.BaseRepo = f.BaseRepo |
| 33 | opts.KeyID = args[0] |
| 34 | |
| 35 | if runF != nil { |
| 36 | return runF(opts) |
| 37 | } |
| 38 | return deleteRun(opts) |
| 39 | }, |
| 40 | } |
| 41 | |
| 42 | return cmd |
| 43 | } |
| 44 | |
| 45 | func deleteRun(opts *DeleteOptions) error { |
| 46 | httpClient, err := opts.HTTPClient() |
nothing calls this directly
no test coverage detected