MCPcopy Index your code
hub / github.com/coder/coder / formatExternalAgent

Function formatExternalAgent

enterprise/cli/externalworkspaces.go:253–270  ·  view source on GitHub ↗

formatExternalAgent formats the instructions for an external agent.

(workspaceName string, externalAgents []externalAgent)

Source from the content-addressed store, hash-verified

251
252// formatExternalAgent formats the instructions for an external agent.
253func formatExternalAgent(workspaceName string, externalAgents []externalAgent) string {
254 var output strings.Builder
255 _, _ = output.WriteString(fmt.Sprintf("\nPlease run the following command to attach external agent to the workspace %s:\n\n", cliui.Keyword(workspaceName)))
256
257 for i, agent := range externalAgents {
258 if len(externalAgents) > 1 {
259 _, _ = output.WriteString(fmt.Sprintf("For agent %s:\n", cliui.Keyword(agent.AgentName)))
260 }
261
262 _, _ = output.WriteString(fmt.Sprintf("%s\n", pretty.Sprint(cliui.DefaultStyles.Code, agent.InitScript)))
263
264 if i < len(externalAgents)-1 {
265 _, _ = output.WriteString("\n")
266 }
267 }
268
269 return output.String()
270}

Calls 3

KeywordFunction · 0.92
WriteStringMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected