orbit icon indicating copy to clipboard operation
orbit copied to clipboard

Add JSON output for tree generation

Open jon-cohen opened this issue 7 months ago • 2 comments

Is your feature request related to a problem? Please describe. Not related to a problem, just a feature request!

Describe the solution you'd like Add JSON format for tree generation, with a flag that can be passed in to specify the format. Default would be the standard tree ASCII output

jon-cohen avatar May 23 '25 01:05 jon-cohen

Hey, thanks for opening an issue! I think I follow the premise of this idea, but may can you be a little more specific?

  • For tree generation, are you referring the tree subcommand?

  • How would one get the json output? With a new flag like so?

orbit tree --json
  • How would the JSON format look with the standard tree ASCII output? An initial idea for a JSON format for this command could be a list of entries, where each entry has a node (design unit identifier) and a list of edges (names of other design unit identifiers that are the dependencies for this design unit). Maybe some thing like this?
[
  {
    "node": "foo",
    "edges": [
      "bar"
    ]
  },
  {
    "node": "bar",
    "edges": []
  }
]

This way if a user had a separate tool that they wanted to reconstruct the design unit tree with, they can easily do so by processing this output.

chaseruskin avatar May 23 '25 01:05 chaseruskin

Hey! Thanks for the response. Here are my answers to your questions to clarify:

  • I am referring to the tree subcommand, this would be a new feature that could output json instead of ascii.

  • I think a new flag would be perfect. Originally I was thinking a new argument like --scheme or something like that, in case there are more formats that want to be added in the future. I got a start on that and basically have configurable schemes with the default being ascii.

  • I was curious about your feedback regarding the format of the json output and I think what you have there would be great! Like you said, if someone wanted to throw that json output into a tool of their choice, it could be used to make a really nice visualization of the project tree for example.

jon-cohen avatar May 23 '25 02:05 jon-cohen

Thank you for the discussion, the --json flag has now been implemented since 030803455ea57dd0d206bc1fa971a2a04be8252d and this issue will now be closed.

chaseruskin avatar Aug 28 '25 04:08 chaseruskin