@@ -36,6 +36,14 @@ extension GenerateDoccReferenceError: CustomStringConvertible {
3636 }
3737}
3838
39+ /// The flavor of generated markdown to emit.
40+ enum OutputStyle : String , EnumerableFlag , ExpressibleByArgument {
41+ /// DocC-supported markdown
42+ case docc
43+ /// GitHub-flavored markdown
44+ case github
45+ }
46+
3947@main
4048struct GenerateDoccReference : ParsableCommand {
4149 static let configuration = CommandConfiguration (
@@ -53,7 +61,7 @@ struct GenerateDoccReference: ParsableCommand {
5361 @Option (
5462 name: . shortAndLong,
5563 help: " Use docc flavored markdown for the generated output. " )
56- var doccFlavored : Bool = false
64+ var style : OutputStyle = . github
5765
5866 func validate( ) throws {
5967 if outputDirectory != " - " {
@@ -112,12 +120,12 @@ struct GenerateDoccReference: ParsableCommand {
112120 do {
113121 if self . outputDirectory == " - " {
114122 try self . generatePages (
115- from: toolInfo. command, savingTo: nil , doccFlavored : doccFlavored )
123+ from: toolInfo. command, savingTo: nil , flavor : style )
116124 } else {
117125 try self . generatePages (
118126 from: toolInfo. command,
119127 savingTo: URL ( fileURLWithPath: outputDirectory) ,
120- doccFlavored : doccFlavored )
128+ flavor : style )
121129 }
122130 } catch {
123131 throw GenerateDoccReferenceError . failedToGenerateDoccReference (
@@ -129,14 +137,14 @@ struct GenerateDoccReference: ParsableCommand {
129137 /// - Parameters:
130138 /// - command: The command to parse into a markdown output.
131139 /// - directory: The directory to save the generated markdown file, printing it if `nil`.
132- /// - doccFlavored: A Boolean value the indicates whether to generate docc-flavored markdown .
140+ /// - flavor: The flavor of markdown to use when generating the content .
133141 /// - Throws: An error if the markdown file cannot be generated or saved.
134142 func generatePages(
135- from command: CommandInfoV0 , savingTo directory: URL ? , doccFlavored : Bool
143+ from command: CommandInfoV0 , savingTo directory: URL ? , flavor : OutputStyle
136144 )
137145 throws
138146 {
139- let page = command. toMarkdown ( [ ] , doccFlavored : doccFlavored )
147+ let page = command. toMarkdown ( [ ] , markdownStyle : style )
140148
141149 if let directory = directory {
142150 let fileName = command. doccReferenceFileName
0 commit comments