MCPcopy Create free account
hub / github.com/coder/coder / showAnnouncementBanner

Function showAnnouncementBanner

agent/agentssh/agentssh.go:1303–1311  ·  view source on GitHub ↗

showAnnouncementBanner will write the service banner if enabled and not blank along with a blank line for spacing.

(session io.Writer, banner codersdk.BannerConfig)

Source from the content-addressed store, hash-verified

1301// showAnnouncementBanner will write the service banner if enabled and not blank
1302// along with a blank line for spacing.
1303func showAnnouncementBanner(session io.Writer, banner codersdk.BannerConfig) error {
1304 if banner.Enabled && banner.Message != "" {
1305 // The banner supports Markdown so we might want to parse it but Markdown is
1306 // still fairly readable in its raw form.
1307 message := strings.TrimSpace(banner.Message) + "\n\n"
1308 return writeWithCarriageReturn(strings.NewReader(message), session)
1309 }
1310 return nil
1311}
1312
1313// showMOTD will output the message of the day from
1314// the given filename to dest, if the file exists.

Callers 1

startPTYSessionMethod · 0.85

Calls 1

writeWithCarriageReturnFunction · 0.85

Tested by

no test coverage detected