Skip to content

Commit 4ec8278

Browse files
committed
Add argument abstract and discourse to the list of doc comments
1 parent 6153314 commit 4ec8278

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Sources/Commands/PackageCommands/GenerateDocumentation.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,20 @@ extension CommandInfoV0 {
4141
return []
4242
}
4343

44-
var line = 0
4544
var docComments: SymbolGraph.LineList = if let abstract = self.abstract { .init([SymbolGraph.LineList.Line(text: abstract, range: nil )]) } else { .init([]) }
46-
line += 2
4745

4846
if let args = self.arguments, args.count != 0 {
4947
let commandString: String = myPath.joined(separator: " ")
5048

5149
docComments = .init(docComments.lines + [SymbolGraph.LineList.Line(text: "```\n" + commandString + self.usage(startlength: commandString.count, wraplength: 60) + "\n```", range: nil )]) // TODO parameterize the wrap length
52-
line += 2
5350
}
5451

5552
if let discussion = self.discussion {
5653
docComments = .init(docComments.lines + (discussion.split(separator: "\n").map({ SymbolGraph.LineList.Line(text: String($0), range: nil )})))
57-
line += 2
54+
}
55+
56+
for arg in self.arguments ?? [] {
57+
docComments = .init(docComments.lines + [SymbolGraph.LineList.Line(text: "## \(arg.identity())\n\n\(arg.abstract ?? "")\n\n" + (arg.discussion ?? ""), range: nil)])
5858
}
5959

6060
// TODO: Maybe someday there will be command-line semantics for the symbols and then these can be declared with more sensible categories

0 commit comments

Comments
 (0)