Live data from Hacker News

Show HN: I wrote a program to convert lines of text into trees

github.com

11–20 of 58 posts

Re: Show HN: I wrote a program to convert lines of text into trees

#12
Awesome. You really nailed it. In my experience the output for spreadsheets turns out to be key so good job highlighting that (https://github.com/birchb1024/frangipanni#output-for-spreads...).

One suggestion: it may help to generalize the newline as the node separator. You may already be doing this (my go is rusty) but instead of https://github.com/birchb1024/frangipanni/blob/7543b4ee15ae7... be able to override the "newline" as the node separator, like you've done with the "spacer" param.

What do you do when the same line is encountered?

Re: Show HN: I wrote a program to convert lines of text into trees

#13
Neat. I'll add this to my toolbox.

Somewhat unrelated: I discovered some time ago that the column command (from util-linux) can print trees of hierarchical data (up to 2 levels deep).

From the man page:

  $ echo -e '1 0 A\n2 1 AA\n3 1 AB\n4 2 AAA\n5 2 AAB' | column --tree-id 1 --tree-parent 2 --tree 3
  1  0  A
  2  1  |-AA
  4  2  | |-AAA
  5  2  | `-AAB
  3  1  `-AB
column(1): https://github.com/karelzak/util-linux/blob/master/text-util...

Re: Show HN: I wrote a program to convert lines of text into trees

#15

I've been thinking about making something like this for a while, this is great! I always thought it was weird that "do one thing and one thing well" stopped short of dealing with tree representations on the commandline.

What do you mean? The only reason this didn't exist is nobody did it yet. It doesn't contradict "do one thing and do it well".

Re: Show HN: I wrote a program to convert lines of text into trees

#17

Maybe this is not super relevant, but my favorite hack is that any tree-like structure like this can be browsed with ncdu. Here's a gist for breaking down redis traffic by command for example: https://gist.github.com/petethepig/0f33c910fb2edad8969a5775e...

Whoa, I didn't know that! This is super useful as a general-purpose tree viewer!

For the record, the relevant commands are

    ncdu -o /tmp/files.json
and

    ncdu -f /tmp/files.json

Re: Show HN: I wrote a program to convert lines of text into trees

#19

Maybe this is not super relevant, but my favorite hack is that any tree-like structure like this can be browsed with ncdu. Here's a gist for breaking down redis traffic by command for example: https://gist.github.com/petethepig/0f33c910fb2edad8969a5775e...

Neat! Is there some documentation on the format ?
Post reply on HN