Julia aligned plain-text terminal table renderer

Julia
function render_table(headers, rows)
    all_rows = vcat([headers], rows)
    widths = [maximum(length(string(r[i])) for r in all_rows) for i in eachindex(headers)]
    pad(s, w) = string(s) * " "^(w - length(string(s)))
    line(r) = "| " * join([pad(r[i], widths[i]) for i in eachindex(headers)], " | ") * " |"
    sep = "+" * join(["-"^(w + 2) for w in widths], "+") * "+"
    out = [sep, line(headers), sep]
    for r in rows
        push!(out, line(r))
    end
    push!(out, sep)
    return join(out, "\n")
end

headers = ["name", "score", "city"]
rows = [["anna", 91, "Oslo"], ["bo", 7, "Lima"]]
println(render_table(headers, rows))