Commit faf8245dca

faf8245dcabc6969535e0391370aca2752f70fab

parent: b8cd3fd9d0

Verified · cmc

cmc <hello@cleberg.net> · 2026-09-24 02:03 UTC

control: fingerprint columns and help summaries fit a narrow terminal

Ref #254

Layout: unified · split

internal/control/control.go +7 −1
@@ -352,7 +352,13 @@ func runHelp(c *Ctx, args []string) int {
352 slices.SortFunc(matched, func(a, b helpEntry) int { return strings.Compare(a.Path, b.Path) }) 352 slices.SortFunc(matched, func(a, b helpEntry) int { return strings.Compare(a.Path, b.Path) })
353 return c.emit(matched, func(w io.Writer) { 353 return c.emit(matched, func(w io.Writer) {
354 for _, e := range matched { 354 for _, e := range matched {
355 fmt.Fprintf(w, "%-24s %s\n", e.Path, e.Summary) 355 summary := e.Summary
356 if c.Term.Cols > 0 {
357 if avail := c.Term.Cols - max(cells(e.Path), 24) - 1; avail > 0 {
358 summary = clip(summary, avail)
359 }
360 }
361 fmt.Fprintf(w, "%-24s %s\n", e.Path, summary)
356 if prefix != "" { 362 if prefix != "" {
357 fmt.Fprintf(w, " %s\n", e.Usage) 363 fmt.Fprintf(w, " %s\n", e.Usage)
358 } 364 }
internal/control/deploykey.go +1 −1
@@ -100,7 +100,7 @@ func runDeployKeyList(c *Ctx, args []string) int {
100 return c.emit(ds, func(w io.Writer) { 100 return c.emit(ds, func(w io.Writer) {
101 tb := c.table(w, "FINGERPRINT", "ALGO", "MODE", "LABEL") 101 tb := c.table(w, "FINGERPRINT", "ALGO", "MODE", "LABEL")
102 for _, d := range ds { 102 for _, d := range ds {
103 tb.row(cRef(d.Fingerprint), cText(d.Algo), cState(d.Mode), cText(d.Label)) 103 tb.row(cFlex(d.Fingerprint), cText(d.Algo), cState(d.Mode), cText(d.Label))
104 } 104 }
105 tb.flush() 105 tb.flush()
106 }) 106 })
internal/control/identity.go +1 −1
@@ -85,7 +85,7 @@ func runKeysList(c *Ctx, args []string) int {
85 return c.emit(ds, func(w io.Writer) { 85 return c.emit(ds, func(w io.Writer) {
86 tb := c.table(w, "FINGERPRINT", "ALGO", "SCOPE", "LABEL") 86 tb := c.table(w, "FINGERPRINT", "ALGO", "SCOPE", "LABEL")
87 for _, d := range ds { 87 for _, d := range ds {
88 tb.row(cRef(d.Fingerprint), cText(d.Algo), cState(d.Scope), cText(d.Label)) 88 tb.row(cFlex(d.Fingerprint), cText(d.Algo), cState(d.Scope), cText(d.Label))
89 } 89 }
90 tb.flush() 90 tb.flush()
91 }) 91 })