Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Need a ghostwriter for you?
using Pkg
using Crayons
function clean(H)
buf = IOBuffer()
for i in 1:H
print(buf, "\x1b[2K") # clear line
print(buf, "\x1b[999D\x1b[$(1)A") # rollback
end
print(buf |> take! |> String)
end
msg = """
println("Hello. I'm ごまふあざらし !(・ω・`)")
println("Nice to meet you!")
"""
function main(msg)
Base.banner()
juliaprompt = "julia> "
try
juliaprompt = Base.active_repl.interface.modes[1].prompt
catch
end
lines = split(msg, "\n", keepempty=false)
n = length(lines)
for (i, line) in enumerate(lines)
for index in collect(eachindex(line))
sleep(0.1)
print(crayon"green bold", juliaprompt)
print(crayon"reset")
println(join(line[begin:index]))
clean(1)
end
print(crayon"green bold", juliaprompt)
print(crayon"reset")
code = join(line)
println(code)
eval(Meta.parse(line))
if i != n
println()
end
end
end
main(msg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment