Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit b5fb553

Browse files
committed
Update README with more documentation for CLI subcommands
Document --module-name option for generate subcommand
1 parent 869be1a commit b5fb553

File tree

1 file changed

+56
-4
lines changed

1 file changed

+56
-4
lines changed

README.md

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,43 @@ $ make install
4444

4545
### Usage
4646

47-
`swift-doc` takes one or more paths and enumerates them recursively,
47+
OVERVIEW: A utility for generating documentation for Swift code.
48+
49+
USAGE: swift-doc <subcommand>
50+
51+
OPTIONS:
52+
-h, --help Show help information.
53+
54+
SUBCOMMANDS:
55+
generate Generates Swift documentation
56+
coverage Generates documentation coverage statistics for Swift
57+
files
58+
diagram Generates diagram of Swift symbol relationships
59+
60+
#### swift-doc generate
61+
62+
OVERVIEW: Generates Swift documentation
63+
64+
USAGE: swift-doc generate [<inputs> ...] --module-name <module-name> [--output <output>] [--format <format>]
65+
66+
ARGUMENTS:
67+
<inputs> One or more paths to Swift files
68+
69+
OPTIONS:
70+
-n, --module-name <module-name>
71+
The name of the module
72+
-o, --output <output> The path for generated output (default:
73+
.build/documentation)
74+
-f, --format <format> The output format (default: commonmark)
75+
-h, --help Show help information.
76+
77+
The `generate` subcommand
78+
takes one or more paths and enumerates them recursively,
4879
collecting all Swift files into a single "module"
4980
and generating documentation accordingly.
5081

5182
```terminal
52-
$ swift doc generate path/to/SwiftProject/Sources
83+
$ swift doc generate path/to/SwiftProject/Sources --module-name SwiftProject
5384
$ tree .build/documentation
5485
$ documentation/
5586
├── Home
@@ -64,21 +95,32 @@ in CommonMark / GitHub Uncyclo format,
6495
but you can change that with the `--output` and `--format` option flags.
6596

6697
```terminal
67-
$ swift doc generate path/to/SwiftProject/Sources --output Documentation --format html
98+
$ swift doc generate path/to/SwiftProject/Sources --module-name SwiftProject --output Documentation --format html
6899
$ Documentation/
69100
├── (...)
70101
└── index.html
71102
```
72103

73104
#### swift-doc coverage
74105

106+
OVERVIEW: Generates documentation coverage statistics for Swift files
107+
108+
USAGE: swift-doc coverage [<inputs> ...] [--output <output>]
109+
110+
ARGUMENTS:
111+
<inputs> One or more paths to Swift files
112+
113+
OPTIONS:
114+
-o, --output <output> The path for generated report
115+
-h, --help Show help information.
116+
75117
The `coverage` subcommand
76118
generates documentation coverage statistics for Swift files.
77119

78120
```terminal
79121
$ git clone https://github.com/SwiftDocOrg/SwiftSemantics.git
80122
81-
$ swift run swift-doc coverage SwiftSemantics/Sources/ --output "dcov.json"
123+
$ swift run swift-doc coverage SwiftSemantics/Sources --output "dcov.json"
82124
$ cat dcov.json | jq ".data.totals"
83125
{
84126
"count": 207,
@@ -110,6 +152,16 @@ please reach out by [opening an Issue][open an issue]!
110152

111153
#### swift-doc diagram
112154

155+
OVERVIEW: Generates diagram of Swift symbol relationships
156+
157+
USAGE: swift-doc diagram [<inputs> ...]
158+
159+
ARGUMENTS:
160+
<inputs> One or more paths to Swift files
161+
162+
OPTIONS:
163+
-h, --help Show help information.
164+
113165
The `diagram` subcommand
114166
generates a graph of APIs in [DOT format][dot]
115167
that can be rendered by [GraphViz][graphviz] into a diagram.

0 commit comments

Comments
 (0)