Skip to content

Commit fee72c5

Browse files
authored
CLI command docs (#8642)
Adds documentation into the stubs for current Swift Package commands and subcommands. This additionally marks a number of commands that are `hidden` as also `private` to prevent them from showing up in future dump commands. The process was somewhat automated, but quite manual - as the current iteration of the argument parser plugin has issues with dumping docs for executables that are expected to be run under different names (such as `swift build`, `swift run`, etc) - which Package Manager hosts, as well as dumps hidden commands, but not private commands. resolves #8643
1 parent 477466d commit fee72c5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+12775
-318
lines changed

Sources/Commands/PackageCommands/DumpCommands.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ enum ExtensionBlockSymbolBehavior: String, EnumerableFlag {
113113

114114
struct DumpPackage: AsyncSwiftCommand {
115115
static let configuration = CommandConfiguration(
116-
abstract: "Print parsed Package.swift as JSON")
116+
abstract: "Print parsed Package.swift as JSON.")
117117

118118
@OptionGroup(visibility: .hidden)
119119
var globalOptions: GlobalOptions
@@ -141,9 +141,9 @@ struct DumpPackage: AsyncSwiftCommand {
141141

142142
struct DumpPIF: AsyncSwiftCommand {
143143
// hides this command from CLI `--help` output
144-
static let configuration = CommandConfiguration(shouldDisplay: false)
144+
static let configuration = CommandConfiguration(shouldDisplay: false)
145145

146-
@OptionGroup(visibility: .hidden)
146+
@OptionGroup(visibility: .private)
147147
var globalOptions: GlobalOptions
148148

149149
@Flag(help: "Preserve the internal structure of PIF")

Sources/Commands/PackageCommands/Format.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ extension SwiftPackageCommand {
2727
static let configuration = CommandConfiguration(
2828
commandName: "_format", shouldDisplay: false)
2929

30-
@OptionGroup(visibility: .hidden)
30+
@OptionGroup(visibility: .private)
3131
var globalOptions: GlobalOptions
3232

3333
@Argument(parsing: .captureForPassthrough,

Sources/Commands/PackageCommands/Resolve.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ extension SwiftPackageCommand {
7272
struct Fetch: AsyncSwiftCommand {
7373
static let configuration = CommandConfiguration(shouldDisplay: false)
7474

75-
@OptionGroup(visibility: .hidden)
75+
@OptionGroup(visibility: .private)
7676
var globalOptions: GlobalOptions
7777

7878
@OptionGroup()

Sources/Commands/PackageCommands/SwiftPackageCommand.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ extension SwiftPackageCommand {
9595
shouldDisplay: false
9696
)
9797

98-
@OptionGroup(visibility: .hidden)
98+
@OptionGroup(visibility: .private)
9999
var globalOptions: GlobalOptions
100100

101101
@OptionGroup()

Sources/PackageManagerDocs/Documentation.docc/Package/PackageAddDependency.md

Lines changed: 287 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,296 @@
11
# swift package add-dependency
22

3-
Add a package dependency to the manifest.
4-
53
@Metadata {
64
@PageImage(purpose: icon, source: command-icon)
75
}
86

9-
## Overview
7+
Add a package dependency to the manifest.
8+
9+
```
10+
package add-dependency <dependency> [--package-path=<package-path>] [--cache-path=<cache-path>] [--config-path=<config-path>] [--security-path=<security-path>] [--scratch-path=<scratch-path>] [--swift-sdks-path=<swift-sdks-path>] [--toolset=<toolset>...] [--pkg-config-path=<pkg-config-path>...] [--enable-dependency-cache|disable-dependency-cache] [--enable-build-manifest-caching|disable-build-manifest-caching] [--manifest-cache=<manifest-cache>] [--enable-experimental-prebuilts|disable-experimental-prebuilts] [--verbose] [--very-verbose|vv] [--quiet] [--color-diagnostics|no-color-diagnostics] [--disable-sandbox] [--netrc] [--enable-netrc|disable-netrc] [--netrc-file=<netrc-file>] [--enable-keychain|disable-keychain] [--resolver-fingerprint-checking=<resolver-fingerprint-checking>] [--resolver-signing-entity-checking=<resolver-signing-entity-checking>] [--enable-signature-validation|disable-signature-validation] [--enable-prefetching|disable-prefetching] [--force-resolved-versions|disable-automatic-resolution|only-use-versions-from-resolved-file] [--skip-update] [--disable-scm-to-registry-transformation] [--use-registry-identity-for-scm] [--replace-scm-with-registry] [--default-registry-url=<default-registry-url>] [--configuration=<configuration>] [--=<Xcc>...] [--=<Xswiftc>...] [--=<Xlinker>...] [--=<Xcxx>...] [--triple=<triple>] [--sdk=<sdk>] [--toolchain=<toolchain>] [--swift-sdk=<swift-sdk>] [--sanitize=<sanitize>...] [--auto-index-store|enable-index-store|disable-index-store] [--enable-parseable-module-interfaces] [--jobs=<jobs>] [--use-integrated-swift-driver] [--explicit-target-dependency-import-check=<explicit-target-dependency-import-check>] [--experimental-explicit-module-build] [--build-system=<build-system>] [--=<debug-info-format>] [--enable-dead-strip|disable-dead-strip] [--disable-local-rpath] [--exact=<exact>] [--revision=<revision>] [--branch=<branch>] [--from=<from>] [--up-to-next-minor-from=<up-to-next-minor-from>] [--to=<to>] [--type=<type>] [--version] [--help]
11+
```
12+
13+
- term **dependency:**
14+
15+
*The URL or directory of the package to add.*
16+
17+
18+
- term **--package-path=\<package-path\>:**
19+
20+
*Specify the package path to operate on (default current directory). This changes the working directory before any other operation.*
21+
22+
23+
- term **--cache-path=\<cache-path\>:**
24+
25+
*Specify the shared cache directory path.*
26+
27+
28+
- term **--config-path=\<config-path\>:**
29+
30+
*Specify the shared configuration directory path.*
31+
32+
33+
- term **--security-path=\<security-path\>:**
34+
35+
*Specify the shared security directory path.*
36+
37+
38+
- term **--scratch-path=\<scratch-path\>:**
39+
40+
*Specify a custom scratch directory path. (default .build)*
41+
42+
43+
- term **--swift-sdks-path=\<swift-sdks-path\>:**
44+
45+
*Path to the directory containing installed Swift SDKs.*
46+
47+
48+
- term **--toolset=\<toolset\>:**
49+
50+
*Specify a toolset JSON file to use when building for the target platform. Use the option multiple times to specify more than one toolset. Toolsets will be merged in the order they're specified into a single final toolset for the current build.*
51+
52+
53+
- term **--pkg-config-path=\<pkg-config-path\>:**
54+
55+
*Specify alternative path to search for pkg-config `.pc` files. Use the option multiple times to
56+
specify more than one path.*
57+
58+
59+
- term **--enable-dependency-cache|disable-dependency-cache:**
60+
61+
*Use a shared cache when fetching dependencies.*
62+
63+
64+
- term **--enable-build-manifest-caching|disable-build-manifest-caching:**
65+
66+
67+
- term **--manifest-cache=\<manifest-cache\>:**
68+
69+
*Caching mode of Package.swift manifests. Valid values are: (shared: shared cache, local: package's build directory, none: disabled)*
70+
71+
72+
- term **--enable-experimental-prebuilts|disable-experimental-prebuilts:**
73+
74+
*Whether to use prebuilt swift-syntax libraries for macros.*
75+
76+
77+
- term **--verbose:**
78+
79+
*Increase verbosity to include informational output.*
80+
81+
82+
- term **--very-verbose|vv:**
83+
84+
*Increase verbosity to include debug output.*
85+
86+
87+
- term **--quiet:**
88+
89+
*Decrease verbosity to only include error output.*
90+
91+
92+
- term **--color-diagnostics|no-color-diagnostics:**
93+
94+
*Enables or disables color diagnostics when printing to a TTY.
95+
By default, color diagnostics are enabled when connected to a TTY and disabled otherwise.*
96+
97+
98+
- term **--disable-sandbox:**
99+
100+
*Disable using the sandbox when executing subprocesses.*
101+
102+
103+
- term **--netrc:**
104+
105+
*Use netrc file even in cases where other credential stores are preferred.*
106+
107+
108+
- term **--enable-netrc|disable-netrc:**
109+
110+
*Load credentials from a netrc file.*
111+
112+
113+
- term **--netrc-file=\<netrc-file\>:**
114+
115+
*Specify the netrc file path.*
116+
117+
118+
- term **--enable-keychain|disable-keychain:**
119+
120+
*Search credentials in macOS keychain.*
121+
122+
123+
- term **--resolver-fingerprint-checking=\<resolver-fingerprint-checking\>:**
124+
125+
126+
- term **--resolver-signing-entity-checking=\<resolver-signing-entity-checking\>:**
127+
128+
129+
- term **--enable-signature-validation|disable-signature-validation:**
130+
131+
*Validate signature of a signed package release downloaded from registry.*
132+
133+
134+
- term **--enable-prefetching|disable-prefetching:**
135+
136+
137+
- term **--force-resolved-versions|disable-automatic-resolution|only-use-versions-from-resolved-file:**
138+
139+
*Only use versions from the Package.resolved file and fail resolution if it is out-of-date.*
140+
141+
142+
- term **--skip-update:**
143+
144+
*Skip updating dependencies from their remote during a resolution.*
145+
146+
147+
- term **--disable-scm-to-registry-transformation:**
148+
149+
*Disable source control to registry transformation.*
150+
151+
152+
- term **--use-registry-identity-for-scm:**
153+
154+
*Look up source control dependencies in the registry and use their registry identity when possible to help deduplicate across the two origins.*
155+
156+
157+
- term **--replace-scm-with-registry:**
158+
159+
*Look up source control dependencies in the registry and use the registry to retrieve them instead of source control when possible.*
160+
161+
162+
- term **--default-registry-url=\<default-registry-url\>:**
163+
164+
*Default registry URL to use, instead of the registries.json configuration file.*
165+
166+
167+
- term **--configuration=\<configuration\>:**
168+
169+
*Build with configuration*
170+
171+
172+
- term **--=\<Xcc\>:**
173+
174+
*Pass flag through to all C compiler invocations.*
175+
176+
177+
- term **--=\<Xswiftc\>:**
178+
179+
*Pass flag through to all Swift compiler invocations.*
180+
181+
182+
- term **--=\<Xlinker\>:**
183+
184+
*Pass flag through to all linker invocations.*
185+
186+
187+
- term **--=\<Xcxx\>:**
188+
189+
*Pass flag through to all C++ compiler invocations.*
190+
191+
192+
- term **--triple=\<triple\>:**
193+
194+
195+
- term **--sdk=\<sdk\>:**
196+
197+
198+
- term **--toolchain=\<toolchain\>:**
199+
200+
201+
- term **--swift-sdk=\<swift-sdk\>:**
202+
203+
*Filter for selecting a specific Swift SDK to build with.*
204+
205+
206+
- term **--sanitize=\<sanitize\>:**
207+
208+
*Turn on runtime checks for erroneous behavior, possible values: address, thread, undefined, scudo.*
209+
210+
211+
- term **--auto-index-store|enable-index-store|disable-index-store:**
212+
213+
*Enable or disable indexing-while-building feature.*
214+
215+
216+
- term **--enable-parseable-module-interfaces:**
217+
218+
219+
- term **--jobs=\<jobs\>:**
220+
221+
*The number of jobs to spawn in parallel during the build process.*
222+
223+
224+
- term **--use-integrated-swift-driver:**
225+
226+
227+
- term **--explicit-target-dependency-import-check=\<explicit-target-dependency-import-check\>:**
228+
229+
*A flag that indicates this build should check whether targets only import their explicitly-declared dependencies.*
230+
231+
232+
- term **--experimental-explicit-module-build:**
233+
234+
235+
- term **--build-system=\<build-system\>:**
236+
237+
238+
- term **--=\<debug-info-format\>:**
239+
240+
*The Debug Information Format to use.*
241+
242+
243+
- term **--enable-dead-strip|disable-dead-strip:**
244+
245+
*Disable/enable dead code stripping by the linker.*
246+
247+
248+
- term **--disable-local-rpath:**
249+
250+
*Disable adding $ORIGIN/@loader_path to the rpath by default.*
251+
252+
253+
- term **--exact=\<exact\>:**
254+
255+
*The exact package version to depend on.*
256+
257+
258+
- term **--revision=\<revision\>:**
259+
260+
*The specific package revision to depend on.*
261+
262+
263+
- term **--branch=\<branch\>:**
264+
265+
*The branch of the package to depend on.*
266+
267+
268+
- term **--from=\<from\>:**
269+
270+
*The package version to depend on (up to the next major version).*
271+
272+
273+
- term **--up-to-next-minor-from=\<up-to-next-minor-from\>:**
274+
275+
*The package version to depend on (up to the next minor version).*
276+
277+
278+
- term **--to=\<to\>:**
279+
280+
*Specify upper bound on the package version range (exclusive).*
281+
282+
283+
- term **--type=\<type\>:**
284+
285+
*Specify dependency type.*
286+
287+
288+
- term **--version:**
289+
290+
*Show the version.*
291+
10292

11-
overview content here....
293+
- term **--help:**
12294

13-
### First Section
295+
*Show help information.*
14296

15-
First section content

0 commit comments

Comments
 (0)