Skip to content
This repository has been archived by the owner on May 12, 2020. It is now read-only.

feat: implements links to crates.io based on the package and version … #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 74 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,37 +22,80 @@ The first command produces a GraphViz DOT file which looks like this:

```
digraph dependencies {
N0[label="cargo-count",shape=diamond,color=green];
N1[label="ansi_term",shape=box];
N2[label="clap",shape=diamond,color=green];
N3[label="clippy",shape=box];
N4[label="glob",shape=diamond,color=green];
N5[label="regex",shape=diamond,color=green];
N6[label="tabwriter",shape=diamond,color=green];
N7[label="aho-corasick",shape=diamond,color=green];
N8[label="memchr",shape=diamond,color=green];
N9[label="bitflags",shape=diamond,color=green];
N10[label="strsim",shape=diamond,color=green];
N11[label="unicode-normalization",shape=diamond,color=green];
N12[label="libc",shape=diamond,color=green];
N13[label="regex-syntax",shape=diamond,color=green];
N14[label="unicode-width",shape=diamond,color=green];
N0 -> N1[label="",style=dashed,color=red];
N0 -> N2[label="",color=orange];
N0 -> N3[label="",style=dashed,color=red];
N0 -> N4[label="",color=orange];
N0 -> N5[label="",color=orange];
N0 -> N6[label="",color=orange];
N7 -> N8[label="",color=orange];
N2 -> N1[label="",style=dashed,color=red];
N2 -> N9[label="",color=orange];
N2 -> N10[label="",color=orange];
N3 -> N11[label="",color=orange];
N8 -> N12[label="",color=orange];
N5 -> N7[label="",color=orange];
N5 -> N8[label="",color=orange];
N5 -> N13[label="",color=orange];
N6 -> N14[label="",color=orange];
N0[label="cargo-count",shape=diamond,color=green, href="https://crates.io/crates/cargo-count"];
N1[label="memchr",shape=diamond,color=green, href="https://crates.io/crates/memchr"];
N2[label="ansi_term",shape=diamond,color=green, href="https://crates.io/crates/ansi_term"];
N3[label="bitflags",shape=diamond,color=green, href="https://crates.io/crates/bitflags"];
N4[label="aho-corasick",shape=diamond,color=green, href="https://crates.io/crates/aho-corasick"];
N5[label="clap",shape=diamond,color=green, href="https://crates.io/crates/clap"];
N6[label="clippy",shape=box, href="https://crates.io/crates/clippy"];
N7[label="gitignore",shape=diamond,color=green, href="https://crates.io/crates/gitignore"];
N8[label="glob",shape=diamond,color=green, href="https://crates.io/crates/glob"];
N9[label="regex",shape=diamond,color=green, href="https://crates.io/crates/regex"];
N10[label="tabwriter",shape=diamond,color=green, href="https://crates.io/crates/tabwriter"];
N11[label="libc",shape=diamond,color=green, href="https://crates.io/crates/libc"];
N12[label="strsim",shape=diamond,color=green, href="https://crates.io/crates/strsim"];
N13[label="term_size",shape=diamond,color=green, href="https://crates.io/crates/term_size"];
N14[label="unicode-segmentation",shape=diamond,color=green, href="https://crates.io/crates/unicode-segmentation"];
N15[label="unicode-width",shape=diamond,color=green, href="https://crates.io/crates/unicode-width"];
N16[label="vec_map",shape=diamond,color=green, href="https://crates.io/crates/vec_map"];
N17[label="clippy_lints",shape=box, href="https://crates.io/crates/clippy_lints"];
N18[label="matches",shape=box, href="https://crates.io/crates/matches"];
N19[label="quine-mc_cluskey",shape=box, href="https://crates.io/crates/quine-mc_cluskey"];
N20[label="regex-syntax",shape=diamond,color=green, href="https://crates.io/crates/regex-syntax"];
N21[label="rustc-serialize",shape=box, href="https://crates.io/crates/rustc-serialize"];
N22[label="semver",shape=box, href="https://crates.io/crates/semver"];
N23[label="toml",shape=box, href="https://crates.io/crates/toml"];
N24[label="unicode-normalization",shape=box, href="https://crates.io/crates/unicode-normalization"];
N25[label="kernel32-sys",shape=diamond,color=green, href="https://crates.io/crates/kernel32-sys"];
N26[label="winapi",shape=diamond,color=green, href="https://crates.io/crates/winapi"];
N27[label="winapi-build",shape=diamond,color=green, href="https://crates.io/crates/winapi-build"];
N28[label="nom",shape=box, href="https://crates.io/crates/nom"];
N29[label="thread_local",shape=diamond,color=green, href="https://crates.io/crates/thread_local"];
N30[label="utf8-ranges",shape=diamond,color=green, href="https://crates.io/crates/utf8-ranges"];
N31[label="thread-id",shape=diamond,color=green, href="https://crates.io/crates/thread-id"];
N0 -> N2[label="",color=orange];
N0 -> N5[label="",color=orange];
N0 -> N6[label="",style=dashed,color=red];
N0 -> N7[label="",color=orange];
N0 -> N8[label="",color=orange];
N0 -> N9[label="",color=orange];
N0 -> N10[label="",color=orange];
N1 -> N11[label="",color=orange];
N4 -> N1[label="",color=orange];
N5 -> N2[label="",color=orange];
N5 -> N3[label="",color=orange];
N5 -> N11[label="",color=orange];
N5 -> N12[label="",color=orange];
N5 -> N13[label="",color=orange];
N5 -> N14[label="",color=orange];
N5 -> N15[label="",color=orange];
N5 -> N16[label="",color=orange];
N6 -> N17[label="",style=dashed,color=red];
N7 -> N8[label="",color=orange];
N9 -> N1[label="",color=orange];
N9 -> N4[label="",color=orange];
N9 -> N20[label="",color=orange];
N9 -> N29[label="",color=orange];
N9 -> N30[label="",color=orange];
N10 -> N15[label="",color=orange];
N13 -> N11[label="",color=orange];
N13 -> N25[label="",color=orange];
N13 -> N26[label="",color=orange];
N17 -> N18[label="",style=dashed,color=red];
N17 -> N19[label="",style=dashed,color=red];
N17 -> N20[label="",style=dashed,color=red];
N17 -> N21[label="",style=dashed,color=red];
N17 -> N22[label="",style=dashed,color=red];
N17 -> N23[label="",style=dashed,color=red];
N17 -> N24[label="",style=dashed,color=red];
N22 -> N28[label="",style=dashed,color=red];
N23 -> N21[label="",style=dashed,color=red];
N25 -> N26[label="",color=orange];
N25 -> N27[label="",color=orange];
N29 -> N31[label="",color=orange];
N31 -> N11[label="",color=orange];
N31 -> N25[label="",color=orange];
}
```

Expand Down
7 changes: 4 additions & 3 deletions src/dep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,11 @@ impl ResolvedDep {
} else {
self.name.clone()
};
let href = format!(", href=\"https://crates.io/crates/{}\"", name.replace(" v", "/"));
match self.kind() {
DepKind::Dev => writeln!(w, "[label={:?}{}];", name, c.dev_style),
DepKind::Optional => writeln!(w, "[label={:?}{}];", name, c.optional_style),
_ => writeln!(w, "[label={:?}{}];", name, c.build_style),
DepKind::Dev => writeln!(w, "[label={:?}{}{}];", name, c.dev_style, href),
DepKind::Optional => writeln!(w, "[label={:?}{}{}];", name, c.optional_style, href),
_ => writeln!(w, "[label={:?}{}{}];", name, c.build_style, href),
}
}
}