返回 DeepSeek-Reasonix
output_style_view.go
根目录 / internal / cli / output_style_view.go
1 package cli
2
3 import (
4 "fmt"
5 "strings"
6
7 "reasonix/internal/outputstyle"
8 )
9
10 func renderOutputStyles(width int, styles []outputstyle.OutputStyle, active string) string {
11 var b strings.Builder
12 fmt.Fprintf(&b, "%s\n", viewHeader("output styles"))
13 for _, st := range styles {
14 scope := "builtin"
15 if !st.Builtin {
16 scope = "custom"
17 }
18 status := ""
19 if strings.EqualFold(st.Name, active) {
20 status = " " + viewStatus("active")
21 }
22 scopeText := "(" + scope + ")"
23 used := 2 + viewPadWidth(st.Name, 16) + 1 + visibleWidth(scopeText) + 2 + visibleWidth(status)
24 desc := viewCompactText(st.Description, viewBudget(width, used))
25 fmt.Fprintf(&b, " %-16s %s %s%s\n", st.Name, viewMeta(scopeText), desc, status)
26 }
27 b.WriteString(viewHint(viewCompactText("set agent.output_style in reasonix.toml to apply one (takes effect next session)", viewBudget(width, 2))))
28 return strings.TrimRight(b.String(), "\n")
29 }
30
30 lines GO