regexident / cargo-modules

Visualize/analyze a Rust crate's internal structure
Mozilla Public License 2.0
988 stars 48 forks source link

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

Open regexident opened 4 days ago

regexident commented 4 days ago

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:

wduminy commented 4 hours ago

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