(f *cmdutil.Factory, runF func(*ListOptions) error)
| 29 | } |
| 30 | |
| 31 | func NewCmdList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.Command { |
| 32 | opts := &ListOptions{ |
| 33 | IO: f.IOStreams, |
| 34 | HTTPClient: f.HttpClient, |
| 35 | } |
| 36 | |
| 37 | cmd := &cobra.Command{ |
| 38 | Use: "list", |
| 39 | Short: "List deploy keys in a GitHub repository", |
| 40 | Aliases: []string{"ls"}, |
| 41 | Args: cobra.ExactArgs(0), |
| 42 | RunE: func(cmd *cobra.Command, args []string) error { |
| 43 | opts.BaseRepo = f.BaseRepo |
| 44 | |
| 45 | if runF != nil { |
| 46 | return runF(opts) |
| 47 | } |
| 48 | return listRun(opts) |
| 49 | }, |
| 50 | } |
| 51 | cmdutil.AddJSONFlags(cmd, &opts.Exporter, deployKeyFields) |
| 52 | return cmd |
| 53 | } |
| 54 | |
| 55 | func listRun(opts *ListOptions) error { |
| 56 | apiClient, err := opts.HTTPClient() |
nothing calls this directly
no test coverage detected