MCPcopy
hub / github.com/cli/cli / NewCmdConfigList

Function NewCmdConfigList

pkg/cmd/config/list/list.go:20–43  ·  view source on GitHub ↗
(f *cmdutil.Factory, runF func(*ListOptions) error)

Source from the content-addressed store, hash-verified

18}
19
20func NewCmdConfigList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.Command {
21 opts := &ListOptions{
22 IO: f.IOStreams,
23 Config: f.Config,
24 }
25
26 cmd := &cobra.Command{
27 Use: "list",
28 Short: "Print a list of configuration keys and values",
29 Aliases: []string{"ls"},
30 Args: cobra.ExactArgs(0),
31 RunE: func(cmd *cobra.Command, args []string) error {
32 if runF != nil {
33 return runF(opts)
34 }
35
36 return listRun(opts)
37 },
38 }
39
40 cmd.Flags().StringVarP(&opts.Hostname, "host", "h", "", "Get per-host configuration")
41
42 return cmd
43}
44
45func listRun(opts *ListOptions) error {
46 cfg, err := opts.Config()

Callers 1

TestNewCmdConfigListFunction · 0.85

Calls 1

listRunFunction · 0.70

Tested by 1

TestNewCmdConfigListFunction · 0.68