Skip to content

Instantly share code, notes, and snippets.

@jkrumbiegel
Last active July 11, 2022 12:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkrumbiegel/32815d5b19a9c2b1e79e76dd1016fa4b to your computer and use it in GitHub Desktop.
Save jkrumbiegel/32815d5b19a9c2b1e79e76dd1016fa4b to your computer and use it in GitHub Desktop.
function with_indent_message(f, message)
s = mktemp() do path, io
redirect_stdout(f, io)
flush(io)
str = read(path, String)
if match(r"^\s*$", str) === nothing
replace(str, r"^"m => "│ ")
else
""
end
end
if isempty(s)
println("start/stop: ", message)
else
println("start: ", message)
print(s, endswith(s, "\n") ? "" : "\n")
println("stop: ", message)
end
# f()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment