| 498 | } |
| 499 | |
| 500 | func renderTable(io *iostreams.IOStreams, skills []listedSkill) error { |
| 501 | table := tableprinter.New(io, tableprinter.WithHeader("Name", "Agent", "Scope", "Source")) |
| 502 | |
| 503 | for _, skill := range skills { |
| 504 | table.AddField(sanitizeForTerminal(skill.skillName)) |
| 505 | table.AddField(formatAgentHosts(skill.agentHostIDs)) |
| 506 | table.AddField(displayOrDash(skill.scope)) |
| 507 | table.AddField(displayOrDash(sanitizeForTerminal(skill.source))) |
| 508 | table.EndRow() |
| 509 | } |
| 510 | |
| 511 | return table.Render() |
| 512 | } |
| 513 | |
| 514 | // sanitizeForTerminal replaces ASCII control characters in s with inert |
| 515 | // caret-style stand-ins so frontmatter values cannot inject terminal escapes. |