Skip to content

Commit ce415df

Browse files
committed
update docs
1 parent ea96def commit ce415df

File tree

2 files changed

+49
-3
lines changed

2 files changed

+49
-3
lines changed

README.md

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ The goal of this project is to provide a visual overview of a Go project using a
44

55
## Usage
66

7+
### `go-code-tree`
8+
79
```
810
go-code-tree -h
911
Usage of go-code-tree:
@@ -17,22 +19,52 @@ Usage of go-code-tree:
1719
Show third-party imports
1820
```
1921

20-
### Color references
22+
#### Color references
2123

2224
* Third party dependencies have a light brown/subtle orange tint (burlywood and seashell), which is the default color for each node.
2325
* Go code have a greenish tint (seagreen and mintcream)
2426
* Dependencies/directories have a bright orange/yellow tint (orange and lightyellow)
2527

2628
Refer to the [Example](#example) for a clear picture.
2729

30+
### `go-code-tree-fn`
31+
32+
```
33+
go-code-tree-fn -h
34+
Usage of go-code-tree-fn:
35+
-dir string
36+
Directory of the Go project to scan code (default "./")
37+
-mocks
38+
Scan mock files
39+
-tests
40+
Scan test files
41+
```
42+
#### Color references
43+
44+
* Directories have a light bright orange/yellow tint (orange and lightyellow)
45+
* Go code have a greenish tint (seagreen and mintcream)
46+
* Functions (func, methods and constructors) have a blueish tint (dodgerblue4 and aliceblue)
47+
48+
Refer to the [Example](#example) for a clear picture.
49+
2850
## Build
2951

52+
### `go-code-tree-fn`
53+
3054
```
31-
go build -ldflags "-s -w" -o go-code-tree .
55+
go build -ldflags "-s -w" -o go-code-tree cmd/go-code-tree-imp/main.go
56+
```
57+
58+
### `go-code-tree-fn`
59+
60+
```
61+
go build -ldflags "-s -w" -o go-code-tree-fn cmd/go-code-tree-fn/main.go
3262
```
3363

3464
## Example
3565

66+
### `go-code-tree`
67+
3668
When running the script allowing third party dependencies (see [Suggested dependencies](#suggested-dependencies)):
3769
```
3870
$ go-code-tree -dir go-code-tree -third | dot -Tpng -ogct.gv.png
@@ -42,11 +74,25 @@ It'll generate this diagram:
4274

4375
![](media/gct.gv.png)
4476

77+
78+
### `go-code-tree-fn`
79+
80+
When running the script with no args (see [Suggested dependencies](#suggested-dependencies)):
81+
```
82+
$ go-code-tree-fn -dir go-code-tree | dot -Tpng -ogct.gv.png
83+
```
84+
85+
It'll generate this diagram:
86+
87+
![](media/gctf.gv.png)
88+
89+
> Note: In this diagram, you'll see that `go-code-tree-imp` and `go-code-tree-fn` point to the same file, which might not seem ok but this is the default behavior in graphviz when creating diagrams with nodes with similar name.
90+
4591
## Suggested dependencies
4692

4793
* [Graphviz](https://graphviz.org/)
4894

49-
It's not required to have it installed to use this tool, because `go-code-tree` only prints diagrams, but it's useful to have `graphviz` installed to _see_ the diagram.
95+
It's not required to have it installed to use this tool, because `go-code-tree{,-fn}` only prints diagrams, but it's useful to have `graphviz` installed to _see_ the diagram.
5096

5197
### macOS
5298

media/gctf.gv.png

139 KB
Loading

0 commit comments

Comments
 (0)