Something went wrong. Try again.
Measure the width of text in the terminal and build simple layouts!
Something went wrong. Try again.
920 B · 40 lines
at main
1234567891011121314151617181920212223242526272829303132333435363738394041import gleam/ioimport string_width.{Size}
fn to_indent(str) { case str { // if it is a list, indent by 2 "- " <> _ -> " " // if it is a blockquote, prepend another blockquote marker "> " <> _ -> "> " // else, don't indent (like limit) _ -> "" }}
pub fn main() { // Girly Girl Productions - 10 drunk cigarettes let lyrics = "> Getting girls rich, yeah, that's a part of my plan.> And I could name 10 things us girls need, before we ever need a man:
- One new vape, two lines of coke- Three drinks from the bar, four more lines of coke- Five Guys fries, six hits from my blunt- Seven more lines of coke, eight pairs of shoes- Nine BB belts, and 10 drunk cigarettes. "
lyrics |> string_width.soft_wrap( to: Size(rows: 24, columns: 34), ellipsis: "...", to_indent:, ) |> io.println
io.println("Hello\u{ad}World")
io.println("Hello\u{ad}\nWorld")}