Rendering trees in the terminal


A little function for rendering textual trees in the terminal.

Here it is:

Here’s the sample run in the program:

\_ bar
|  \_ Bar
|  |  \_ Baaaar!
|  |_ BAR
|  \_ BaBaR
\_ baz
   \_ galook

Bigger trees with bigger depths might be hard to read, I’m thinking of using different colors for different depths to make things easier.

Stay safe everybody!

Comments? Octodon, Twitter, GitHub, Reddit, or drop me a line!