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