gabotechs / dep-tree

Tool for helping developers keep their code bases clean and decoupled. It allows visualising a code base complexity using a 3d force-directed graph of files and the dependencies between them.
https://github.com/gabotechs/dep-tree
MIT License
1.53k stars 38 forks source link

Error: exec: "xdg-open": executable file not found in $PATH #58

Closed dinhani closed 9 months ago

dinhani commented 10 months ago

In WSL2, I don't have a GUI environment or browser, so it fails when trying to show the generated HTML.

I found out I can specify the --no-browser-open flag to bypass this behavior, but it only prints the HTML path in the temp folder because the file is always saved.

Maybe it always should print the HTML path, no matter if the flag is specified or not?

gabotechs commented 10 months ago

If the open succeeded, there's no much value in printing the path, but if the open failed, it would be wise to print the path instead, it can redirect the open error to stderr and the HTML path to stdout so that users can use it.

it only prints the HTML path in the temp folder because the file is always saved.

I though about this while doing it, and it might be wiser to redirect the the HTML output itself to stdout rather than automatically dump it in a file. Something like:

dep-tree my/project/entrypoint --no-browser-open > ~/my-html-file.html

That way users have a more flexible way of dumping the file wherever they want to.