class Cowsay {

static say(message) {

var lines = message.split("\n")

var maxWidth = 0

// Find the longest line to determine the bubble width

for (line in lines) {

if (line.count > maxWidth) maxWidth = line.count

}

var top = " " + ("_" * (maxWidth + 2))

var bottom = " " + ("-" * (maxWidth + 2))

System.print(top)

if (lines.count == 1) {

System.print("< %(lines[0]) >")

} else {

for (i in 0...lines.count) {

var line = lines[i]

var padding = " " * (maxWidth - line.count)

var border = ""

if (i == 0) {

border = "/ "

padding = padding + " \\"

} else if (i == lines.count - 1) {

border = "\\ "

padding = padding + " /"

} else {

border = "| "

padding = padding + " |"

}

System.print(border + line + padding)

}

}

System.print(bottom)

System.print(" \\ ^__^")

System.print(" \\ (oo)\\_______")

System.print(" (__)\\ )\\/\\")

System.print(" ||----w |")

System.print(" || ||")

}

}

// Test it out

Cowsay.say("wow i like wren")

Proxied content from gemini://dillpickles.flounder.online/code.gmi (external content)

Gemini request details:

Original URL
gemini://dillpickles.flounder.online/code.gmi
Status code
Success
Meta
text/gemini
Proxied by
kineto

Be advised that no attempt was made to verify the remote SSL certificate.