Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: last tree node is a subtree #243

Closed
wants to merge 6 commits into from
Closed

Conversation

caarlos0
Copy link
Member

@caarlos0 caarlos0 commented Dec 6, 2023

this is currently resulting in

        ├── Foo
        ├── Bar
        │  ├── Qux
        │  ├── Quux
        │  │  ├── Foo
        │  │  └── Bar
        │  └── Quuux

not sure how to best fix it, though...

I think maybe the api needs be a bit different, e.g., instead of:

New("foo", New("bar", "zaz", New("aa"))

something like:

New(New("foo", "bar", New("zaz", "aa")))

This is also what I was kinda expecting: the first param is the node name, and the remaining are its children.

It would also make a bit more sense in internal semantics, as currently the children of a node can be either the next nodes or a subtree, which IMHO is the thing that should be called children.

thoughts?

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
@caarlos0
Copy link
Member Author

caarlos0 commented Feb 14, 2024

last commit:

  • fixes last node of the tree being a subtree
  • allows for a tree to have a name and children
  • fixes other bugs found
  • changes the rendering so instead of rendering per line, it renders an slice of nodes directly
  • changes New signature to take a name and an slice of children Node implementations
  • adds a StringNode type alias/Node implementation
  • renames the old StringNode to TreeNode

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
@maaslalani
Copy link
Member

We’ll need to double check that multi-line elements show up correctly, that way we can embed lists within trees, which was the reason for the tree abstraction

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
@caarlos0 caarlos0 mentioned this pull request Feb 16, 2024
@caarlos0
Copy link
Member Author

superseeded by #264

@caarlos0
Copy link
Member Author

caarlos0 commented Mar 1, 2024

closing in favor of #264

@caarlos0 caarlos0 closed this Mar 1, 2024
@caarlos0 caarlos0 deleted the tree-no-final-leaf branch March 1, 2024 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants