showAnnouncementBanner will write the service banner if enabled and not blank along with a blank line for spacing.
(session io.Writer, banner codersdk.BannerConfig)
| 1301 | // showAnnouncementBanner will write the service banner if enabled and not blank |
| 1302 | // along with a blank line for spacing. |
| 1303 | func 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. |
no test coverage detected