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

Commit 2512e85

Browse files
committed
Auto merge of #2 - kbknapp:v0.1.1b, r=kbknapp
V0.1.1b
2 parents 18c0697 + c679136 commit 2512e85

File tree

4 files changed

+44
-5
lines changed

4 files changed

+44
-5
lines changed

README.md

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,47 @@ $ dot -Tpng > rainbow-graph.png cargo-count.dot
1818

1919
**NOTE:** It's also possible to run `cargo graph [options] | dot [options] > [file]` instead of individual commands
2020

21-
The above commands would produce the following graph:
21+
The first command produces a GraphViz DOT file which looks like this:
2222

23-
![cargo-graph dependencies](rainbow-graph.png)
23+
```
24+
digraph dependencies {
25+
N0[label="cargo-count",shape=diamond,color=green];
26+
N1[label="ansi_term",shape=box];
27+
N2[label="clap",shape=diamond,color=green];
28+
N3[label="clippy",shape=box];
29+
N4[label="glob",shape=diamond,color=green];
30+
N5[label="regex",shape=diamond,color=green];
31+
N6[label="tabwriter",shape=diamond,color=green];
32+
N7[label="aho-corasick",shape=diamond,color=green];
33+
N8[label="memchr",shape=diamond,color=green];
34+
N9[label="bitflags",shape=diamond,color=green];
35+
N10[label="strsim",shape=diamond,color=green];
36+
N11[label="unicode-normalization",shape=diamond,color=green];
37+
N12[label="libc",shape=diamond,color=green];
38+
N13[label="regex-syntax",shape=diamond,color=green];
39+
N14[label="unicode-width",shape=diamond,color=green];
40+
N0 -> N1[label="",style=dashed,color=red];
41+
N0 -> N2[label="",color=orange];
42+
N0 -> N3[label="",style=dashed,color=red];
43+
N0 -> N4[label="",color=orange];
44+
N0 -> N5[label="",color=orange];
45+
N0 -> N6[label="",color=orange];
46+
N7 -> N8[label="",color=orange];
47+
N2 -> N1[label="",style=dashed,color=red];
48+
N2 -> N9[label="",color=orange];
49+
N2 -> N10[label="",color=orange];
50+
N3 -> N11[label="",color=orange];
51+
N8 -> N12[label="",color=orange];
52+
N5 -> N7[label="",color=orange];
53+
N5 -> N8[label="",color=orange];
54+
N5 -> N13[label="",color=orange];
55+
N6 -> N14[label="",color=orange];
56+
}
57+
```
58+
59+
The second command produces a PNG image of the graph which looks like:
60+
61+
![cargo-count dependencies](rainbow-graph.png)
2462

2563
Now, *why* someone would do that to a graph is a different story...but it's possible :)
2664

cargo-graph.png

38.9 KB
Loading

rainbow-graph.png

61.9 KB
Loading

src/main.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,11 @@
122122
//! ```ignore
123123
//! USAGE:
124124
//! cargo graph [FLAGS] [OPTIONS]
125-
//!
125+
//!
126126
//! FLAGS:
127127
//! -h, --help Prints help information
128128
//! -V, --version Prints version information
129-
//!
129+
//!
130130
//! OPTIONS:
131131
//! --build-color <COLOR> Color for regular deps (Defaults to 'black')
132132
//! [values: blue black yellow purple green red white orange]
@@ -337,9 +337,10 @@ fn parse_cli<'a, 'b>() -> ArgMatches<'a, 'b> {
337337
}
338338

339339
fn main() {
340+
debugln!("parsing cli...");
340341
let m = parse_cli();
341342

342-
if let Some(m) = m.subcommand_matches("dot") {
343+
if let Some(m) = m.subcommand_matches("graph") {
343344
let cfg = Config::from_matches(m).unwrap_or_else(|e| e.exit());
344345
debugln!("cfg={:#?}", cfg);
345346
if let Err(e) = execute(cfg) {

0 commit comments

Comments
 (0)