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

Expose --graph/--node/--edge CLI options on dependencies command for injecting GraphViz attributes #349

Open
regexident opened this issue Nov 25, 2024 · 2 comments

Comments

@regexident
Copy link
Owner

I've thought about exposing more graphviz settings (i.e. shape, splines, …) as CLI options but ended up not doing it as one would quickly accumulate a massive amount of options (each with their own reasonable rational on why it should be included), while making it hard to see the forest for the trees, when reading --help. That said I too would like to be able to inject configurations into the generated .dot files without having to manually edit the output afterwards.

Maybe having generalized CLI options for the dependencies command for graph/node/edge default attributes that accept a comma-separated list of key-value pairs would be an acceptable compromise though:

  • --graph "rankdir='LR', …"
  • --node "shape='box', …"
  • --edge "weight=2, …"
@wduminy
Copy link
Contributor

wduminy commented Nov 30, 2024

I agree, reproducing these settings in cargo-modules is not needed.

They can be passed on when you generate the dot file. For example:

cargo-modules dependencies -p rc-bot --no-externs  --no-types --no-traits --no-fns | dot -Gsplines=curved -Tsvg -omodules.svg

Maybe a link to the command line help in your readme would prevent people from asking for these kind of features :-).
https://graphviz.org/doc/info/command.html

@regexident
Copy link
Owner Author

I agree, reproducing these settings in cargo-modules is not needed.

One argument for at least providing generalized --graph/--node/--edge CLI options that I'd see is that you might want to save the .dot file rather than its rendered view, or you might be using a visualizer, such as a VSCode extension, which doesn't allow for passing arguments to dot. But yeah, the cargo modules dependencies … | dot -G… approach should probably be mentioned in the README somewhere for sure!

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

No branches or pull requests

2 participants