MCPcopy Create free account
hub / github.com/Chat2AnyLLM/code-agent-manager / showEditorConfig

Function showEditorConfig

internal/cli/config_cmd.go:132–172  ·  view source on GitHub ↗
(out interface{ Write(p []byte) (int, error) }, app string, scope string, args []string)

Source from the content-addressed store, hash-verified

130}
131
132func showEditorConfig(out interface{ Write(p []byte) (int, error) }, app string, scope string, args []string) error {
133 tool, ok := editorconfig.DefaultRegistry().Get(app)
134 if !ok {
135 return fmt.Errorf("Unknown app: %s", app)
136 }
137 configs := tool.LoadAll()
138 scopes := []string{"user", "project"}
139 if scope != "" {
140 scopes = []string{scope}
141 }
142 merged := map[string]string{}
143 for _, s := range scopes {
144 scoped, ok := configs[s]
145 if !ok {
146 continue
147 }
148 for k, v := range editorconfig.Flatten(scoped.Data, app) {
149 merged[k] = v
150 }
151 }
152 if len(merged) == 0 {
153 fmt.Fprintf(out, "No configuration found for %s\n", app)
154 return nil
155 }
156 keys := make([]string, 0, len(merged))
157 for k := range merged {
158 keys = append(keys, k)
159 }
160 sort.Strings(keys)
161 filter := ""
162 if len(args) == 1 {
163 filter = args[0]
164 }
165 for _, k := range keys {
166 if filter != "" && !strings.HasPrefix(k, filter) {
167 continue
168 }
169 fmt.Fprintf(out, "%s = %s\n", k, merged[k])
170 }
171 return nil
172}
173
174func (a *App) configSetCommand(state *globalState) *cobra.Command {
175 var app string

Callers 1

configShowCommandMethod · 0.85

Calls 4

DefaultRegistryFunction · 0.92
FlattenFunction · 0.92
LoadAllMethod · 0.65
GetMethod · 0.45

Tested by

no test coverage detected