Skip to content

Commit 703f680

Browse files
Correctly document updated parameters
Co-authored-by: Sofía Rodríguez <sofia_rodriguez@apple.com>
1 parent cdbbe08 commit 703f680

File tree

3 files changed

+27
-31
lines changed

3 files changed

+27
-31
lines changed

Sources/SwiftDocCPluginUtilities/CommandLineArguments/CommandLineArguments.swift

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ public struct CommandLineArguments {
3535

3636
// MARK: Extract
3737

38-
/// Extracts the values for the command line option with the given names.
38+
/// Extracts the values for the given command line option.
3939
///
4040
/// Upon return, the arguments list no longer contains any elements that match any spelling of this command line option or its values.
4141
///
42-
/// - Parameter names: The names of a command line option.
42+
/// - Parameter option: The command line option to extract values for.
4343
/// - Returns: The extracted values for this command line option, in the order that they appear in the arguments list.
4444
public mutating func extract(_ option: CommandLineArgument.Option) -> [String] {
4545
var values = [String]()
@@ -71,13 +71,11 @@ public struct CommandLineArguments {
7171
return values.reversed() // The values are gathered in reverse order
7272
}
7373

74-
/// Extracts the values for the command line flag with the given names.
74+
/// Extracts the values for the command line flag.
7575
///
7676
/// Upon return, the arguments list no longer contains any elements that match any spelling of this command line flag.
7777
///
78-
/// - Parameters:
79-
/// - positiveNames: The positive names for a command line flag.
80-
/// - negativeNames: The negative names for this command line flag, if any.
78+
/// - Parameter flag: The command line flag to extract values for.
8179
/// - Returns: The extracted values for this command line flag.
8280
public mutating func extract(_ flag: CommandLineArgument.Flag) -> [Bool] {
8381
let positiveNames = flag.names
@@ -98,18 +96,16 @@ public struct CommandLineArguments {
9896

9997
/// Inserts a command line option into the arguments list unless it already exists.
10098
/// - Parameters:
101-
/// - argument: The command line option to insert.
102-
/// - matchOptionWithAnyValue: If `true`, an option argument will be considered a match even
99+
/// - option: The command line option to insert.
100+
/// - value: The value for this option.
103101
/// - Returns: `true` if the argument was already present in the arguments list; otherwise, `false`.
104102
@discardableResult
105103
public mutating func insertIfMissing(_ option: CommandLineArgument.Option, value: String) -> Bool {
106104
remainingOptionsOrFlags.appendIfMissing(.init(option, value: value))
107105
}
108106

109107
/// Inserts a command line flag into the arguments list unless it already exists.
110-
/// - Parameters:
111-
/// - argument: The command line flag to insert.
112-
/// - matchOptionWithAnyValue: If `true`, an option argument will be considered a match even
108+
/// - Parameter flag: The command line flag to insert.
113109
/// - Returns: `true` if the argument was already present in the arguments list; otherwise, `false`.
114110
@discardableResult
115111
public mutating func insertIfMissing(_ flag: CommandLineArgument.Flag) -> Bool {
@@ -121,10 +117,10 @@ public struct CommandLineArguments {
121117
remainingOptionsOrFlags.insert(rawArgument, at: 0)
122118
}
123119

124-
/// Inserts a command line argument into the arguments list, overriding any existing values.
120+
/// Inserts a command line option with a new value into the arguments list, overriding any existing values.
125121
/// - Parameters:
126-
/// - argument: The command line argument (flag or option) to insert.
127-
/// - newValue: The new value for this command line argument.
122+
/// - option: The command line option to insert.
123+
/// - newValue: The new value for this option.
128124
/// - Returns: `true` if the argument was already present in the arguments list; otherwise, `false`.
129125
@discardableResult
130126
public mutating func overrideOrInsert(_ option: CommandLineArgument.Option, newValue: String) -> Bool {
@@ -160,7 +156,7 @@ private extension ArraySlice<String> {
160156
}
161157
}
162158

163-
/// Checks if the slice contains the given argument (flag or argument).
159+
/// Checks if the slice contains the given argument (flag or option).
164160
func contains(_ argument: CommandLineArgument) -> Bool {
165161
let names = argument.names
166162
guard case .option(let value, .arrayOfValues) = argument.kind else {

Sources/SwiftDocCPluginUtilities/DocumentedPluginFlags/DocumentedArgument.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
// See https://swift.org/LICENSE.txt for license information
77
// See https://swift.org/CONTRIBUTORS.txt for Swift project authors
88

9-
/// A documented command-line flag for the plugin.
9+
/// A documented command-line argument for the plugin.
1010
///
11-
/// This may include some flags that the plugin forwards to the symbol graph extract tool or to DocC.
11+
/// This may include some arguments (flags or options) that the plugin forwards to the symbol graph extract tool or to DocC.
1212
struct DocumentedArgument {
1313
/// A command line argument (flag or option) that is wrapped with documentation.
1414
enum Argument {
@@ -29,10 +29,10 @@ struct DocumentedArgument {
2929
}
3030
}
3131

32-
/// A short user-facing description of this flag.
32+
/// A short user-facing description of this argument (flag or option).
3333
var abstract: String
3434

35-
/// An expanded user-facing description of this flag.
35+
/// An expanded user-facing description of this argument (flag or option).
3636
var discussion: String?
3737

3838
init(flag: CommandLineArgument.Flag, abstract: String, discussion: String? = nil) {
@@ -85,7 +85,7 @@ extension DocumentedArgument {
8585
// MARK: Symbol graph flags
8686

8787
extension DocumentedArgument {
88-
/// Include or exclude extended types in documentation archives.
88+
/// A plugin feature flag to either include or exclude extended types in documentation archives.
8989
///
9090
/// Enables/disables the extension block symbol format when calling the dump symbol graph API.
9191
///
@@ -100,7 +100,7 @@ extension DocumentedArgument {
100100
discussion: "Allows documenting symbols that a target adds to its dependencies."
101101
)
102102

103-
/// Exclude synthesized symbols from the generated documentation.
103+
/// A plugin feature flag to exclude synthesized symbols from the generated documentation.
104104
///
105105
/// `--experimental-skip-synthesized-symbols` produces a DocC archive without compiler-synthesized symbols.
106106
static let skipSynthesizedSymbols = Self(

Sources/SwiftDocCPluginUtilities/ParsedArguments.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -139,72 +139,72 @@ struct ParsedArguments {
139139
enum DocCArguments {
140140
/// A fallback value for the bundle display name, if the documentation catalog doesn't specify one or if the build has no symbol information.
141141
///
142-
/// The plugin defines this name so that it can pass a default value for older versions of `docc` which require this.
142+
/// The plugin defines this option so that it can pass a default value for older versions of `docc` which require this.
143143
static let fallbackDisplayName = CommandLineArgument.Option(
144144
preferred: "--fallback-display-name"
145145
)
146146

147147
/// A fallback value for the bundle identifier, if the documentation catalog doesn't specify one or if the build has no symbol information.
148148
///
149-
/// The plugin defines this name so that it can pass a default value for older versions of `docc` which require this.
149+
/// The plugin defines this option so that it can pass a default value for older versions of `docc` which require this.
150150
static let fallbackBundleIdentifier = CommandLineArgument.Option(
151151
preferred: "--fallback-bundle-identifier"
152152
)
153153

154154
/// A fallback value for the "module kind" display name, if the documentation catalog doesn't specify one.
155155
///
156-
/// The plugin defines this name so that it can pass a default value when building documentation for executable targets.
156+
/// The plugin defines this option so that it can pass a default value when building documentation for executable targets.
157157
static let fallbackDefaultModuleKind = CommandLineArgument.Option(
158158
preferred: "--fallback-default-module-kind"
159159
)
160160

161161
/// A directory of symbol graph files that DocC will use as input when building documentation.
162162
///
163-
/// The plugin defines this name so that it can pass a default value.
163+
/// The plugin defines this option so that it can pass a default value.
164164
static let additionalSymbolGraphDirectory = CommandLineArgument.Option(
165165
preferred: "--additional-symbol-graph-dir"
166166
)
167167

168168
/// Configures DocC to include a LMDB representation of the navigator index in the output.
169169
///
170-
/// The plugin defines this name so that it can pass this flag by default.
170+
/// The plugin defines this flag so that it can pass this flag by default.
171171
static let emitLMDBIndex = CommandLineArgument.Flag(
172172
preferred: "--emit-lmdb-index"
173173
)
174174

175175
/// The directory where DocC will write the built documentation archive.
176176
///
177-
/// The plugin defines this name so that it can intercept it and support building documentation for multiple targets within one package build command.
177+
/// The plugin defines this option so that it can intercept it and support building documentation for multiple targets within one package build command.
178178
static let outputPath = CommandLineArgument.Option(
179179
preferred: "--output-path",
180180
alternatives: ["--output-dir", "-o"]
181181
)
182182

183183
/// A DocC feature flag to enable support for linking to documentation dependencies.
184184
///
185-
/// The plugin defines this name so that it can specify documentation dependencies based on target dependencies when building combined documentation for multiple targets.
185+
/// The plugin defines this flag so that it can specify documentation dependencies based on target dependencies when building combined documentation for multiple targets.
186186
static let enableExternalLinkSupport = CommandLineArgument.Flag(
187187
preferred: "--enable-experimental-external-link-support"
188188
)
189189

190190
/// A DocC flag that specifies a dependency DocC archive that the current build can link to.
191191
///
192-
/// The plugin defines this name so that it can specify documentation dependencies based on target dependencies when building combined documentation for multiple targets.
192+
/// The plugin defines this option so that it can specify documentation dependencies based on target dependencies when building combined documentation for multiple targets.
193193
static let externalLinkDependency = CommandLineArgument.Option(
194194
preferred: "--dependency",
195195
kind: .arrayOfValues
196196
)
197197

198198
/// A DocC flag for the "merge" command that specifies a custom display name for the synthesized landing page.
199199
///
200-
/// The plugin defines this name so that it can specify the package name as the display name of the default landing page when building combined documentation for multiple targets.
200+
/// The plugin defines this option so that it can specify the package name as the display name of the default landing page when building combined documentation for multiple targets.
201201
static let synthesizedLandingPageName = CommandLineArgument.Option(
202202
preferred: "--synthesized-landing-page-name"
203203
)
204204

205205
/// A DocC flag for the "merge" command that specifies a custom kind for the synthesized landing page.
206206
///
207-
/// The plugin defines this name so that it can specify "Package" as the kind of the default landing page when building combined documentation for multiple targets.
207+
/// The plugin defines this option so that it can specify "Package" as the kind of the default landing page when building combined documentation for multiple targets.
208208
static let synthesizedLandingPageKind = CommandLineArgument.Option(
209209
preferred: "--synthesized-landing-page-kind"
210210
)

0 commit comments

Comments
 (0)