(args string)
| 310 | } |
| 311 | |
| 312 | func cmdDebug(args string) { |
| 313 | parts := strings.Fields(args) |
| 314 | verb := "" |
| 315 | rest := "" |
| 316 | if len(parts) > 0 { |
| 317 | verb = strings.ToLower(parts[0]) |
| 318 | } |
| 319 | if len(parts) > 1 { |
| 320 | rest = parts[1] |
| 321 | } |
| 322 | |
| 323 | switch verb { |
| 324 | case "": |
| 325 | debug.SetEnabled(!debug.Enabled()) |
| 326 | case "on", "true", "yes": |
| 327 | debug.SetEnabled(true) |
| 328 | case "off", "false", "no": |
| 329 | debug.SetEnabled(false) |
| 330 | case "clear": |
| 331 | debug.Clear() |
| 332 | fmt.Println(ui.Dimmed("debug log cleared")) |
| 333 | notifyDebugUI() |
| 334 | return |
| 335 | case "ls", "list": |
| 336 | cmdDebugList() |
| 337 | return |
| 338 | case "show", "dump": |
| 339 | cmdDebugShow(rest) |
| 340 | return |
| 341 | default: |
| 342 | fmt.Printf("unknown value: %s (try on/off/clear/ls/show)\n", verb) |
| 343 | return |
| 344 | } |
| 345 | state := "off" |
| 346 | if debug.Enabled() { |
| 347 | state = "on" |
| 348 | } |
| 349 | fmt.Printf("debug: %s\n", state) |
| 350 | notifyDebugUI() |
| 351 | } |
| 352 | |
| 353 | // cmdDebugList prints every event currently in the ring, one per line, with |
| 354 | // a marker for events that have an inspectable payload. |
nothing calls this directly
no test coverage detected