(state *globalState)
| 99 | } |
| 100 | |
| 101 | func (a *App) configShowCommand(state *globalState) *cobra.Command { |
| 102 | var app string |
| 103 | var scope string |
| 104 | cmd := &cobra.Command{ |
| 105 | Use: "show [KEY]", |
| 106 | Short: "Show configuration", |
| 107 | Args: cobra.MaximumNArgs(1), |
| 108 | RunE: func(cmd *cobra.Command, args []string) error { |
| 109 | out := cmd.OutOrStdout() |
| 110 | // Editor mode wins when --app is explicit. |
| 111 | if app != "" { |
| 112 | return showEditorConfig(out, app, scope, args) |
| 113 | } |
| 114 | // Legacy CAM-config mode: dump the contents of --config. |
| 115 | if state.configPath != "" { |
| 116 | data, err := os.ReadFile(state.configPath) |
| 117 | if err != nil { |
| 118 | return err |
| 119 | } |
| 120 | _, err = out.Write(data) |
| 121 | return err |
| 122 | } |
| 123 | // Default to editor mode with claude as in Python. |
| 124 | return showEditorConfig(out, "claude", scope, args) |
| 125 | }, |
| 126 | } |
| 127 | cmd.Flags().StringVarP(&app, "app", "a", "", "Editor to show configuration for") |
| 128 | cmd.Flags().StringVarP(&scope, "scope", "s", "", "Filter by scope (user|project)") |
| 129 | return cmd |
| 130 | } |
| 131 | |
| 132 | func showEditorConfig(out interface{ Write(p []byte) (int, error) }, app string, scope string, args []string) error { |
| 133 | tool, ok := editorconfig.DefaultRegistry().Get(app) |
no test coverage detected