MCPcopy Create free account
hub / github.com/compozy/agh / requestedOutputFormat

Function requestedOutputFormat

internal/cli/root.go:259–277  ·  view source on GitHub ↗
(args []string)

Source from the content-addressed store, hash-verified

257}
258
259func requestedOutputFormat(args []string) OutputFormat {
260 mode := OutputHuman
261 for i := 0; i < len(args); i++ {
262 switch arg := strings.TrimSpace(args[i]); {
263 case arg == "--json":
264 mode = OutputJSON
265 case arg == "-o" || arg == "--output":
266 if i+1 < len(args) {
267 mode = OutputFormat(strings.ToLower(strings.TrimSpace(args[i+1])))
268 i++
269 }
270 case strings.HasPrefix(arg, "--output="):
271 mode = OutputFormat(strings.ToLower(strings.TrimSpace(strings.TrimPrefix(arg, "--output="))))
272 case strings.HasPrefix(arg, "-o="):
273 mode = OutputFormat(strings.ToLower(strings.TrimSpace(strings.TrimPrefix(arg, "-o="))))
274 }
275 }
276 return mode
277}
278
279func (d commandDeps) withDefaults() commandDeps {
280 d = d.withRegistryDefaults()

Calls 1

OutputFormatTypeAlias · 0.85

Tested by

no test coverage detected