(f *cmdutil.Factory)
| 14 | ) |
| 15 | |
| 16 | func NewCmdConfig(f *cmdutil.Factory) *cobra.Command { |
| 17 | longDoc := strings.Builder{} |
| 18 | longDoc.WriteString("Display or change configuration settings for gh.\n\n") |
| 19 | longDoc.WriteString("Current respected settings:\n") |
| 20 | for _, co := range config.Options { |
| 21 | longDoc.WriteString(fmt.Sprintf("- `%s`: %s", co.Key, co.Description)) |
| 22 | if len(co.AllowedValues) > 0 { |
| 23 | longDoc.WriteString(fmt.Sprintf(" `{%s}`", strings.Join(co.AllowedValues, " | "))) |
| 24 | } |
| 25 | if co.DefaultValue != "" { |
| 26 | longDoc.WriteString(fmt.Sprintf(" (default `%s`)", co.DefaultValue)) |
| 27 | } |
| 28 | longDoc.WriteRune('\n') |
| 29 | } |
| 30 | |
| 31 | cmd := &cobra.Command{ |
| 32 | Use: "config <command>", |
| 33 | Short: "Manage configuration for gh", |
| 34 | Long: longDoc.String(), |
| 35 | } |
| 36 | |
| 37 | cmdutil.DisableAuthCheck(cmd) |
| 38 | |
| 39 | cmd.AddCommand(cmdGet.NewCmdConfigGet(f, nil)) |
| 40 | cmd.AddCommand(cmdSet.NewCmdConfigSet(f, nil)) |
| 41 | cmd.AddCommand(cmdList.NewCmdConfigList(f, nil)) |
| 42 | cmd.AddCommand(cmdClearCache.NewCmdConfigClearCache(f, nil)) |
| 43 | |
| 44 | return cmd |
| 45 | } |
nothing calls this directly
no test coverage detected