| 20 | } |
| 21 | |
| 22 | func NewCmdList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.Command { |
| 23 | opts := &ListOptions{ |
| 24 | IO: f.IOStreams, |
| 25 | Config: f.Config, |
| 26 | HTTPClient: f.HttpClient, |
| 27 | } |
| 28 | |
| 29 | cmd := &cobra.Command{ |
| 30 | Use: "list", |
| 31 | Short: "Lists GPG keys in your GitHub account", |
| 32 | Aliases: []string{"ls"}, |
| 33 | Args: cobra.ExactArgs(0), |
| 34 | RunE: func(cmd *cobra.Command, args []string) error { |
| 35 | if runF != nil { |
| 36 | return runF(opts) |
| 37 | } |
| 38 | return listRun(opts) |
| 39 | }, |
| 40 | } |
| 41 | |
| 42 | return cmd |
| 43 | } |
| 44 | |
| 45 | func listRun(opts *ListOptions) error { |
| 46 | apiClient, err := opts.HTTPClient() |